-
-
Notifications
You must be signed in to change notification settings - Fork 405
Closed
Description
I want to split the box by plane.
I can make the intersection between box and plane used by BRepAlgoAPI_Section.
But, I cannot split the box. I used BRepFeat_SplitShape.
I got following error.
TypeError: in method 'BRepFeat_SplitShape_Add', argument 2 of type 'TopoDS_Edge const &'
I want to know how to use BRepFeat_SplitShape_Add in my code.
import numpy as np
import matplotlib.pyplot as plt
from OCC.Display.SimpleGui import init_display
from OCC.gp import gp_Pnt, gp_Vec, gp_Dir, gp_Ax1, gp_Ax2, gp_Ax3, gp_Trsf
from OCC.gp import gp_Lin, gp_Pln, gp_Elips
from OCC.TopoDS import TopoDS_Shape
from OCC.TopoDS import TopoDS_Wire, TopoDS_Edge, TopoDS_Face
from OCC.TopExp import TopExp_Explorer
from OCC.TopAbs import TopAbs_EDGE, TopAbs_FACE, TopAbs_REVERSED
from OCC.BRepFeat import BRepFeat_SplitShape
from OCC.BRepAlgoAPI import BRepAlgoAPI_Section
from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeWire
from OCCUtils.Construct import dir_to_vec, vec_to_dir
from OCCUtils.Construct import make_box, make_plane, make_wire, make_face
from OCCUtils.Topology import Topo, dumpTopology
if __name__ == "__main__":
display, start_display, add_menu, add_function_to_menu = init_display()
base = make_box (100, 100, 100)
p, v = gp_Pnt(50, 50, 50), gp_Vec(1, 1, 1)
sect = BRepAlgoAPI_Section (base, gp_Pln(p, vec_to_dir(v)))
sect.Build()
edge = sect.Shape()
display.DisplayShape (gp_Pnt())
display.DisplayShape (base)
display.DisplayShape (edge)
splt = BRepFeat_SplitShape (base)
wire = []
Ex = TopExp_Explorer (edge, TopAbs_EDGE)
while Ex.More():
print (Ex.Current())
Sx = TopExp_Explorer (base, TopAbs_FACE)
while Sx.More():
if sect.HasAncestorFaceOn1(Ex.Current(), Sx.Current()):
print (Ex.Current(), Sx.Current())
splt.Add (Ex.Current(), Sx.Current())
Sx.Next()
Ex.Next()
display.FitAll()
start_display ()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels