def brepfeat_prism(event=None): box = BRepPrimAPI_MakeBox(400, 250, 300).Shape() faces = Topo(box).faces() for i in range(3): face = next(faces) srf = BRep_Tool_Surface(face) c = gp_Circ2d(gp_Ax2d(gp_Pnt2d(200, 130), gp_Dir2d(1, 0)), 75) circle = Geom2d_Circle(c).GetHandle() wire = BRepBuilderAPI_MakeWire() wire.Add(BRepBuilderAPI_MakeEdge(circle, srf, 0., pi).Edge()) wire.Add(BRepBuilderAPI_MakeEdge(circle, srf, pi, 2. * pi).Edge()) wire.Build() display.DisplayShape(wire.Wire()) mkf = BRepBuilderAPI_MakeFace() mkf.Init(srf, False, 1e-6) mkf.Add(wire.Wire()) mkf.Build() new_face = mkf.Face() breplib_BuildCurves3d(new_face) display.DisplayColoredShape(box, 'GREEN') display.DisplayShape(new_face) """ prism = BRepFeat_MakeDPrism(box, mkf.Face(), face, 100, True, True) prism.Perform(400) assert prism.IsDone() display.EraseAll() display.DisplayShape(prism.Shape()) """ #display.DisplayColoredShape(wire.Wire(), 'RED') display.FitAll()
def points_from_curve(): radius = 5. abscissa = 3. circle = Geom2d_Circle(gp_OX2d(), radius, True) gac = Geom2dAdaptor_Curve(circle.GetHandle()) ua = GCPnts_UniformAbscissa(gac, abscissa) a_sequence = [] if ua.IsDone(): n = ua.NbPoints() for count in range(1, n + 1): p = gp_Pnt2d() circle.D0(ua.Parameter(count), p) a_sequence.append(p) # convert analytic to bspline display.DisplayShape(circle, update=True) i = 0 for p in a_sequence: i += 1 pstring = 'P%i : parameter %f' % (i, ua.Parameter(i)) pnt = gp_Pnt(p.X(), p.Y(), 0) # display points display.DisplayShape(pnt, update=True) display.DisplayMessage(pnt, pstring)