How to substract a Ball.stl from a Cube.stl and save it as stl again? #22
-
Hi, I found an example code in the issue section and tried it with the supplied files. If I delete the mc.segmentation code it works for me, else I get ('NoneType' object has no attribute 'points'). I would be thankful for a simple example. Kind Regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Welcome there @Boehm92 ! import madcad as mc
a = mc.read('file1.stl')
b = mc.read('file2.stl')
a.mergeclose() # don't forget to merge close points from STL files, as they provide unconnected triangles, we have to connect it again before boolean operations
b.mergeclose()
result = mc.difference(a, b)
mc.show([result])
mc.write('result.stl') What is the example you are refering to which is not working properly ? so I can take a look |
Beta Was this translation helpful? Give feedback.
Welcome there @Boehm92 !
it you only need to reexport to
.stl
then you don't need the segmentation step, the segmentation only groups triangles by guessing soft and sharp regions in the mesh, it is helpful to have a nice visualization or to perform engineering operations by designating groups. but it you only need to reexport then it's pointless since the STL format doesn't cary groups but only triangles.Something as simple as this should work: