CAM simulation for the Path Workbench

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
User avatar
shaise
Posts: 470
Joined: Thu Jun 11, 2015 8:11 am

CAM simulation for the Path Workbench

Post by shaise »

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 4761 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
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: CAM simulation for the Path Workbench

Post by ickby »

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: 470
Joined: Thu Jun 11, 2015 8:11 am

Re: CAM simulation for the Path Workbench

Post by shaise »

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
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: CAM simulation for the Path Workbench

Post by Kunda1 »

Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
shaise
Posts: 470
Joined: Thu Jun 11, 2015 8:11 am

Re: CAM simulation for the Path Workbench

Post by shaise »

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
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: CAM simulation for the Path Workbench

Post by mlampert »

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
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: CAM simulation for the Path Workbench

Post by sliptonic »

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: 470
Joined: Thu Jun 11, 2015 8:11 am

Re: CAM simulation for the Path Workbench

Post by shaise »

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: 470
Joined: Thu Jun 11, 2015 8:11 am

Re: CAM simulation for the Path Workbench

Post by shaise »

Hi All,

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

https://youtu.be/iCe1zBoTb1I

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

Re: CAM simulation for the Path Workbench

Post by mlampert »

nice, 'could watch it all day long :)
Post Reply