Skip to content

Commit 0abab67

Browse files
author
fsalmoir
committed
some slight corrections
1 parent 2653ba7 commit 0abab67

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

pygem/igeshandler.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class IgesHandler(fh.FileHandler):
3232
:cvar list control_point_position: index of the first NURBS control point (or pole)
3333
of each face of the iges file.
3434
:cvar float tolerance: tolerance for the construction of the faces and wires
35-
in the write function.
35+
in the write function. Default value is 1e-6.
3636
3737
.. warning::
3838
@@ -129,9 +129,7 @@ def write(self, mesh_points, filename, tolerance=None):
129129

130130
self.outfile = filename
131131

132-
if tolerance is None:
133-
tolerance = self.tolerance
134-
else:
132+
if tolerance is not None:
135133
self.tolerance = tolerance
136134

137135
# init the ouput file writer
@@ -180,7 +178,7 @@ def write(self, mesh_points, filename, tolerance=None):
180178
# construct the deformed wire for the trimmed surfaces
181179
wire_maker = BRepBuilderAPI_MakeWire()
182180
tol = ShapeFix_ShapeTolerance()
183-
brep = BRepBuilderAPI_MakeFace(occ_face.GetHandle(), tolerance).Face()
181+
brep = BRepBuilderAPI_MakeFace(occ_face.GetHandle(), self.tolerance).Face()
184182
brep_face = BRep_Tool.Surface(brep)
185183

186184
# cycle on the edges
@@ -192,7 +190,7 @@ def write(self, mesh_points, filename, tolerance=None):
192190
# evaluating the new edge: same (u,v) coordinates, but different (x,y,x) ones
193191
edge_phis_coordinates_aux = BRepBuilderAPI_MakeEdge(edge_uv_coordinates[0], brep_face)
194192
edge_phis_coordinates = edge_phis_coordinates_aux.Edge()
195-
tol.SetTolerance(edge_phis_coordinates, tolerance)
193+
tol.SetTolerance(edge_phis_coordinates, self.tolerance)
196194
wire_maker.Add(edge_phis_coordinates)
197195
edge_explorer.Next()
198196

tests/test_igeshandler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,16 @@ def test_iges_write_outfile_tolerance(self):
145145
iges_handler = ih.IgesHandler()
146146
mesh_points = iges_handler.parse('tests/test_datasets/test_pipe.iges')
147147
outfilename = 'tests/test_datasets/test_pipe_out.iges'
148-
iges_handler.write(mesh_points, outfilename, 1e-4)
149-
assert iges_handler.tolerance == 1e-4
148+
iges_handler.write(mesh_points, outfilename, 1e-3)
149+
assert iges_handler.tolerance == 1e-3
150150
os.remove(outfilename)
151151

152152

153153
def test_iges_write_modified_tolerance(self):
154154
iges_handler = ih.IgesHandler()
155155
mesh_points = iges_handler.parse('tests/test_datasets/test_pipe.iges')
156156
outfilename = 'tests/test_datasets/test_pipe_out.iges'
157-
iges_handler.write(mesh_points, outfilename, 1e-4)
157+
iges_handler.write(mesh_points, outfilename, 1e-3)
158158
assert iges_handler.outfile == outfilename
159159
os.remove(outfilename)
160160

0 commit comments

Comments
 (0)