Creating CNC roughing and finishing passes

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

Re: Creating CNC roughing and finishing passes

Post by Kunda1 »

JoshM wrote: Wed Oct 10, 2018 2:32 am
Hey @JoshM any more progress on this ?
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
JoshM
Posts: 456
Joined: Thu Oct 05, 2017 5:34 pm
Location: New Hampshire

Re: Creating CNC roughing and finishing passes

Post by JoshM »

Hi Kunda1,
A fair amount of progress, though I've dropped back to rework some. I've mostly figured out how to handle this, but I needed to redo some work/approach.

I'm using the Sketcher now because it allows me to use Constraints, it's easy to visualize for development and troubleshooting, and if left parametric, it allows further modification/refinement. I did this because I realized that for in theory, any Tool can be modeled, and even more importantly, the CNC collet can be accounted for. Everyone--myself included--looks at a sphere or cylinder and wants to accomplish it, but without thought the limitation of the collet. Realistically, it's a vertical/radial safety margin we want to impose around the collet.

In essence, for any geo primitive and any tool shape, there is a Parameter UV range to be defined that represents the "response" of that tool shape to that primitive shape. This allows for example implementing a chamfer tool response that ignore flat ,vertical , and too steeply angled planes for that cut angle.

Where I left off last night, I have code generating a bound shape and a response to geometric primitives--Sphere, cyclinder, cone, plane. Toroid is only partial. I also generate a model of tool shapes from the selected Job---endmill, ballendmill, etc... I generate a profile which when revolved gives representation of the tool definition for sanity check.

I also generate a slice of the center of the tool for actual calculations. For a sphere, the tool can always hit the peak of it. The tip of the tool can be used until the defined collet clearance touches the sphere profile. If the tool is long enough, this is the bottom, otherwise it's a portion of the sphere, as shown in included image.


ColletCalculationExample_0.png
ColletCalculationExample_0.png (207.45 KiB) Viewed 1750 times






The resultant edge when rotated defines the template of what could be cut. A cylinder is similar, but the tool profile is worked across a half-circle geometry representation, then the result is extruded instead of rotated...

This shape is modified using the normal to the outer wire to chop away what isn't part of the actual model. That is the maximal finish surface--(it will still need any interference removed where it's needs violate other Surfaces). The cut envelope is what is bounded by this surface and its projection on the stock top. Existing Path.Feature can use that envelope to generate roughing, and the projection of the paths can be projected from the stock top plane down onto the surface for actual surface paths. I've tested that successfully already. Ideally, additional paths can be generated with sin/cos used to generate spacing so that projection onto sphere results in even spacing in 3d... That I can wait on though.

I anticipate having a bit to show in the next several days. The good news is that this is a relatively fast algo because instead of probing points on faces, the overall faces are considered.

Best,
Josh
prius06
Posts: 30
Joined: Thu Aug 23, 2018 6:29 pm

Re: Creating CNC roughing and finishing passes

Post by prius06 »

I was just wondering if roivai's optimization has made it to the official code base yet. I downloaded the latest 0.18 release and redid the post-processing of a project I was using some time ago and... as far as I can tell there is no difference in the generated gcode file.
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: Creating CNC roughing and finishing passes

Post by roivai »

prius06 wrote: Thu Nov 29, 2018 4:25 pm I was just wondering if roivai's optimization has made it to the official code base yet. I downloaded the latest 0.18 release and redid the post-processing of a project I was using some time ago and... as far as I can tell there is no difference in the generated gcode file.
https://github.com/FreeCAD/FreeCAD/pull/1773 It has been in master for almost a month now. I don't know when the last 0.18 has been released..? If you used a project that was created before that, it might be that you need to recreate the surface op to see the effect. There should be a checkbox in the operation task panel to enable the optimization.

If that does not help, I can check the file if the optimization works on my setup.
prius06
Posts: 30
Joined: Thu Aug 23, 2018 6:29 pm

Re: Creating CNC roughing and finishing passes

Post by prius06 »

roivai wrote: Thu Nov 29, 2018 6:37 pm ...
https://github.com/FreeCAD/FreeCAD/pull/1773 It has been in master for almost a month now. I don't know when the last 0.18 has been released..? If you used a project that was created before that, it might be that you need to recreate the surface op to see the effect. There should be a checkbox in the operation task panel to enable the optimization.

If that does not help, I can check the file if the optimization works on my setup.
I guess I did not notice a little stack trace ;) the error says "object has no attribute 'Optimize'" which makes sense. I will redo the surfaces and if there are further problems will let you know. Thanks
prius06
Posts: 30
Joined: Thu Aug 23, 2018 6:29 pm

Re: Creating CNC roughing and finishing passes

Post by prius06 »

I started getting the "This operation requires OpenCamLib to be installed." error again.

I had that installed over 0.18 before but now after installing the new one somehow it disappeared. As far as I remember I copied opencamlib from 0.17 installation which still works.

Can somebody remind me what opencamlib consists of so I can copy it form 0.17 again

Thanks!

P.S. Actually I am seeing ocl.pyd under .../Mod/Path but for some reason it does not appear to be usable by the application... Is there something I need to do to "activate" it?
User avatar
JoshM
Posts: 456
Joined: Thu Oct 05, 2017 5:34 pm
Location: New Hampshire

Re: Creating CNC roughing and finishing passes

Post by JoshM »

prius06 wrote: Thu Nov 29, 2018 7:33 pm P.S. Actually I am seeing ocl.pyd under .../Mod/Path but for some reason it does not appear to be usable by the application... Is there something I need to do to "activate" it?
Experimental Features enabled? If not, check wiki PathWB FAQ--think it's in FAQ.

Cheers,
-Josh
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Creating CNC roughing and finishing passes

Post by chrisb »

It is documented in Path experimental.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
prius06
Posts: 30
Joined: Thu Aug 23, 2018 6:29 pm

Re: Creating CNC roughing and finishing passes

Post by prius06 »

Yes "EnableExperimentalFeatures" is set to true. I did that the first time and the new installation did not change that (just verified). And the ocl.pyd is freshly copied into the "bin" directory from the previous (0.17) version and yet I am still getting the "This operation requires OpenCamLib to be installed." error.

P.S. I even deleted the previous 0.18 installation completely and re-extracted FreeCAD_0.18.15280_x86_dev_win.7z and I am still getting this error. I will try to roll back to FreeCAD_0.18.14451_x64_dev_win.7z to see it still works...

P.P.S. Revision 14451 worked as explained above. With that revision installed I simply copied ocl.pyd (from 0.17) to the bin directory and 3D Surface worked just fine. For the sake of the experiment I renamed ocl.pyd and I saw the error. Renaming it back restored the functionality.

All of the above makes me think that revision 15280 either expects more than just ocl.pyd or expects it to be in a different location (not in bin directory)

Can you please verify that?

Thanks!
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: Creating CNC roughing and finishing passes

Post by chrisb »

I don't have FreeCAD on windows, I can try on Ubuntu tonight.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply