CNC Lathe and 4th-axis milling...

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

Re: CNC Lathe and 4th-axis milling...

Post by sliptonic »

The issue of how all these different strategies fit into the overall workbench is a big one. I've got some ideas but it's premature and probably not something we need to worry about just yet. Let's first focus on getting usable tool paths and then figure out how to make it easy for the user to select geometry, configure options, and visualize the output.

I'm attaching a macro I wrote when I was playing with my naive offsetting idea. I kept it because the rotation logic worked. You might find something useful here. To test it, select an object in the tree and run the macro. I've tested it with the Lathepart from the methodist section of my PathTorture repo.
Attachments
4thExperiment.FCMacro
(2.32 KiB) Downloaded 94 times
User avatar
JoshM
Posts: 456
Joined: Thu Oct 05, 2017 5:34 pm
Location: New Hampshire

Re: CNC Lathe and 4th-axis milling...

Post by JoshM »

sliptonic wrote: Tue Jan 23, 2018 4:05 pm The issue of how all these different strategies fit into the overall workbench is a big one. I've got some ideas but it's premature and probably not something we need to worry about just yet. Let's first focus on getting usable tool paths and then figure out how to make it easy for the user to select geometry, configure options, and visualize the output.

I'm attaching a macro I wrote when I was playing with my naive offsetting idea. I kept it because the rotation logic worked. You might find something useful here. To test it, select an object in the tree and run the macro. I've tested it with the Lathepart from the methodist section of my PathTorture repo.
Yes, agree--I've just made notes as I go. Exploring the possibilities leads to realizations about what does/doesn't work.

Thank you for the macro to check out with rotating. I'll look at it.

Best,
Josh
User avatar
JoshM
Posts: 456
Joined: Thu Oct 05, 2017 5:34 pm
Location: New Hampshire

Re: CNC Lathe and 4th-axis milling...

Post by JoshM »

interim rework of your macro
Attachments
PathPocket3D_4thAxis.FCMACRO.py
(7.15 KiB) Downloaded 102 times
User avatar
JoshM
Posts: 456
Joined: Thu Oct 05, 2017 5:34 pm
Location: New Hampshire

Re: CNC Lathe and 4th-axis milling...

Post by JoshM »

OK--here's where I'm confused. I have tried changing the script to use a calculated desired area for the XZ tool paths, and used it in conjunction with the plane. I get the same output which will not output where the wires are common with the desired tool paths. I can make it worse, but never better :roll: ...
PathsUsingGetOffsetWires.png
PathsUsingGetOffsetWires.png (199.2 KiB) Viewed 1652 times


If I take the DesiredToolpath side face, and use the PathFeatureArea, and set for Offset, then I get the desired results, but of course, what I need to implement is that effect, but without the GUI Command. What am I doing wrong?
PathsUsingFeatureAreaOffset.png
PathsUsingFeatureAreaOffset.png (176.27 KiB) Viewed 1652 times
Any guidance is greatly appreciated.
Josh
Attachments
PathPocket3D_4thAxis_003.FCMACRO
(7.16 KiB) Downloaded 77 times
BaseModelFor4thAxisExperimentation_3000.FCStd
(93.6 KiB) Downloaded 59 times
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: CNC Lathe and 4th-axis milling...

Post by sliptonic »

I haven't looked at your files yet but I'll throw this here in case it's helpful. You can get a closer look at what FeatureArea is doing like this

Select a Feature area in the tree and get a reference to it:
>>> f = Gui.Selection.getSelectionEx()[0].Object

Then get a reference to it's area object:
>>> a = f.getArea()

Then dump the params it's using:
>>> a.getParams()

Or in a one-liner:
Gui.Selection.getSelectionEx()[0].Object.getArea().getParams()

This will dump a python dictionary of all Area's parmeters:

{'OpenMode': 0, 'Angle': 45.0, 'MinArcPoints': 4, 'Coplanar': 2, 'Tolerance': 1e-07, 'CleanDistance': 0.0, 'PocketExtraOffset': 0.0, 'AngleShift': 0.0, 'SubjectFill': 0, 'RoundPreceision': 0.0, 'Simplify': False, 'SectionTolerance': 1e-06, 'MaxArcPoints': 100, 'SectionOffset': 0.0, 'Offset': 0.0, 'Accuracy': 0.01, 'PocketStepover': 0.0, 'ClipFill': 0, 'ToolRadius': 1.0, 'Outline': False, 'ClipperScale': 10000000.0, 'FromCenter': False, 'Explode': False, 'EndType': 0, 'Shift': 0.0, 'ExtraPass': 0, 'Project': False, 'JoinType': 0, 'Thicken': False, 'Stepdown': 1.0, 'SectionMode': 2, 'MiterLimit': 2.0, 'Deflection': 0.01, 'Reorient': True, 'FitArcs': True, 'SectionCount': 0, 'PocketMode': 0, 'Stepover': 0.0, 'Unit': 1.0, 'Fill': 2}
User avatar
JoshM
Posts: 456
Joined: Thu Oct 05, 2017 5:34 pm
Location: New Hampshire

Re: CNC Lathe and 4th-axis milling...

Post by JoshM »

Thanks Brad--I've been digging further into Realthunder's documentation in mean time.

I think Offset is only useful with 2D, so I need to use a different function call.

He mentions in answer to an early question from you that the Python-side PathArea has all the functionality of the GUI side version, so theoretically, this is reasonable, I just need to dig into how to drive the function call--I think...
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: CNC Lathe and 4th-axis milling...

Post by sliptonic »

Well, This kinda gets back to my original point. 2D offsetting is what Clipper does. That's it's thing. Path Area can slice a shape into a number of 2D layers and then offset each one but it's still ultimately 2D offsetting. A feature that exists between slices doesn't exist for Area.

To do any kind of true 3D offsetting or collision detection means using something other than Area. That's where something like OCL pushcutter/dropcutter algorithms come into play. They push a 3D cutter shape into a 3D model mesh until a collision is found and use that point as part of the path.
User avatar
JoshM
Posts: 456
Joined: Thu Oct 05, 2017 5:34 pm
Location: New Hampshire

Re: CNC Lathe and 4th-axis milling...

Post by JoshM »

sliptonic wrote: Tue Jan 30, 2018 8:01 pm Well, This kinda gets back to my original point. 2D offsetting is what Clipper does. That's it's thing. Path Area can slice a shape into a number of 2D layers and then offset each one but it's still ultimately 2D offsetting. A feature that exists between slices doesn't exist for Area.

To do any kind of true 3D offsetting or collision detection means using something other than Area. That's where something like OCL pushcutter/dropcutter algorithms come into play. They push a 3D cutter shape into a 3D model mesh until a collision is found and use that point as part of the path.
Good chatting with you today Brad--you really helped me understand a bunch. I haven't got this yet, but I've played with Drop Cutter tonight and it's limited, but not that bad--especially if I got it past the "dumb" stage it's at now.

What I'm posting is a Macro that you can use on the Model we've worked with so far. Either your pawn for lathe style, or my modified pawn for 4th axis. The input parameters are up front and are labeled. I've implemented Square Endmill, Ballnose mill, and Chamfer mill for now. Chamger is fixed at 90-degrees also, though it would be easy to change.

I've only tested simple passes--no rotation yet. I'm marking each spot with a Depth marker for where each Z-measurement ends up--the marker matches the geometry of the tool tip. This is just for demonstration. I'm using the Path:VolumeOfModelRemoved macro to allow the tool geometry to intersect with the Base model by a specified volume tolerance.

I've run simulations with each tool geometry--not that it's a sensible practical approach, but to demonstrate. The Chamfer tip is problematic in a couple spots at low step resolutions--it takes less volume in error for a given depth incursion, so this would require adjustment. But, also, who would chamfer the whole pass in reality?

With 6.35mm diameter tools, at 37.5% step-over, and 1mm step-down, a pass takes about 1.5 minutes to calculate.

With 3.175mm diameter tools, at 37.5% step-over, and 0.25mm step-down, a pass takes about 5-6 minutes to calculate.

The location of each depth marker has an XYZ location that I could record directly as GCode locations...

The last location where the Probe would have begun a pass is shown in silver, the depth markers in red.

Regards,
Josh
Attachments
BallnoseDepthProbing0r25mmStepdown_ToolDiameterHalved.png
BallnoseDepthProbing0r25mmStepdown_ToolDiameterHalved.png (173.21 KiB) Viewed 1570 times
BallnoseDepthProbing1mmStepdown.png
BallnoseDepthProbing1mmStepdown.png (216.17 KiB) Viewed 1572 times
ChamferDepthProbing1mmStepdown.png
ChamferDepthProbing1mmStepdown.png (175.11 KiB) Viewed 1572 times
SquareDepthProbing1mmStepdown.png
SquareDepthProbing1mmStepdown.png (171.3 KiB) Viewed 1572 times
ChamferDepthProbing0r25mmStepdown_ToolDiameterHalved.png
ChamferDepthProbing0r25mmStepdown_ToolDiameterHalved.png (171.29 KiB) Viewed 1572 times
Last edited by JoshM on Thu Feb 01, 2018 6:15 am, edited 1 time in total.
User avatar
JoshM
Posts: 456
Joined: Thu Oct 05, 2017 5:34 pm
Location: New Hampshire

Re: CNC Lathe and 4th-axis milling...

Post by JoshM »

Here's the macro and demo file I have been playing with if you're interested.

I hard-code constants into input variable at begging of the script, and save it. To use it, I select the Base-Model, and run the macro. The probe is hidden by default.

Best,
-j
Attachments
PathCollissionDetection.FCMacro
(9.25 KiB) Downloaded 75 times
BaseModelFor4thAxisExperimentation_4000.FCStd
(168.93 KiB) Downloaded 55 times
herbk
Veteran
Posts: 2660
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: CNC Lathe and 4th-axis milling...

Post by herbk »

Hi Josh,
With 3.175mm diameter tools, at 37.5% step-over, and 0.25mm step-down, a pass takes about 5-6 minutes to calculate.
Is it the time to calculate the points you shows in the pictures or the time to remove the whole material above the "contact points"? Anyway a lot of time, it's only one path...

Let me put in a few thoughts about the whole 3D milling:

Eespecially when using a ball endmill in my mind a different way to get the path is possible:
A ball endmill touches the workpeacee at the Z axis points as a regular endmill it touches at the X (or Y) axis.
pawn_01.png
pawn_01.png (19.14 KiB) Viewed 1556 times
here i create a contour path of a quarter of your pawn, start depht only for 1 layer.
Take away the not needet parts of the path (left side and bottom) and change the Yin the gcode to an Z and you get the profile milled on Z level.
But Changing to Y to Z you don't reay need. If you cut on Z0 level you got also that contour.
After the layer is done, turn the pawn 1° at X Axis. create a contour path, take away the not needet cuts... and so on...

That works, also at the machine, i try'd a few weeks before with a more simple part.

The Problem i see is to remove the material above the path...

It works, but it's not the workflow which i would go if i have to make that peace without an CNC mill... Maybe we should also think about how to create pathes like on manual work, - usualy that's near to the shortest worktime... ;) ;)
Gruß Herbert
Post Reply