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

Re: Creating CNC roughing and finishing passes

Postby JoshM » Sun Feb 17, 2019 7:21 pm

Herbk--you're always sassy;)

Unless I'm mistaken, Russ has taken the step of putting some controls onto the 3dSurface tool, which leverages OCL.

The 3dPpocket operation utilizes a fundamentally different function, and already has inputs for step size and step-down size.




One thing I found interesting while playing with 3d milling concepts was that 3dPocket is more limited as it is rolled into PathWB than it is in reality. That is to say that it could do more if allowed to do so.

For example, here is a "complex" model, that provides one planar face in the XY plane.
Path3d_0.png
Path3d_0.png (47.28 KiB) Viewed 507 times
as shown here, where I was able to use a standard PocketShape.
Path3d_1.png
Path3d_1.png (51.48 KiB) Viewed 507 times
In fact, I am unable to even use Path 3dPocket successfully on any of the faces. I can select the whole model and apply it, but it simply faces the stock top.

However, if I make a cut from the stock of the job model, I can then get much better results by selecting that model and applying a Path3dFeature with -1 for the count on step down. This image is limited to 2mm tool radius, and 3.0 mm step down, to better show it, though it is far rougher... Note that the original model is shown and the cut is at 80% transparent, above it.
Path3d_2.png
Path3d_2.png (109.31 KiB) Viewed 507 times
Here's the same FeatureArea, but the ToolRadius is 1.5875mm, and the step-down is 0.25mm.
Path3d_3.png
Path3d_3.png (82.5 KiB) Viewed 507 times
This takes minimal calc time, and a reasonable increase in roughing ability, using existing tools...
Attachments
ExampleLimit3dPathPocket.FCStd
(64.64 KiB) Downloaded 9 times
herbk
Posts: 1573
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Creating CNC roughing and finishing passes

Postby herbk » Sun Feb 17, 2019 7:55 pm

Hi Josh,
JoshM wrote:
Sun Feb 17, 2019 7:21 pm
Herbk--you're always sassy;)
sorry :oops:
Unless I'm mistaken, Russ has taken the step of putting some controls onto the 3dSurface tool, which leverages OCL.
It's no problem to use OCL, the license is canged to a to FC compatible version, if i remember right.


Your explanation isn't what i have had in mind...

Russ's pics are showing two different behaviors of the 3D surface OP.
First (roughing): the OP removes al not needed material of the stock.
Secound (finishing): the OP follows only the face of the object.

At 3D Pocket i'm missing the secound step: The tool don't follow the surface of the object ONLY...


A question @Russ: dos your 3D surface work on parts (e.g. the half sphere) of an object to?
Gruß Herbert
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 » Sun Feb 17, 2019 9:29 pm

Hi Herb,
Just kidding on the "sassy" comment :lol: It's a funny word.

I know what you mean about OCL legal limitations no longer being of concern. What I meant was that unless I misunderstood Russ, what he did was use OCL as the engine to derive paths from shapes. What I believe he did was put together code to better target/harness what OCL generates AND also he merged in roughing passes. I have not looked at OCL recently, but one big issue I recall was that it attempts to generate surface/finish paths for the entire model. If the selected tool was a 1mm tool, and that model was large, it was all or nothing. I believe Russ has alleviated some of that--hopefully he clarifies, but in the mean time, we can guess;)

I meant that Pocket3d and OCL are two different methods for path generation and I believe Russ's work appears focused on the OCL portion, and I understood you to be asking if there's similar work that can be done to Pocket3d.

Much of what I posted was an aside on what can be achieved with the libarea path generation engine--which is what the Pocket3d OP you mentioned fundamentally uses. I meant to illustrate that the existing libarea engine is capable of generating roughing passes well beyond what is currently utilized in PathWb. The paths I showed are what Pocket3d should do on the model I provided.

It's not that libarea is incapable of generating good roughing passes, it's that it really needs to be fed an inverted model to achieve the results. Here's an example of the same trick, to rough a sphere. Note that the libarea behavior differs if you select the object from the 3d view or from the tree--only the latter will generate more than top surface sections.

As we both know, there's little--even in way of roughing--that PathWB can currently do with a sphere. The Pocket3d op gave me this for contrast:
Path3d_6.png
Path3d_6.png (68.23 KiB) Viewed 488 times
The only difference is that I cut a cylinder with the model and then used the result to get good roughing passes.
Attachments
Path3d_5.png
Path3d_5.png (146.14 KiB) Viewed 489 times
herbk
Posts: 1573
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Creating CNC roughing and finishing passes

Postby herbk » Mon Feb 18, 2019 8:52 pm

Hi Josh,
JoshM wrote:
Sun Feb 17, 2019 9:29 pm
As we both know, there's little--even in way of roughing--that PathWB can currently do with a sphere. The Pocket3d op gave me this for
Hm, in my mind roughing isn't a big problem...
If i want to have 0,5mm left material for a finishing Op., i just select the tool for the path creation 1mm more in diameter as the tool at the machine. Works at each Op i tried. For parts with spherical elements, 3D Pocket works also fine.
For that what i do manualy, it should not to be very difficulty to add options to the operations UI. E.g. a checkbox "roughing ?" wich makes available a input field for the material to leave. To make it effect the input has to be added twice to the tool diameter of course. ;)

The bigger thing is the finishing path. Because i'm in mind "finishing = surfacing" i see Russ's extension is at the wrong Op.
Chrisb shows a workaround for finishing pathes at this post: https://forum.freecadweb.org/viewtopic. ... 20#p283952
It works fine, also at "rounded pockets", - only it is a lot of clicking because you have to create each path at each Z level manual...
wl.jpg
wl.jpg (74.08 KiB) Viewed 455 times
Gruß Herbert
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 » Mon Feb 18, 2019 10:57 pm

Well, if you like Chris's example--and, I do as well--but, you don't like the iterative aspects of it, then try buying what I'm selling :lol:

Here's a cut resulting from an example Cone, that I then used as a cut-tool on a larger cylinder.
ConeCutExample.png
ConeCutExample.png (46.28 KiB) Viewed 435 times
Easy-Peasy, so far. Then, I made a Job in Path-WB, based on the Cut-Result. Then I selected that object in the tree, and applied a Path-Feature to that. I set the Pattern to Zig-Zag/Outline, and then the step-down and step-over parameters. Finally, setting the Count to -1 causes it to generate as many passes as are needed to fill the volume at the step-down interval. This gives you what you like about Chris's suggestion, but provides finer control, and merges it into one OP.

Here it is with 2mm step-down, allowing you to easily see what is done.
ConeCutExample2.png
ConeCutExample2.png (54.24 KiB) Viewed 435 times
And, here, I adjusted the step-down to 0.5mm I believe--it's harder to see, but more passes at shorter interval. It takes less than 1s to recompute. Cake, and eat it too :D
ConeCutExample3.png
ConeCutExample3.png (26.74 KiB) Viewed 435 times
Note too, that I've had issues with Pocket3d on sphere, where you are not--this never has issues because the selection plane is the top-surface, and is always planar. This makes a very good general Roughing OP actually....
Attachments
ConeExampleLikeChrisB_Approach.FCStd
(86.01 KiB) Downloaded 12 times
herbk
Posts: 1573
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Creating CNC roughing and finishing passes

Postby herbk » Tue Feb 19, 2019 8:19 am

Hi Josh,
JoshM wrote:
Mon Feb 18, 2019 10:57 pm
And, here, I adjusted the step-down to 0.5mm I believe--it's harder to see, but more passes at shorter interval. It takes less than 1s to recompute. Cake, and eat it too :D
I have downloadet the file, there isn't a gcode to export... May be it's because i'm not knowing how to use feature area, because i don't use...

Your pic shows exactly what i'm not want at a finishing paths: The pathes are the same as at roughing, with smaler step down, but cutting a lot of air if a roughing operatin is done before. This "cutting air" costs a lot of time at the machine, which is the problem it get's to solve... :)

If i wand to have a cone, like that at the pic, and use a cylinder as stock, after a roughing operation the workpeace would look like that:
roughing.jpg
roughing.jpg (18.38 KiB) Viewed 412 times

The tool don't need to go to all areas which are already removed, one time around the cone (shape) at each Z level is enough for the finish.
Gruß Herbert
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 » Tue Feb 19, 2019 2:12 pm

Hi Herb,
Couple of things:

1--Nothing that I'm suggesting addresses Finish surfaces, only Roughing.
2--What you show is the effect of the step-down and step-over sizes which are large as shown. In all cases--even with "true" 3d path generation, the result is an approximation of the model. If the steps (down/over) are adequately fine, we call it a sphere or a cylinder or a cone, etc... But, even if you were to set the step-over and step-down at 1 micron, you would have the same issue, just with step sizes so small that you would ignore them...

3--The FeatureArea in PathWB allows calling the libarea engine to generate wires representing tool-paths. It is fed the Pattern Type (zig-zag, offset, spiral, etc...), the step-over, the step-down, and other inputs that we put into distinct OP commands (pocket, contour, face, etc...). Generally, the available inputs in any OP are a sub-set of the possible inputs available in the FeatureArea. But, as you say, in itself, it doesn't generate Paths, rather Wires.
FeatureArea.jpeg
FeatureArea.jpeg (48.03 KiB) Viewed 387 times
4--The PathWB also provides a separate tool, FromShape, under Supplemental Commands. This converts the Wires generated by the FeatureArea into Paths. It also has a number of inputs you are likely familiar with--FeedRates, Retract Height, etc...
FromShape.jpeg
FromShape.jpeg (46.89 KiB) Viewed 387 times
5--If I use the GCode-Inspector, and copy the GCode, and then paste that into a Custom-GCode Operation, I am able to simulate the Job, and you see a "cone-like" result, albeit with low-resolution due to the 1mm step-down setting.
SimulatorOutputLowRes.jpeg
SimulatorOutputLowRes.jpeg (26.39 KiB) Viewed 385 times
I believe there is a limit to the number of lines that can be placed in a CustomGCode, but this demonstrates the idea. Where you required an OP per line, to do this as Chris showed, here, you set the step-down, step-over, as inputs.

6--Here is a high-resolution simulation result, with the step-down set at 0.1mm.
SimulatorOutputHighRes.jpeg
SimulatorOutputHighRes.jpeg (23.73 KiB) Viewed 387 times
Attachments
Example.FCStd
(104.03 KiB) Downloaded 9 times
User avatar
Russ4262
Posts: 224
Joined: Sat Jun 30, 2018 3:22 pm

Re: Creating CNC roughing and finishing passes

Postby Russ4262 » Sun Feb 24, 2019 6:54 pm

herbk wrote:
Sun Feb 17, 2019 5:40 pm
Hi Russ,
like Josh say'd: very nice, thank you.
I know i'm a bit sassy with the question, but: is that possible at 3D Pocket to?
Afternoon, HerbK.
No sas taken... lol. Thanks for the comment. If you are referring to the step-down layer removal being available in the 3D Pocket, then yes. It is. However, the 3D pocket tool is not the best option for me. I am working on a propeller project for and ultralight aircraft. Modifying the 3D Surface tool to step down in layers will work great for my needs to cut the propeller on my CNC machine. I agree, the 3D Pocket tool has its uses, but so does the 3D Surface tool. In its current state, FreeCAD requires the user to choose the correct combination of tools and apply them for the job at hand. Modifying the 3D Surface tool to step down in layers will help many FC users.

Thanks,
Russ
User avatar
Russ4262
Posts: 224
Joined: Sat Jun 30, 2018 3:22 pm

Re: Creating CNC roughing and finishing passes

Postby Russ4262 » Sun Feb 24, 2019 7:07 pm

Russ4262 wrote:
Sat Feb 16, 2019 7:27 pm
@bill
bill wrote:
Sun Oct 07, 2018 4:28 am
From what I can see, drop-cutter still needs to execute path generation as follows; according to drop-down parameter:

dropcutter.gif

Right! The current execution is only good for wax and styrofoam; No! :lol:
Good afternoon.
I am new to the forum, but I have read some of the content posted when looking for answers for questions about FreeCAD. Before continuing, I would like to say a big THANK YOU to all those who make FreeCAD possible and available to the public. I understand it is a work in progress, but it is great for what it is! I have been using FC off and on for a couple years now. Currently, I am using nightly builds. I have the following setup:
I have improved the optimization algorithm for the step down implementation of the 3d Surface. I am attaching the same model with the newer optimization.
3D_Surface-modified-updated.png
updated optimization
3D_Surface-modified-updated.png (173.29 KiB) Viewed 290 times
I just finished submitting a PR #1987 to the FC master branch on GitHub to make the code live. Please help me work out any bugs. It is working fine on my machine. Also, the new code can be found at my FC fork, https://github.com/Russ4262/FreeCAD. Copy the src\Mod\Path\PathScripts\PathSurface.py file to the same location in your current FC directory, AFTER renaming your current PathSurface.py - as a means to revert back to your original. A restart of FC is necessary for the new PathSurface.py to be active.

To get the layering, un-check the Optimize feature in the PathSurface settings/properties. Checking the Optimize feature will create the single pass facing operation as before. I have added another input to the PathSurface window inputs, but it is currently running the process of the above pull request.

Thanks,
Russ
User avatar
nemesis
Posts: 347
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

Re: Creating CNC roughing and finishing passes

Postby nemesis » Sat Apr 13, 2019 7:21 am

Russ4262 wrote:
Sun Feb 24, 2019 7:07 pm


To get the layering, un-check the Optimize feature in the PathSurface settings/properties. Checking the Optimize feature will create the single pass facing operation as before. I have added another input to the PathSurface window inputs, but it is currently running the process of the above pull request.

Thanks,
Russ
Hi,
Unless I miss something, I am unable to get the layering on a 3D surface Path
setting optimize to true or false has no effect.

pathlayer.png
pathlayer.png (118.9 KiB) Viewed 191 times
OS: Debian GNU/Linux buster/sid
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.
Build type: Release
Python version: 3.7.2+
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: French/France (fr_FR)


[Edit] ok, I'm a dumb. I was sure to had activated the Muli-pass layer mode and indeed.... the snapshot proove I didn't :mrgreen: :oops: :mrgreen:

activating it works just fine [/edit]
Attachments
testpath.FCStd
(111.25 KiB) Downloaded 5 times
Last edited by nemesis on Sat Apr 13, 2019 7:29 pm, edited 2 times in total.