CAM simulation for the Path Workbench

Here's the place for discussion related to CAM/CNC and the development of the Path module.
User avatar
shaise
Posts: 345
Joined: Thu Jun 11, 2015 8:11 am

CAM simulation for the Path Workbench

Postby shaise » Fri Sep 15, 2017 11:38 am

Hi Sliptonic, mlampert and Yorik

First of all, my deepest thanks for the path workbench!
I was long looking for a good opensource CAM software, and now I have it integrated to my favorite CAD software.

I wanted to ask if there is any WIP regarding a CAM simulation functionality. If not, I want to try and contribute to this subject.
I have already made a preliminary macro that takes a job and simulate the milling on the stock object:
FreecadCAM.jpg
FreecadCAM.jpg (46.49 KiB) Viewed 2820 times
Right now it is in a very early stage, and I will soon post it on github. Hopefully if it will be mature enough, it can be
integrated into the Path Workbench.

The main issue with it is performance (boolean operations are rather slow) but in many cases its worth the wait, to make sure our gcode is correct.

I will probably need some help from the community, please let me know the correct forum section to post questions.
Right now, I'm looking for documentation/sample code for animating the process with a way to cancel in the middle (as now it hangs FreeCAD till operation is done)
Last edited by shaise on Sat Sep 16, 2017 5:52 am, edited 1 time in total.
ickby
Posts: 2922
Joined: Wed Oct 05, 2011 7:36 am

Re: CAM simulation for the Path Workbench

Postby ickby » Fri Sep 15, 2017 11:51 am

Hello,

I have not mut knowledge, but I think some CAM simulations works with voxels. OCC has some basic support for that, so this may be something you can experiment with to increase speed and maybe even achieve simulation:

https://www.opencascade.com/doc/occt-6. ... ls_wp.html
User avatar
shaise
Posts: 345
Joined: Thu Jun 11, 2015 8:11 am

Re: CAM simulation for the Path Workbench

Postby shaise » Fri Sep 15, 2017 3:30 pm

ickby wrote:
Fri Sep 15, 2017 11:51 am
I think some CAM simulations works with voxels. OCC has some basic support for that
Thanks!
Indeed voxels is the fastest way. It seems that OCC visualization of voxels is not that good, but it is definitely a path I will explore.

shai
User avatar
Kunda1
Posts: 5781
Joined: Thu Jan 05, 2017 9:03 pm

Re: CAM simulation for the Path Workbench

Postby Kunda1 » Fri Sep 15, 2017 4:10 pm

Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
shaise
Posts: 345
Joined: Thu Jun 11, 2015 8:11 am

Re: CAM simulation for the Path Workbench

Postby shaise » Fri Sep 15, 2017 5:25 pm

Cute workbench... :)
Another issue with voxels is that to get good resolution, we need lots of voxels (hundreds of Megs), meaning lots
of memory
mlampert
Posts: 1334
Joined: Fri Sep 16, 2016 9:28 pm

Re: CAM simulation for the Path Workbench

Postby mlampert » Fri Sep 15, 2017 6:23 pm

This is absolutely the direction we want to go, and one of the major reasons why we introduced the stock solid as a fixed part of each job recently. I know sliptonic did some work in this direction. I like your preliminary results, they look awesome! :D
User avatar
sliptonic
Posts: 1561
Joined: Tue Oct 25, 2011 10:46 pm

Re: CAM simulation for the Path Workbench

Postby sliptonic » Fri Sep 15, 2017 8:56 pm

I'll second mlampert here. I'm thrilled to see some work in this area.

'Simulation' is one of those terms that's used to mean a bunch of different things so I'd welcome some discussion about exactly what you mean and the order/priority for developing parts of it. For example,

Simulating the movement of the cutter through the material (animation) is really useful to visualize the job operation order. As noted, it's quite resource intensive.

Simulating the resulting stock (like your screenshot) is also good for this. But if the shapes are accurate enough, they can also be used as input for refinement operations and detecting intersections with the model (gouging). That's much more important to me so I'd set it as higher priority.

Simulating the movement of the entire machine would just look really cool :D
User avatar
shaise
Posts: 345
Joined: Thu Jun 11, 2015 8:11 am

Re: CAM simulation for the Path Workbench

Postby shaise » Fri Sep 15, 2017 9:13 pm

Hi Sliptonic,

Once again thanks for the great work!
Right now what I have is working only on contour paths with flat endmill
Here is what I plan next:
First of all make it animated. Not only for visualizing but to be able to cancel the (long) action. I will then post it on github.
Next I want it to work on other path types
Next, one by one I will support other tool shapes.
Next, Have a gui to control the operation (use other stock, do only partial work, etc)
Last, add feature requests by the community

shai
User avatar
shaise
Posts: 345
Joined: Thu Jun 11, 2015 8:11 am

Re: CAM simulation for the Path Workbench

Postby shaise » Sat Sep 16, 2017 12:50 pm

Hi All,

I have managed to integrate some animation and control for the simulation:

https://youtu.be/iCe1zBoTb1I

shai
mlampert
Posts: 1334
Joined: Fri Sep 16, 2016 9:28 pm

Re: CAM simulation for the Path Workbench

Postby mlampert » Sat Sep 16, 2017 4:40 pm

nice, 'could watch it all day long :)