@@ -101,11 +101,6 @@ def build_curve_network(event=None, enforce_tangency=True):
101101 root_compound_shape = read_step_file ("../assets/models/splinecage.stp" )
102102 topology_explorer = TopologyExplorer (root_compound_shape )
103103
104- # approximate the hell out of all surfaces and curves
105- # I wanna see it in its full glory
106- display .Context .SetDeviationAngle (0.00001 ) # 0.001 -> default
107- display .Context .SetDeviationCoefficient (0.0001 ) # 0.001 -> default
108-
109104 tangent_constraint_faces = [f for f in topology_explorer .faces ()]
110105
111106 # loop through the imported faces
@@ -132,10 +127,10 @@ def build_curve_network(event=None, enforce_tangency=True):
132127 brep_plate_builder = BRepOffsetAPI_MakeFilling ()
133128
134129 if enforce_tangency :
135- print (" going for surface quality" )
136- brep_plate_builder .SetConstrParam (0.0001 , 0.001 , 0.01 , 0.01 ) # ?!!! Tol2d=1.0, Tol3d=1.0, TolAng=1.0, TolCurv=1.0
130+ print (' going for surface quality...' )
131+ brep_plate_builder .SetConstrParam (0.0001 , 0.001 , 0.01 , 0.01 ) # Tol2d=1.0, Tol3d=1.0, TolAng=1.0, TolCurv=1.0
137132 brep_plate_builder .SetApproxParam (8 , 240 ) # MaxDeg=8, MaxSegments=9
138- brep_plate_builder . SetResolParam ( 3 , 64 , 3 ) # Degree=3, NbPtsOnCur=15, NbIter=2, Anisotropie=0
133+ print ( 'done.' )
139134 else :
140135 print ("quick and dirty" )
141136
@@ -144,31 +139,22 @@ def build_curve_network(event=None, enforce_tangency=True):
144139 display .DisplayShape (i , color = random_color ())
145140 constraint_edg , support_face = i
146141 if constraint_edg .IsNull () or support_face .IsNull ():
147- print ("OMG null" )
142+ print ("Edge of face is null" )
148143 brep_plate_builder .Add (constraint_edg , support_face , GeomAbs_G1 )
149144
150- # not entirely sure why this fails... how is that different from adding from points?
151- # for e in edges_no_adjacent_face:
152- # brep_plate_builder.Add(e, GeomAbs_C0)
153-
154- # libc++abi.dylib: terminating with uncaught exception of type Standard_OutOfRange
155145 for e in edges_no_adjacent_face :
156146 display .DisplayShape (e )
157147 for pt in divide_edge_by_nr_of_points (e , 12 )[2 :- 2 ]:
158148 brep_plate_builder .Add (pt [1 ])
159149
160150 brep_plate_builder .Build ()
151+
161152 if brep_plate_builder .IsDone ():
162153 face = brep_plate_builder .Shape ()
163154 display .DisplayColoredShape (face , "ORANGE" )
164155 else :
165156 print ("constructing the surface failed" )
166157
167- #export_fname = os.path.join(pth, fname + "_pyocc_face.stp")
168- #step_export = STEPExporter(export_fname)
169- #step_export.add_shape(face)
170- #step_export.write_file()
171-
172158
173159if __name__ == "__main__" :
174160 build_curve_network ()
0 commit comments