Beispiel #1
0
from compas.geometry import Point, Vector, Frame, Polyline
from compas.geometry import Box
from compas.geometry import Translation
from compas.datastructures import Mesh

from compas_view2.app import App
from compas_gmsh.models import ShapeModel

# ==============================================================================
# Geometry
# ==============================================================================

b1 = Box(Frame.worldXY(), 1, 1, 1)
b2 = Box(Frame(b1.vertices[6], Vector.Xaxis(), Vector.Yaxis()), 1, 1, 1)

# ==============================================================================
# CSG Model
# ==============================================================================

model = ShapeModel(name="booleans")

model.options.mesh.lmin = 0.2
model.options.mesh.lmax = 0.2

model.boolean_fragment([model.add_box(b1)], [model.add_box(b2)])

model.generate_mesh(2)
model.optimize_mesh()

# ==============================================================================
# Fragments