def __init__(self, edges, name="edges", color=None):
     super().__init__()
     self.edges = edges
     self.name = name
     self._compound = Compound.makeCompound(edges.objects)
     self.id = self.next_id()
     if color is not None:
         self.color = color
Ejemplo n.º 2
0
def exportSTL(cadObj, filename, precision=0.001):
    compound = None
    if isinstance(cadObj, cadquery.Shape):
        compound = Compound.makeCompound(cadObj.objects)
    elif isinstance(cadObj, cadquery.Workplane):
        compound = Compound.makeCompound(cadObj.objects)
    elif isinstance(cadObj, cq_jupyter.Assembly):
        compound = cadObj.compound()
    elif isinstance(cadObj, cq_jupyter.Part):
        compound = cadObj.compound()
    elif has_cqparts and isinstance(cadObj, cqparts.Assembly):
        assembly = convertCqparts(cadObj)
        exportSTL(assembly, filename, precision)
    elif has_cqparts and isinstance(cadObj, cqparts.Part):
        part = cq_jupyter.Part(cadObj.local_obj, "part")
        exportSTL(part, filename)
    else:
        print("Unknown CAD object", type(cadObj))

    if compound is not None:
        compound.exportStl(filename, precision=precision)   
 def __init__(self,
              shape,
              name="part",
              color=None,
              show_faces=True,
              show_edges=True):
     super().__init__()
     self.name = name
     self.id = self.next_id()
     if color is not None:
         self.color = color
     self.shape = shape
     self._compound = Compound.makeCompound(shape.objects)
     self.show_faces = show_faces
     self.show_edges = show_edges
 def compound(self):
     return Compound.makeCompound(self.compounds())