Skip to content

Commit c4c38ca

Browse files
fsalmoirmtezzele
authored andcommitted
some tests for tolerance on iges added
1 parent 99f2e4a commit c4c38ca

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

pygem/igeshandler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ def write(self, mesh_points, filename, tolerance=None):
131131

132132
if tolerance is None:
133133
tolerance = self.tolerance
134+
else:
135+
self.tolerance = tolerance
134136

135137
# init the ouput file writer
136138
writer = IGESControl_Writer()

tests/test_igeshandler.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ def test_iges_default_control_point_position_member(self):
2727
def test_iges_default_outfile_member(self):
2828
iges_handler = ih.IgesHandler()
2929
assert iges_handler.outfile == None
30+
31+
32+
def test_iges_default_tolerance(self):
33+
iges_handler = ih.IgesHandler()
34+
assert iges_handler.tolerance == 1e-6
3035

3136

3237
def test_iges_default_extension_member(self):
@@ -141,10 +146,18 @@ def test_iges_write_outfile_tolerance(self):
141146
mesh_points = iges_handler.parse('tests/test_datasets/test_pipe.iges')
142147
outfilename = 'tests/test_datasets/test_pipe_out.iges'
143148
iges_handler.write(mesh_points, outfilename, 1e-4)
144-
assert iges_handler.outfile == outfilename
149+
assert iges_handler.tolerance == 1e-4
145150
os.remove(outfilename)
146151

147152

153+
def test_iges_write_modified_tolerance(self):
154+
iges_handler = ih.IgesHandler()
155+
mesh_points = iges_handler.parse('tests/test_datasets/test_pipe.iges')
156+
outfilename = 'tests/test_datasets/test_pipe_out.iges'
157+
iges_handler.write(mesh_points, outfilename, 1e-4)
158+
assert iges_handler.outfile == outfilename
159+
os.remove(outfilename)
160+
148161

149162
def test_iges_write_comparison_iges(self):
150163
iges_handler = ih.IgesHandler()

0 commit comments

Comments
 (0)