A Path command for circular holes and some questions

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!
lorenz
Posts: 29
Joined: Wed Mar 16, 2016 9:35 pm

A Path command for circular holes and some questions

Post by lorenz »

Hi all,

I made a simple Path command to make circular holes (larger than the tool diameter) by helical milling motions. I used to do something similar with custom scripts in HeeksCNC, but as the Path functionality of FreeCAD is maturing I think I can finally do all my stuff in FreeCAD directly! Pleas note that I have no idea if it is sane to mill like this, I am just an amateur CNC machinist, but it at least it worked for me in the past...

Attached you can find a screenshot to see how it looks at the moment. If anyone is interested, code is available at
https://github.com/dev-at-stellardeath- ... tree/helix.

For polishing, if have some questions:
  • I use Gui::InputField widgets to edit the properties in the task panel. To set the initial value, the best I came up with was to use setText(), i.e.:

    Code: Select all

    ui = FreeCADGui.UiLoader()
    widget = ui.createWidget("Gui::InputField")
    widget.setText(str(self.obj.SomeQuantityProperty))
    
    Now this works fine in an english locale. However, in my native language the str(self.obj.SomeQuantityProperty) returns the values separated by commas, for example "1,15 mm". This might be reasonable, however, it seems that the Gui::InputField widget is not locale aware, as it then silently converts the "1,15 mm" as "115 mm". Is there a way to pass it a Quantity object directly, from Python?
  • The generated helical paths look quite strange for large z-steps, I think there are some issues in the routine that draws them.
  • Is there really no better way to get topology information for Shapes/Faces/Edges than to loop over all pairs of possibly connecting Faces/Edges/Points and test if they are the same? This is insane, there must be a better way! For example, I would have expected that a Face directly provides a method or list that returns all adjacent faces which share some common edge with it. I cannot imagine that this information is not already available somewhere.
Screenshot_20160610_000532.png
Screenshot_20160610_000532.png (163.71 KiB) Viewed 4407 times
Edit: Another screenshot:
Screenshot_20160610_215137.png
Screenshot_20160610_215137.png (8.87 KiB) Viewed 4360 times
User avatar
sliptonic
Veteran
Posts: 3460
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: A Path command for circular holes and some questions

Post by sliptonic »

Hi lorenz,
This is very cool! I was cutting a circular pocket for my 'dogfood project' last week and thinking about exactly this.

Do you think the implementation could be extended as part of the Path Profile operation? In other words should it be possible to do a 'spiral descent' on any shaped profile that would avoid the plunge at each level?
Linden
Posts: 109
Joined: Wed Aug 19, 2015 10:35 pm
Location: Canada/Philippines

Re: A Path command for circular holes and some questions

Post by Linden »

I am not much use with the coding side of things but this is defiantly a good feature to add to path module. I do this a lot to make holes, round pockets and round islands it is much easer on your cutter and gives you a nicer surface finish as the load on the cutter is more or less constant. You don’t get any vertical marks where the cutter plunges down to the next level or horizontal rings if you have a nick in the flutes of your cutter,
Linden
lorenz
Posts: 29
Joined: Wed Mar 16, 2016 9:35 pm

Re: A Path command for circular holes and some questions

Post by lorenz »

sliptonic wrote:Do you think the implementation could be extended as part of the Path Profile operation? In other words should it be possible to do a 'spiral descent' on any shaped profile that would avoid the plunge at each level?
I guess I would think of this as more of a pocket than a profile, right? The idea is really to remove all of the material inside the circle. Of course, when the diameter is much larger then the tool diameter and you want the hole to go fully through one could think about just milling the outermost helix and leaving the inner part - but don't forget to affix this inner part somehow to the table, or it will fly away and possibly even damage the tool...

Nevertheless, I actually added a similar feature to the Profile operation already, a configurable ramp angle with which the tool descents along the profile path instead of a 90deg plunge straight down. It would be easy to add an option to set this angle such that there is actually no horizontal movement left. Right now, my pull-request for this got rejected (https://github.com/FreeCAD/FreeCAD/pull/118), as too much changed when you merged your "pathimprove" branch.

I was planning to rebase my patch onto the current state, but at the moment I have some trouble with the Profile operation, maybe I will ask about this in another thread.
Linden wrote:I do this a lot to make holes, round pockets and round islands it is much easer on your cutter and gives you a nicer surface finish as the load on the cutter is more or less constant. You don’t get any vertical marks where the cutter plunges down to the next level or horizontal rings if you have a nick in the flutes of your cutter,
Good to hear that I don't do something too stupid!
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: A Path command for circular holes and some questions

Post by ulrich1a »

lorenz wrote:To set the initial value, the best I came up with was to use setText()
I did use the following

Code: Select all

    self.domeRadLE = FCUi.createWidget("Gui::InputField")
    self.domeRadLE.setObjectName("domeRadLE")
    self.domeRadLE.setProperty("text", "900 mm")
    
self.domeRad = FreeCAD.Units.parseQuantity(domeRad_str).Value
but had the same Problem.

The FreeCAD source code contains in /src/Mod/PartDesign/InvoluteGearFeature.py

Code: Select all

obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",name)
obj.addProperty("App::PropertyLength","Modules","Gear","Modules of the gear")
obj.Modules = "2.5 mm" 
obj.PressureAngle = "20 deg" 
self.form.Quantity_Modules.setText(self.obj.Modules.UserString)
The German task-dialog shows me: 2,5 mm and 20°

It seems the secret is contained in the FreeCAD Document Objects.

Ulrich
User avatar
sliptonic
Veteran
Posts: 3460
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: A Path command for circular holes and some questions

Post by sliptonic »

lorenz wrote:I guess I would think of this as more of a pocket than a profile, right? The idea is really to remove all of the material inside the circle. Of course, when the diameter is much larger then the tool diameter and you want the hole to go fully through one could think about just milling the outermost helix and leaving the inner part - but don't forget to affix this inner part somehow to the table, or it will fly away and possibly even damage the tool...
I would call it a profile. The tool is only clearing the interior because either the radius of the tool is over half the radius of the hole or the depth goes all the way through or both. Profiling an interior face this way is very useful even if the hole is blind for the reasons noted (surface finish and tool wear)
Nevertheless, I actually added a similar feature to the Profile operation already, a configurable ramp angle with which the tool descents along the profile path instead of a 90deg plunge straight down. It would be easy to add an option to set this angle such that there is actually no horizontal movement left. Right now, my pull-request for this got rejected (https://github.com/FreeCAD/FreeCAD/pull/118), as too much changed when you merged your "pathimprove" branch.

I was planning to rebase my patch onto the current state, but at the moment I have some trouble with the Profile operation, maybe I will ask about this in another thread.
Please do. I'm happy to help if I can.

I think I've seen a similar technique appearing for 3D printing where the outside wall is deposited while the Z axis moves up 1 layer height over the entire profile distance. It gives a very smooth wall.
lorenz
Posts: 29
Joined: Wed Mar 16, 2016 9:35 pm

Re: A Path command for circular holes and some questions

Post by lorenz »

sliptonic wrote:I would call it a profile. The tool is only clearing the interior because either the radius of the tool is over half the radius of the hole or the depth goes all the way through or both. Profiling an interior face this way is very useful even if the hole is blind for the reasons noted (surface finish and tool wear)
No, I explicitly deal with the case were the circle is larger than twice the tool and insert additional helix cuts, you can see it in the larger screenshot.
In the Task Panel there is also a setting for their radial separation, labeled "Step in Radius" (that cannot be set larger than the tool diameter, of course).
User avatar
sliptonic
Veteran
Posts: 3460
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: A Path command for circular holes and some questions

Post by sliptonic »

lorenz wrote:
sliptonic wrote:I would call it a profile. The tool is only clearing the interior because either the radius of the tool is over half the radius of the hole or the depth goes all the way through or both. Profiling an interior face this way is very useful even if the hole is blind for the reasons noted (surface finish and tool wear)
No, I explicitly deal with the case were the circle is larger than twice the tool and insert additional helix cuts, you can see it in the larger screenshot.
In the Task Panel there is also a setting for their radial separation, labeled "Step in Radius" (that cannot be set larger than the tool diameter, of course).
Oh wow. I can't believe I missed it. Nice!
lorenz
Posts: 29
Joined: Wed Mar 16, 2016 9:35 pm

Re: A Path command for circular holes and some questions

Post by lorenz »

It seems most of my issues with Profile went away again with the current master. Two little things remain: When opening a saved file, all Profile operations are suddenly called "(TC)", "(TC)001". The other small annoyance is that the label strings in the task panel are almost completely hidden, unless I make the panel very small. They disappear completely when I enlarge the panel, contrary to what one would expect. See the screenshot. Very strange...
Screenshot_20160612_155422.png
Screenshot_20160612_155422.png (30.19 KiB) Viewed 4263 times
Anyway, I managed to rebase my old patch and extend it to also add an appropriate GUI field for it. The patch adds a new property "PlungeAngle" that is set to 90 degrees by default (i.e. the old behavior). If set to 0.0 (or any value below the angle such that a full round would not reach the desired Z step), the tool gradually descents exactly one step length down per round, which is then similar to what the PathHelix command does.

Here is an example, on the left PlungeAngle is set to 0.0, on the right it was 15 degrees. Note that I would use smaller values (5-10 degrees) for actual milling:
Screenshot_20160612_163458.png
Screenshot_20160612_163458.png (14.99 KiB) Viewed 4263 times
I made a pull request for this at https://github.com/FreeCAD/FreeCAD/pull/188

If people like the PathHelix command, I will also create a pull request for that. What do you think?

By the way, does anyone know how to get rid of the initial "G0 X0 Y0 Z0" of a Project?
User avatar
sliptonic
Veteran
Posts: 3460
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: A Path command for circular holes and some questions

Post by sliptonic »

lorenz wrote:
By the way, does anyone know how to get rid of the initial "G0 X0 Y0 Z0" of a Project?
I've already fixed it but haven't done a pr yet.

I'll take a look at your code tonight. Thanks! :D
Post Reply