pythonical adding all the holes to an operation
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 141
- Joined: Tue May 07, 2019 10:50 pm
- Location: Brisbane, Australia
pythonical adding all the holes to an operation
so... I seem to like to climb before I can crawl
I would like to know how I automagically find all the holes in my board (potentially hundreds) and add them to helix operation
I'm thinking I need a little macro for this???
I have gotten as far as figuring out that the property of the operation I need to extend is operations 'Base' property
or is there an easier way on the UI that has escaped me??
Background:
I am making a little "pin board" project where I use a spreadsheet to enter the dimensions of a board, and some pin holes, and a count of holes in x & y
with some help (thanks again) I have been able to make said pin board model, and have moved onto the milling operation
(it has been suggested I use the "path array" operation for the milling. Even tho this maybe a good idea, let us put that to side for the moment)
I would like to know how I automagically find all the holes in my board (potentially hundreds) and add them to helix operation
I'm thinking I need a little macro for this???
I have gotten as far as figuring out that the property of the operation I need to extend is operations 'Base' property
or is there an easier way on the UI that has escaped me??
Background:
I am making a little "pin board" project where I use a spreadsheet to enter the dimensions of a board, and some pin holes, and a count of holes in x & y
with some help (thanks again) I have been able to make said pin board model, and have moved onto the milling operation
(it has been suggested I use the "path array" operation for the milling. Even tho this maybe a good idea, let us put that to side for the moment)
-
- Posts: 991
- Joined: Wed Mar 27, 2019 10:45 am
Re: pythonical adding all the holes to an operation
hi friend,
File, version and I'm happy to give it a look.
Cheers!
File, version and I'm happy to give it a look.
Cheers!
-
- Posts: 141
- Joined: Tue May 07, 2019 10:50 pm
- Location: Brisbane, Australia
Re: pythonical adding all the holes to an operation
hi here is a tidied up version...
the goal is to be able to edit the spreadsheet and then produce g-code based on the updated data
i am interested in the the journey (ie how) rather than the destination (the finished product)
the goal is to be able to edit the spreadsheet and then produce g-code based on the updated data
i am interested in the the journey (ie how) rather than the destination (the finished product)
- Attachments
-
- pintable20.FCStd
- (140.58 KiB) Downloaded 69 times
Re: pythonical adding all the holes to an operation
I might not be fully understanding what you want to do - but I think the Helix op already does that.
If you create a helix op, it's proxy is a subclass of PathCircularHoleBase.ObjectOp which has 2 functions to find and use all holes in a given object. Assuming your op is called PathHelix, the following snipped should find all holes and assign them to the op:
If you look at that function in PathCircularHoleBase.py it should give you some ideas.
If you create a helix op, it's proxy is a subclass of PathCircularHoleBase.ObjectOp which has 2 functions to find and use all holes in a given object. Assuming your op is called PathHelix, the following snipped should find all holes and assign them to the op:
Code: Select all
App.ActiveDocument.PathHelix.Proxy.findAllHoles(App.ActiveDocument.PathHelix)
Re: pythonical adding all the holes to an operation
BTW - this has the same effect as pressing "Reset" in the UI.mlampert wrote: ↑Tue Jul 09, 2019 3:07 pmCode: Select all
App.ActiveDocument.PathHelix.Proxy.findAllHoles(App.ActiveDocument.PathHelix)
-
- Posts: 991
- Joined: Wed Mar 27, 2019 10:45 am
Re: pythonical adding all the holes to an operation
Playing with Profile Based and Faces and selecting "holes" i indeed realised that if path in this case can locate the circles and produce a combination of rapids and profiles on all holes by selecting just one face, then it surely would be able to extrapolate this to a Drilling Op.
Based on what your write mlampert it even seems like a simple solution.
Am i wrong?
Based on what your write mlampert it even seems like a simple solution.
Am i wrong?
Re: pythonical adding all the holes to an operation
Both, Drilling and Helix are based on PathCircularHoleBase - so both have support for finding all holes in the API and the UI.
Re: pythonical adding all the holes to an operation
If it is an "Automatic Selection" the call it that! i.e., AutoSelect
RESET is a misnomer that infers starting over and possibly trashing info/selection(s)/data.
Yeah, findAllHoles() sure sounds like an automatic selection to me.
Re: pythonical adding all the holes to an operation
Then call it SELECT ALL - more equivalent to findAll(); anything but Reset.
It is not obvious or intuitive
Question: Path-Hoppa: When one opens up the drilling OP (and i just did), and the UI is blank, why on earth would you click on resetting-nothing?
Except for that is just one of the ways it works.
I have used this RESET button hundreds of times, and laughed to myself just as many!
It is not obvious or intuitive
Question: Path-Hoppa: When one opens up the drilling OP (and i just did), and the UI is blank, why on earth would you click on resetting-nothing?
Except for that is just one of the ways it works.
I have used this RESET button hundreds of times, and laughed to myself just as many!