Beispiel #1
0
from compas.rpc import Proxy

slicer = Proxy('compas_cgal.slicer')

# ==============================================================================
# Get the bunny and construct a mesh
# ==============================================================================

bunny = Mesh.from_ply(compas.get('bunny.ply'))

# ==============================================================================
# Move the bunny to the origin and rotate it upright.
# ==============================================================================

vector = Vector(*bunny.centroid())
T = Translation.from_vector(vector.scaled(-1))
S = Scale.from_factors([100, 100, 100])
R = Rotation.from_axis_and_angle(Vector(1, 0, 0), math.radians(90))

bunny.transform(R * S * T)

# ==============================================================================
# Create planes
# ==============================================================================

# replace by planes along a curve

bbox = bunny.bounding_box()

x, y, z = zip(*bbox)
xmin, xmax = min(x), max(x)