Hi,
I recently made compas_cgal available for the Rhino 8 Script Editor.
It should generally work on most Mac, Windows, and Linux systems (outside Rhino).
Here are some examples: Examples — COMPAS CGAL
A GitHub Action builds this package for Python from 3.9 to 3.13 and uploads it to PyPI.
Therefore, the simple #r:
tag should be the only command needed to install it.
I would be grateful if anyone could test whether it works. Here is a sample script for the ScriptEditor:
#! python3
# r: compas, compas_cgal
from compas.geometry import Box
from compas.geometry import Polyhedron
from compas.geometry import Sphere
from compas.datastructures import Mesh
from compas_cgal.booleans import (
boolean_difference_mesh_mesh,
boolean_intersection_mesh_mesh,
boolean_union_mesh_mesh,
split_mesh_mesh,
)
from compas_cgal.meshing import mesh_remesh
from compas.scene import Scene
box = Box(2)
A = box.to_vertices_and_faces(triangulated=True)
sphere = Sphere(1, point=[1, 1, 1])
B = sphere.to_vertices_and_faces(u=64, v=64, triangulated=True)
B = mesh_remesh(B, 0.3, 50)
V, F = boolean_difference_mesh_mesh(A, B)
shape = Polyhedron(V.tolist(), F.tolist())
shape = shape.to_mesh()
scene = Scene()
scene.clear_context()
scene.add(shape)
scene.draw()
It remeshes a sphere and performs mesh boolean-difference:
P.S. if anyone wants to contribute to compas_cgal package or just curious how the binding C++ to Python works, I am happy to share the little details behind this process
@eirannejad ScriptEditor is really great and helps to bring a lot of things, we could not do before, thanks!