fromcompas.geometryimportPoint,Vector,Planefromcompas.geometryimportPolylinefromcompas.geometryimportBox,Cylinderfromcompas_occ.brepimportBRepfromcompas_view2.appimportAppR=1.4P=Point(0,0,0)X=Vector(1,0,0)Y=Vector(0,1,0)Z=Vector(0,0,1)YZ=Plane(P,X)ZX=Plane(P,Y)XY=Plane(P,Z)box=Box.from_width_height_depth(2*R,2*R,2*R)cx=Cylinder((YZ,0.7*R),4*R)cy=Cylinder((ZX,0.7*R),4*R)cz=Cylinder((XY,0.7*R),4*R)A=BRep.from_box(box)B1=BRep.from_cylinder(cx)B2=BRep.from_cylinder(cy)B3=BRep.from_cylinder(cz)# C = BRep.from_boolean_difference(# A,# BRep.from_boolean_union(# BRep.from_boolean_union(B1, B2),# B3# )# )C=A-(B1+B2+B3)# ==============================================================================# Visualisation# ==============================================================================# Currently, the viewer does not suppport BRep shapes.# Therefore we have to convert the components of the BRep to something the viewer does understand.mesh=C.to_tesselation()lines=[]circles=[]ellipses=[]foredgeinC.edges:ifedge.is_line:lines.append(edge.to_line())elifedge.is_circle:circles.append(Polyline(edge.curve.locus()))elifedge.is_ellipse:ellipses.append(Polyline(edge.curve.locus()))else:raiseNotImplementedErrorviewer=App(viewmode='ghosted',width=1600,height=900)viewer.view.camera.rz=-30viewer.view.camera.rx=-75viewer.view.camera.distance=7viewer.add(mesh,show_edges=False)forlineinlines:viewer.add(line,linewidth=2)forcircleincircles:viewer.add(circle,linewidth=2)forellipseinellipses:viewer.add(ellipse,linewidth=2)viewer.run()