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!
Post Reply
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 »

Hey Brad,
I don't think we're really at large cross purpose here. By adding smarts, I meant the ability to do just what you describe--to be able to use the amount removed by a prior Op be the input for subsequent operations. I also do not mean to limit ability to do an atomic action, but rather it is clear to me that you can add a level of Warning in that the OP configuration will violate the model, then let the user allow/disallow, or modify the OP...

On redundancy, what I meant is that if the 3d Job model is picked apart to determine how a Tool geometry interfaces with it, then for example, a Roughing OP is performed, leaving only 0.5mm from the finish, it makes no sense to me to have to pick apart the geometry again to generate the Finish OP.

I do think there is merit in parsing the whole job, sectioning the stock, according to how the Job looks from a Tool-Centric viewpoint, and then using that information to generate atomic operations. As I mention, the Heights approach is challenging, and I've ruined more than a couple jobs because I lost sight of a Rapid that moved directly through my stock. There really should be little ambiguity about where Rapids are intended in a 3d system. As a default, I would start above the Stock Top, then allow it to be modified as needed by the user. Once Stock is removed, if computing bandwidth were no issue, one could increase the allowable bounds, but I'd kick the can on that until many other issues are resolved. That said, by using the 3d Model of the job, there is a lot of context to be gained, even now.

You mention that PathWB is actually relatively agnostic--just a container. I've been confused because when I've poked at it, it seems in an Active Document containing more than one Job, all Jobs and Tools are objects on the same hierarchical level. From the Outlist, I can get the Default Tool, but I'm not clear how I could iterate through all Tools added into a Job?
Best,
Josh
chrisb
Veteran
Posts: 53938
Joined: Tue Mar 17, 2015 9:14 am

Re: Creating CNC roughing and finishing passes

Post by chrisb »

JoshM wrote: Thu Sep 27, 2018 2:19 pm SemiBoundedOCL.png
I cannot find the difference between the first three images, could you please explain a bit more where to look at?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
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 »

chrisb wrote: Thu Sep 27, 2018 6:33 pm
JoshM wrote: Thu Sep 27, 2018 2:19 pm SemiBoundedOCL.png
I cannot find the difference between the first three images, could you please explain a bit more where to look at?
Thanks Chris--I fixed the links where I placed inline, and they appear correct to me now. Sorry for confusion.

One other thing I'll point out is that ultimately what we really want--however we achieve it--is for the finish surface to be generated, say for a single Face of a Job, at the Surface level, then projected upwards until the lowest section reaches Stock-Top minus Step-Down, where First-Cut begins. This differs from 2d pockets where the paths are projected downward. To illustrate what I mean, here's an image of the surface-face I generate for that geometry. I section it in Part just to show the concept.
FinishSurfaceFace.png
FinishSurfaceFace.png (236.91 KiB) Viewed 1873 times
Projected up, through the Envelope between the Surface-Face, and StockTop, and I get:
FinishSurfaceFace2.png
FinishSurfaceFace2.png (200.62 KiB) Viewed 1873 times
Here, we see the cuts now extend outside the Stock, which makes no sense. I tried performing a Common intersection, to further illustrate this, with no success after a couple minutes...

This highlights something else I learned along the way. Trying to use Part Tools indiscriminately results in weird and slow results at times. The way that I am able to achieve relatively fast generation of edges/faces/solids is that I run the OuterWire of the geometry, and discretize non-lines by distance, lines by 2 points. I then get the normalAt the point, and move out by Mill Radius, with no Z change in offset/normal Vector. At same time, I generate equivalent Top flattened Points for each discretized point with Z set for StockTop, leaving the XY values alone. Then I generate faces and loft between. Because there is an exact XY point on top and bottom of the loft, and it fast and seamless...

I think that to fix this correctly, the SurfaceFace must be carved into Zig-Zag/Offset/etc... using wires, then copies projected upward, keeping only parts that remain within the Stock. OCL doesn't resolve the issue in a single pass either, as it only generates a surface/finish pass. It is possible to create a more optimized boundbox to better target OCL onto the Job, but it doesn't fix that it only generates a single pass.

Best,
-j
Last edited by JoshM on Thu Sep 27, 2018 7:28 pm, edited 1 time in total.
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Creating CNC roughing and finishing passes

Post by sliptonic »

JoshM wrote: Thu Sep 27, 2018 3:59 pm Hey Brad,
I don't think we're really at large cross purpose here. By adding smarts, I meant the ability to do just what you describe--to be able to use the amount removed by a prior Op be the input for subsequent operations. I also do not mean to limit ability to do an atomic action, but rather it is clear to me that you can add a level of Warning in that the OP configuration will violate the model, then let the user allow/disallow, or modify the OP...
There's two different things; First, detecting if the operation violates the model. Clearly this belongs to the operation itself.

Second is detecting if the operation violates the _current state_ of the workpiece in a bad way. For example, a roughing op is valid and a subsequent finishing op is valid. But the same finishing op _before_ the roughing op is invalid. That level of validation doesn't belong to either atomic operation and I don't think we're ready to build it yet. I'm suggesting we trust the user on this for now.
On redundancy, what I meant is that if the 3d Job model is picked apart to determine how a Tool geometry interfaces with it, then for example, a Roughing OP is performed, leaving only 0.5mm from the finish, it makes no sense to me to have to pick apart the geometry again to generate the Finish OP.
If the roughing op uses a dropcutter algo to determine intersection points, that collection of points may not be useful for a finishing op that uses the same tool and model but a waterline algo. Or maybe it is. I don't know. I'm just suggesting that it's a level of optimization that can wait.
I do think there is merit in parsing the whole job, sectioning the stock, according to how the Job looks from a Tool-Centric viewpoint, and then using that information to generate atomic operations. As I mention, the Heights approach is challenging, and I've ruined more than a couple jobs because I lost sight of a Rapid that moved directly through my stock. There really should be little ambiguity about where Rapids are intended in a 3d system. As a default, I would start above the Stock Top, then allow it to be modified as needed by the user. Once Stock is removed, if computing bandwidth were no issue, one could increase the allowable bounds, but I'd kick the can on that until many other issues are resolved. That said, by using the 3d Model of the job, there is a lot of context to be gained, even now.
ok
You mention that PathWB is actually relatively agnostic--just a container. I've been confused because when I've poked at it, it seems in an Active Document containing more than one Job, all Jobs and Tools are objects on the same hierarchical level. From the Outlist, I can get the Default Tool, but I'm not clear how I could iterate through all Tools added into a Job?
The project document can contain any number of jobs. Each job is a separate thing with no linkage between them.
One way to check a tool controller is with inList. Given a TC, you can get do tc.inList() to get the list of groups that contain the TC. for example:

>>> t = App.ActiveDocument.T1__1_4__
>>> t.InList
[<Path::FeaturePython object>]
>>> t.InList[0].Name
'Job001'
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 »

Thanks Brad--appreciate info on Jobs/Tools.
There's two different things; First, detecting if the operation violates the model. Clearly this belongs to the operation itself.
I completely agree with you here.
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Creating CNC roughing and finishing passes

Post by sliptonic »

JoshM wrote: Thu Sep 27, 2018 7:33 pm Thanks Brad--appreciate info on Jobs/Tools.

Actually, It's even easier:
>>> j= App.ActiveDocument.Job001
>>> j.ToolController
[<Path::FeaturePython object>, <Path::FeaturePython object>]
>>> j.ToolController[0].Name
'T1__1_4__'
>>>
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 »

sliptonic wrote: Thu Sep 27, 2018 8:08 pm
JoshM wrote: Thu Sep 27, 2018 7:33 pm Thanks Brad--appreciate info on Jobs/Tools.

Actually, It's even easier:
>>> j= App.ActiveDocument.Job001
>>> j.ToolController
[<Path::FeaturePython object>, <Path::FeaturePython object>]
>>> j.ToolController[0].Name
'T1__1_4__'
>>>
Yes, that's the stuff.

Code: Select all

j= App.ActiveDocument.Job002
for t in j.ToolController:
  t.Name
  t.Tool.Diameter
  print("\n")
returned the two ToolControllers in that Job, plus Diameters. Thanks!
User avatar
bill
Posts: 376
Joined: Fri Jan 09, 2015 9:25 pm

Re: Creating CNC roughing and finishing passes

Post by bill »

From what I can see, drop-cutter still needs to execute path generation as follows; according to drop-down parameter:
dropcutter.gif
dropcutter.gif (140.47 KiB) Viewed 1831 times
Right! The current execution is only good for wax and styrofoam; No! :lol:
herbk
Veteran
Posts: 2657
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: Creating CNC roughing and finishing passes

Post by herbk »

Hi Bill,
bill wrote: Sun Oct 07, 2018 4:28 am The current execution is only good for wax and styrofoam; No! :lol:
not if you have a roughing operation before... ;)
Gruß Herbert
User avatar
bill
Posts: 376
Joined: Fri Jan 09, 2015 9:25 pm

Re: Creating CNC roughing and finishing passes

Post by bill »

herbk wrote: Sun Oct 07, 2018 7:39 am Hi Bill,

bill wrote: ↑
Sun Oct 07, 2018 12:28 am
The current execution is only good for wax and styrofoam; No! :lol:

not if you have a roughing operation before... ;)
True, true, but, one does not always need or want or require a roughing op depending on the work part.
Then, in some instances, one pass (generating a rough casting mould) is sufficient, so tool movements must be integrated correctly.

I have made a few projects (architectural medalions and some straight-bladed turbines) using heeks-generated gcode. Been a few years ago, and this is what I remember. I will try to find some of that gcode.

I think basic drop-cutter (and waterline) functionality needs to be pinned down before moving on to tool/cutter-shape consideration.
Post Reply