Selecting all faces on a plane of an STL->mesh item for adaptive clearing

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
UYLN4BR
Posts: 2
Joined: Sun Apr 11, 2021 2:33 pm

Selecting all faces on a plane of an STL->mesh item for adaptive clearing

Post by UYLN4BR »

I'm using freecad 0.19 rev 24276 and I am trying to generate a tool path for a silly maze off thingaverse. I have:

1. imported it as a mesh,
mesh.png
mesh.png (77.2 KiB) Viewed 1302 times
2. put the mesh into round stock and created a facing path operation:
mesh_w_facing.png
mesh_w_facing.png (107.51 KiB) Viewed 1302 times
Now, I was hoping to use the "Adaptive Clearing and Profiling" tool to mill out the pockets of the maze itself. However, I can't find a way to add all the triangles from the maze floor's plane. I seem to have to click on each triangle and add it one by one into the base geometry:
mesh_add_triangle.png
mesh_add_triangle.png (197.84 KiB) Viewed 1302 times

Is there an easier way to add all these triangles? I think I could figure out how to make all those triangles into one circle in the base model, but I'd like to be able to add strangle polygonal surfaces that may not even be a plane all at once.

Is there a way to do this in the GUI? If there isn't, can someone point me in the direction for finding all these polygons with python code?
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: Selecting all faces on a plane of an STL->mesh item for adaptive clearing

Post by chrisb »

Hi and welcome to the forum!

STL is among the worst data exchange format. So the first choice would be to remodel this not really complex maze. No time will be lost for trying and failing to handle the mesh - which is only one character away from a mess. It may after all not be faster, but sure better. Even a cheap mill will do better than the tesselation, and FreeCAD circles are really round and no polygons.

If you really want to stick to the mesh, you should first refine it. Then you can experiment with Path->FinishSelectingLoop.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: Selecting all faces on a plane of an STL->mesh item for adaptive clearing

Post by chrisb »

While doing other things I have imported the mesh converted it to a shape and did the refine. This took from my last post here until now. The file is now 94MB large, and I will not analyze it further due to the enormous calculation time. The refined thing, however, looks good:
SnipScreenshot-17dc9f.png
SnipScreenshot-17dc9f.png (103.86 KiB) Viewed 1279 times
You could try now to convert it to a solid and create a path for it, but besides the flaws mentioned above, my (educated) guess is, that it will take again hours to complete and depending on your mill there is the danger of overflowing it as well.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
UYLN4BR
Posts: 2
Joined: Sun Apr 11, 2021 2:33 pm

Re: Selecting all faces on a plane of an STL->mesh item for adaptive clearing

Post by UYLN4BR »

chrisb,

Thanks for pointing me towards the "refine mesh" tool and thank you for your patience with this rank amateur. My machine is chugging away on that refine operation right now.

I realize that my problem seems like an XY Problem, but this maze is only the beginning. I am just trying to get it to work and then I would like to mill out other objects from thingaverse without generating new models for every item. Is there a way to bulk select the faces that are visible when looking down the Z axis onto the model? I did the Edit->Box Selection, but then I'm unable to add it to the base geometry.
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: Selecting all faces on a plane of an STL->mesh item for adaptive clearing

Post by chrisb »

In the case of the refined version you can select the bottom - which then is a single face - and create a pocket.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: Selecting all faces on a plane of an STL->mesh item for adaptive clearing

Post by chrisb »

I waited for several hours to create a pocket from the bottom face as described above. Your computer ma be more powerful and manage it, but I would recommend: If you want to use models from thingiverse, use the same software they use, it may be more efficient.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Russ4262
Posts: 951
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: Selecting all faces on a plane of an STL->mesh item for adaptive clearing

Post by Russ4262 »

UYLN4BR wrote: Sun Apr 11, 2021 7:09 pm chrisb,

Thanks for pointing me towards the "refine mesh" tool and thank you for your patience with this rank amateur. My machine is chugging away on that refine operation right now.

I realize that my problem seems like an XY Problem, but this maze is only the beginning. I am just trying to get it to work and then I would like to mill out other objects from thingaverse without generating new models for every item. Is there a way to bulk select the faces that are visible when looking down the Z axis onto the model? I did the Edit->Box Selection, but then I'm unable to add it to the base geometry.
Here is a set of steps to a simple maze-shape face:
  1. Import the mesh into FreeCAD.
  2. Switch to Part workbench.
  3. In the object tree, select the mesh object.
  4. From Part menu, apply "Create shape from mesh" - This process took about five minutes on my machine, using default tolerance value of 0.01.
  5. In the object tree, select the new maze shape.
  6. From Part menu, apply "Convert to solid" - This process took about one minute and creates a new maze shape object with a "(Solid)" tag in the label.
  7. Click the Recompute icon to trigger the flagged recompute for the new solid.
  8. (OPTIONAL) In the object tree, select both the original mesh and the first mesh shape objects, and delete them.
  9. Click the yellow Cylinder creation tool. Set radius to 75mm and height to 2mm
  10. In the object tree, select the Cylinder object. Change its Z position Placement to 5mm. This raises the disc up off the floor of the maze solid.
  11. In the object tree, first select the Cylinder, then CTRL key and select the maze solid.
  12. Click the Cut tool in the toolbar. This process took about 4 or 5 minutes on my machine.
You are now ready to use this Cut object in the Path workbench as a base for a Job object, which will contain path operations.


If you wish to further simplify the geometry before creating a Job and operations, you may do the following to extract the actual primary maze path as a simple face shape in the object tree.
  1. (OPTIONAL) Switch to the Draft workbench. In the object tree, select the Cut object we just made. Click the Downgrade tool in the toolbar. It is the large, blue down arrow. This will separate four child solids contained within the Cut object into individual solid objects.
  2. Switch to the Path workbench.
  3. Select the top face of the primary maze path. Remember, there are four solid pieces. One is the primary maze path. You need the top face of that one.
  4. Right click on the mouse and apply "Send to Python Console".
  5. In the Python Console window, you should see the second to last entry as starting with "elt = App.Active..."
  6. In the Python Console type "import Part" and press Enter. Type "Part.show(elt)" and press Enter. This will create a new Shape object in the object tree - it is an independent, face only, shape object.
  7. This new Shape object is also available for extrusion in the Part workbench, or use in the Path workbench as a base for a Job and its operations.
  8. This face-extraction-process can be repeated for the other three faces if you find it useful.
The steps above are purely to extract the path portion of the original model. The Cut object could also be used to reconstruct the original maze shape in FreeCAD natively.

Hope this helps.

chrisb wrote: Sun Apr 11, 2021 10:20 pm I waited for several hours to create a pocket from the bottom face as described above. ...
This is due to the Extensions feature that is enabled by default. I ran into this long compute time a while back and needed a solution. I have a draft PR, #4388 Improved Extensions feature and add to Adaptive operation, that has a manual push button, among other improvements, to enable the Extensions feature just for cases like this one where being on by default consumes a lot of time. There are a number of other extension upgrades in the PR. However, the PR is still needs a bit more testing before being flagged as ready for review. Also, I will post it to the forum officially for user input once I am content with it. Feel free to build and test if you like.

Cheers,
Russell
Attachments
A sample Adaptive operation on the maze path with 3mm endmill.
A sample Adaptive operation on the maze path with 3mm endmill.
Snip macro screenshot-19e3b8.png (267.08 KiB) Viewed 1163 times
Sending a selected face to the Python Console and then using `Part.show()` to convert it to an independent shape object.
Sending a selected face to the Python Console and then using `Part.show()` to convert it to an independent shape object.
Snip macro screenshot-6189f3.png (194.1 KiB) Viewed 1163 times
Ready to apply Cut tool
Ready to apply Cut tool
Snip macro screenshot-8865f2.png (205.54 KiB) Viewed 1163 times
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: Selecting all faces on a plane of an STL->mesh item for adaptive clearing

Post by chrisb »

Here is a pure tesselation free FreeCAD file with a (non adaptive) pocket:
Snip macro screenshot-7308e0.png
Snip macro screenshot-7308e0.png (108.75 KiB) Viewed 1106 times
Attachments
mazeFC.FCStd
(250.14 KiB) Downloaded 23 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply