Skip to content

How to substract a Ball.stl from a Cube.stl and save it as stl again? #22

Answered by jimy-byerley
Boehm92 asked this question in Q&A
Discussion options

You must be logged in to vote

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:

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()

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Boehm92
Comment options

@jimy-byerley
Comment options

Answer selected by Boehm92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants