pythonocc-core icon indicating copy to clipboard operation
pythonocc-core copied to clipboard

`angular_deflection` in `write_stl_file` doesn't work when Use the command twice at once with different values

Open QHQIII opened this issue 3 years ago • 2 comments

I am trying to control the file size by angular_deflection in write_stl_file, but when I Use the command twice at once with different values of angular_deflection, I can only get two files of the same size. Did I make a mistake?

input_filepath="C:\\Users\\BREEZ\\Desktop\\temp\\3D\\3D15-H06.step"
o1="C:\\Users\\BREEZ\\Desktop\\temp\\3D\\3.stl"
o2="C:\\Users\\BREEZ\\Desktop\\temp\\3D\\4.stl"
shapes = read_step_file(input_filepath)
write_stl_file(shapes,o1,"binary",0.1,0.5)
write_stl_file(shapes,o2,"binary",0.5,0.5)

image

QHQIII avatar Jan 03 '22 07:01 QHQIII

Just a theory: If the precision of your STL file was fully determined by the linear deflection (because it was so small) then angular_deflection could have no effect. You could check this theory by increasing linear_deflection considerably.

cafhach avatar Jan 26 '22 07:01 cafhach

You may try calling BRepTools::Clean() on a shape before each write_stl_file() to ensure old triangulation is not reused (don't know what write_stl_file() does internally).

gkv311 avatar Jan 26 '22 08:01 gkv311