@@ -214,7 +214,6 @@ def make_solid(*args):
214214 sld = BRepBuilderAPI_MakeSolid (* args )
215215 with assert_isdone (sld , 'failed to produce solid' ):
216216 result = sld .Solid ()
217- sld .Delete ()
218217 return result
219218
220219
@@ -224,7 +223,6 @@ def make_shell(*args):
224223 st = ShapeToTopology ()
225224 with assert_isdone (shell , 'failed to produce shell' ):
226225 result = shell .Shell ()
227- shell .Delete ()
228226 return st (result )
229227
230228
@@ -233,7 +231,6 @@ def make_face(*args):
233231 face = BRepBuilderAPI_MakeFace (* args )
234232 with assert_isdone (face , 'failed to produce face' ):
235233 result = face .Face ()
236- face .Delete ()
237234 return result
238235
239236
@@ -242,7 +239,6 @@ def make_edge2d(*args):
242239 edge = BRepBuilderAPI_MakeEdge2d (* args )
243240 with assert_isdone (edge , 'failed to produce edge' ):
244241 result = edge .Edge ()
245- edge .Delete ()
246242 return result
247243
248244
@@ -251,7 +247,6 @@ def make_edge(*args):
251247 edge = BRepBuilderAPI_MakeEdge (* args )
252248 with assert_isdone (edge , 'failed to produce edge' ):
253249 result = edge .Edge ()
254- edge .Delete ()
255250 return result
256251
257252
@@ -260,10 +255,8 @@ def make_vertex(*args):
260255 vert = BRepBuilderAPI_MakeVertex (* args )
261256 with assert_isdone (vert , 'failed to produce vertex' ):
262257 result = vert .Vertex ()
263- vert .Delete ()
264258 return result
265259
266-
267260@wraps (BRepBuilderAPI_MakeWire )
268261def make_wire (* args ):
269262 # if we get an iterable, than add all edges to wire builder
@@ -580,14 +573,14 @@ def make_constrained_surface_from_edges(edges): #, w
580573 for edg in edges :
581574 c = BRepAdaptor_HCurve ()
582575 c .ChangeCurve ().Initialize (edg )
583- constraint = BRepFill_CurveConstraint (c . GetHandle () , 0 )
576+ constraint = BRepFill_CurveConstraint (c , 0 )
584577 bpSrf .Add (constraint )
585578 bpSrf .Perform ()
586579 maxSeg , maxDeg , critOrder = 9 , 8 , 0
587580 tol = 1e-4
588581 srf = bpSrf .Surface ()
589582 plate = GeomPlate_MakeApprox (srf , tol , maxSeg , maxDeg , tol , critOrder )
590- uMin , uMax , vMin , vMax = srf .Bounds () #srf.GetObject().Bounds()
583+ uMin , uMax , vMin , vMax = srf .Bounds ()
591584 face = make_face (plate .Surface (), uMin , uMax , vMin , vMax )
592585 #face = make_face(srf, w, False) #plate.Surface(), uMin, uMax, vMin, vMax)
593586 return face
@@ -606,7 +599,6 @@ def add_wire_to_face(face, wire, reverse=False):
606599 wire .Reverse ()
607600 face .Add (wire )
608601 result = face .Face ()
609- face .Delete ()
610602 return result
611603
612604
@@ -676,15 +668,14 @@ def trim_wire(wire, shapeLimit1, shapeLimit2, periodic=False):
676668 adap = to_adaptor_3d (wire )
677669 bspl = adap .BSpline ()
678670 if periodic :
679- spl = bspl # .GetObject()
680- if spl .IsClosed ():
681- spl .SetPeriodic ()
671+ if bspl .IsClosed ():
672+ bspl .SetPeriodic ()
682673 else :
683674 warnings .warn ('the wire to be trimmed is not closed, hence cannot be made periodic' )
684675 p1 = project_point_on_curve (bspl , shapeLimit1 )[0 ]
685676 p2 = project_point_on_curve (bspl , shapeLimit2 )[0 ]
686677 a , b = sorted ([p1 , p2 ])
687- tr = Geom_TrimmedCurve (bspl , a , b ). GetHandle ()
678+ tr = Geom_TrimmedCurve (bspl , a , b )
688679 return make_edge (tr )
689680
690681#===========================================================================
@@ -696,7 +687,7 @@ def fix_shape(shp, tolerance=1e-3):
696687 from OCC .Core .ShapeFix import ShapeFix_Shape
697688 fix = ShapeFix_Shape (shp )
698689 fix .SetFixFreeShellMode (True )
699- sf = fix .FixShellTool () #.GetObject()
690+ sf = fix .FixShellTool ()
700691 sf .SetFixOrientationMode (True )
701692 fix .LimitTolerance (tolerance )
702693 fix .Perform ()
@@ -823,16 +814,16 @@ def face_normal(face):
823814
824815
825816def face_from_plane (_geom_plane , lowerLimit = - 1000 , upperLimit = 1000 ):
826- from OCC .Core . Geom import Geom_RectangularTrimmedSurface
827- _trim_plane = make_face (Geom_RectangularTrimmedSurface (_geom_plane . GetHandle () , lowerLimit , upperLimit , lowerLimit , upperLimit ). GetHandle ( ))
817+ from OCC .Geom import Geom_RectangularTrimmedSurface
818+ _trim_plane = make_face (Geom_RectangularTrimmedSurface (_geom_plane , lowerLimit , upperLimit , lowerLimit , upperLimit ))
828819 return _trim_plane
829820
830821
831822def find_plane_from_shape (shape , tolerance = - 1 ):
832823 try :
833824 fpl = BRepBuilderAPI_FindPlane (shape , tolerance )
834825 if fpl .Found ():
835- return fpl .Plane () #.GetObject()
826+ return fpl .Plane ()
836827 else :
837828 return None
838829 except :
@@ -854,7 +845,7 @@ def fit_plane_through_face_vertices(_face):
854845 [NORMALS .Append (i ) for i in normals ]
855846 POINTS = to_tcol_ (points , TColgp_HArray1OfPnt )
856847
857- pl = GeomPlate_BuildAveragePlane (NORMALS , POINTS ).Plane () #.GetObject()
848+ pl = GeomPlate_BuildAveragePlane (NORMALS , POINTS ).Plane ()
858849 vec = gp_Vec (pl .Location (), _face .GlobalProperties .centre ())
859850 pt = (pl .Location ().as_vec () + vec ).as_pnt ()
860851 pl .SetLocation (pt )
@@ -867,13 +858,13 @@ def project_edge_onto_plane(edg, plane):
867858 :param plane: Geom_Plane
868859 :return: TopoDS_Edge projected on the plane
869860 """
870- from OCC .Core . GeomProjLib import geomprojlib_ProjectOnPlane
871- proj = geomprojlib_ProjectOnPlane (edg .adaptor .Curve ().Curve (), plane . GetHandle () , plane .Axis ().Direction (), 1 )
861+ from OCC .GeomProjLib import geomprojlib_ProjectOnPlane
862+ proj = geomprojlib_ProjectOnPlane (edg .adaptor .Curve ().Curve (), plane , plane .Axis ().Direction (), 1 )
872863 return make_edge (proj )
873864
874865
875- def curve_to_bspline (crv_handle , tolerance = TOLERANCE , continuity = GeomAbs_C1 , sections = 300 , degree = 12 ):
876- approx_curve = GeomConvert_ApproxCurve (crv_handle , tolerance , continuity , sections , degree )
866+ def curve_to_bspline (crv , tolerance = TOLERANCE , continuity = GeomAbs_C1 , sections = 300 , degree = 12 ):
867+ approx_curve = GeomConvert_ApproxCurve (crv , tolerance , continuity , sections , degree )
877868 with assert_isdone (approx_curve , 'could not compute bspline from curve' ):
878869 return approx_curve .Curve ()
879870
0 commit comments