Beispiel #1
0
 def load_stl(self, path):
     """ Load a stl model """
     builder = BRep_Builder()
     shape = TopoDS_Face()
     builder.MakeFace(shape)
     poly = RWStl.ReadFile_(path, None)
     builder.UpdateFace(shape, poly)
     return shape
Beispiel #2
0
def load_stl(filename):
    """ Load a stl model """
    builder = BRep_Builder()
    shape = TopoDS_Face()
    builder.MakeFace(shape)
    poly = RWStl.ReadFile_(filename, None)
    builder.UpdateFace(shape, poly)
    return [TopoShape(shape=shape)]
Beispiel #3
0
    def has_ancestor_face2(self, edge):
        """
        Get the ancestor face on the intersection edge on the second shape
        if available.

        :param afem.topology.entities.Edge edge: The edge.

        :return: *True* and the face if available, *False* and *None* if not.
        :rtype: tuple(bool, afem.topology.entities.Face or None)
        """
        f = TopoDS_Face()
        if self._bop.HasAncestorFaceOn2(edge.object, f):
            return True, Face(f)
        return False, None
Beispiel #4
0
    def has_ancestor_face2(self, edge):
        """
        Get the ancestor face on the intersection edge on the second shape
        if available.

        :param OCCT.TopoDS.TopoDS_Edge edge: The edge.

        :return: *True* and the face if available, *False* and *None* if not.
        :rtype: tuple(bool, OCCT.TopoDS.TopoDS_Face or None)
        """
        f = TopoDS_Face()
        if self._bop.HasAncestorFaceOn2(edge, f):
            return True, f
        return False, None
def split_shape(event=None):
    S = BRepPrimAPI_MakeBox(gp_Pnt(-100, -60, -80), 150, 200, 170).Shape()
    asect = BRepAlgoAPI_Section(S, gp_Pln(1, 2, 1, -15), False)
    asect.ComputePCurveOn1(True)
    asect.Approximation(True)
    asect.Build()
    R = asect.Shape()

    asplit = BRepFeat_SplitShape(S)

    for edg in TopologyExplorer(R).edges():
        face = TopoDS_Face()
        if asect.HasAncestorFaceOn1(edg, face):
            asplit.Add(edg, face)

    asplit.Build()
    display.EraseAll()
    display.DisplayShape(asplit.Shape())
    display.FitAll()