how to perform boolean operations on an imported STL?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
chgray
Posts: 8
Joined: Sat Jan 14, 2012 7:07 pm

how to perform boolean operations on an imported STL?

Post by chgray »

I've got an imported STL file that I'd like to use in a boolean operation - it's a big screw that I want to cut from my main object

the imported STL file isnt showing up as an item capable of boolean operations

is this a bug? is there a way to accomplish this?

thanks!
-CG
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: how to perform boolean operations on an imported STL?

Post by wmayer »

But you looked in the Mesh menu? The boolean operations you may see in a toolbar are working for part objects only, not for meshes. Nevertheless the boolean operation with meshes are rather weak and you may not get the result you'd expect.
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: how to perform boolean operations on an imported STL?

Post by NormandC »

Just an idea, Werner will confirm if it's a good one or not: convert your imported STL to solid so you can unlock the Part tools, you can convert your object back to mesh afterwards.

To convert to solid is a 2-step process: first select your object, then switch to Part workbench. Go to "Part --> Create shape from mesh..." menu. Now select the newly created shape in the Project tree, and go to "Part --> Convert to solid" menu. Hide the first two objects, you can now get to work on the third object with (Solid) appended to its name.

I tried it on two different imported STL files, and it seems to work.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: how to perform boolean operations on an imported STL?

Post by wmayer »

You should also run the refinement tool from the Part menu. The point is that when converting a mesh to a part object we create a face for each triangle and this makes the B-REP structure quite overloaded. However, the refinement only works for planar areas because for curved areas we don't know what kind of geometry the triangles describe.
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: how to perform boolean operations on an imported STL?

Post by NormandC »

He may not have the Refine Shape tool if he's on v0.12, it was added in v0.13 unstable I think?

Anyway, I didn't mention it, because out of two STL files I tried, the boolean cut failed on one of them that I had refined first. In both files the boolean cut worked on the non-refined solid.

Since the refine did not clean up all flat faces, I was planning to post about it in the face union topic.
kvonarya
Posts: 10
Joined: Tue Dec 01, 2020 11:17 pm

Re: how to perform boolean operations on an imported STL?

Post by kvonarya »

I am using version 0.18 believed to be the latest
I imported a part (stl file about 1mbyte) tried to cut a hole in it (rectangular) , did not work.
next I converted the stl mesh (create shape from mesh) and then converted it to solid, converted my cube to solid too, then tried to cut (subtract),
it did not work, the outline of cube show on surface of imported stl but not a hole all the way.
Next I refined the imported stl after creating shape an conversion to solid and tried again to cut, did not work like above.
So I wonder what elses to try to cut a whole in the imported stl part?
I notice besides create a shape from mesh there is another option "shape builder" with many options to build shape, could that help here?
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: how to perform boolean operations on an imported STL?

Post by TheMarkster »

kvonarya wrote: Wed Dec 09, 2020 1:19 pm I am using version 0.18 believed to be the latest
I imported a part (stl file about 1mbyte) tried to cut a hole in it (rectangular) , did not work.
next I converted the stl mesh (create shape from mesh) and then converted it to solid, converted my cube to solid too, then tried to cut (subtract),
it did not work, the outline of cube show on surface of imported stl but not a hole all the way.
Next I refined the imported stl after creating shape an conversion to solid and tried again to cut, did not work like above.
So I wonder what elses to try to cut a whole in the imported stl part?
I notice besides create a shape from mesh there is another option "shape builder" with many options to build shape, could that help here?
In Mesh Design try to create a primitive cube and use it to cut with a boolean difference in that workbench. 0.19 development version is the latest that most on here are using.
User avatar
KDM
Posts: 147
Joined: Sun Feb 20, 2022 9:30 am

Re: how to perform boolean operations on an imported STL?

Post by KDM »

NormandC wrote: Sat Mar 03, 2012 4:55 pm Just an idea, Werner will confirm if it's a good one or not: convert your imported STL to solid so you can unlock the Part tools, you can convert your object back to mesh afterwards.
I know it's an old post, but it was worth a mention: it pulled me out of a hole tonight... I'm now on v0.19. The "Convert to Solid asked me something about sewing, but I just accepted the default. No problems.
kvonarya wrote: Wed Dec 09, 2020 1:19 pm I imported a part (stl file about 1mbyte) tried to cut a hole in it (rectangular) , did not work.
Are you sure yo followed:
NormandC wrote: Sat Mar 03, 2012 4:55 pm To convert to solid is a 2-step process: first select your object, then switch to Part workbench. Go to "Part --> Create shape from mesh..." menu. Now select the newly created shape in the Project tree, and go to "Part --> Convert to solid" menu. Hide the first two objects, you can now get to work on the third object with (Solid) appended to its name.
The underlined bits are important: a trap I almost fell into.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: how to perform boolean operations on an imported STL?

Post by wmayer »

The "Convert to Solid asked me something about sewing, but I just accepted the default. No problems.
When not sewing then it creates a compound which is very fast and in many cases it's sufficient. When sewing then it creates a shell or solid and this consumes time and memory.
Post Reply