Creating CNC roughing and finishing passes

Here's the place for discussion related to CAM/CNC and the development of the Path module.
User avatar
Kunda1
Posts: 5226
Joined: Thu Jan 05, 2017 9:03 pm

Re: Creating CNC roughing and finishing passes

Postby Kunda1 » Wed Oct 24, 2018 6:47 pm

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

Re: Creating CNC roughing and finishing passes

Postby JoshM » Wed Oct 24, 2018 7:48 pm

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 401 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

Postby prius06 » 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.
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: Creating CNC roughing and finishing passes

Postby roivai » Thu Nov 29, 2018 6:37 pm

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

Postby prius06 » Thu Nov 29, 2018 6:55 pm

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

Postby prius06 » Thu Nov 29, 2018 7:33 pm

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: 419
Joined: Thu Oct 05, 2017 5:34 pm
Location: New Hampshire

Re: Creating CNC roughing and finishing passes

Postby JoshM » Thu Nov 29, 2018 11:13 pm

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
Posts: 17597
Joined: Tue Mar 17, 2015 9:14 am

Re: Creating CNC roughing and finishing passes

Postby chrisb » Fri Nov 30, 2018 12:21 am

It is documented in Path experimental.
prius06
Posts: 30
Joined: Thu Aug 23, 2018 6:29 pm

Re: Creating CNC roughing and finishing passes

Postby prius06 » Fri Nov 30, 2018 2:38 pm

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
Posts: 17597
Joined: Tue Mar 17, 2015 9:14 am

Re: Creating CNC roughing and finishing passes

Postby chrisb » Fri Nov 30, 2018 4:24 pm

I don't have FreeCAD on windows, I can try on Ubuntu tonight.