Hello everybody.
I'm trying to write a post processor for our scm record 110 cnc maschine (xilog based).
So far progress is good, but im stuck with the following:
Programs for our cnc must include header-line where the size (height, width, depth) of the stock object is defined. In FreeCAD the stock geometry is defined with a Job but I can't figure out how to access it from withing the postprocessor.
Thank's in advance, please let me know if you need more information.
Best
Thomas
Get the size of the stock in a custom postprocessor
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 13
- Joined: Wed Jan 26, 2022 4:02 pm
- Location: Oberneukirchen, Bavaria
Re: Get the size of the stock in a custom postprocessor
It is too long ago that I programmed my postprocessor, and I'm sure that I didn't access the job at all. If you have access to the Job and it is stored in a variable called "job", then you can get the information you are looking for with
For a default 10x10x10 cube and a default job the result would be
Code: Select all
job.Stock.Shape.BoundBox
Code: Select all
BoundBox (-1, -1, -1, 11, 11, 11)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
-
- Posts: 13
- Joined: Wed Jan 26, 2022 4:02 pm
- Location: Oberneukirchen, Bavaria
Re: Get the size of the stock in a custom postprocessor
Hi chrisb,
thank's for your answer.
The postprocessor's export function only gets a list of objects but not the job itself. So it was a bit tricky to access it.
Here is what I did:
It feels a like a hack, and it will not work if Job is named to something else, but it will do the trick for me.
thank's for your answer.
The postprocessor's export function only gets a list of objects but not the job itself. So it was a bit tricky to access it.
Here is what I did:
Code: Select all
doc = None
for obj in objectslist:
if hasattr(obj, "Document"):
doc = obj.Document
box = doc.Job.Stock.Shape.BoundBox
- dubstar-04
- Posts: 698
- Joined: Mon Mar 04, 2013 8:41 pm
- Location: Chester, UK
- Contact:
Re: Get the size of the stock in a custom postprocessor
Is this any use:thomas-huber wrote: ↑Thu Jan 27, 2022 10:16 am It feels a like a hack, and it will not work if Job is named to something else, but it will do the trick for me.
https://github.com/FreeCAD/FreeCAD/blob ... ls.py#L393
Thanks,
Dan
-
- Posts: 13
- Joined: Wed Jan 26, 2022 4:02 pm
- Location: Oberneukirchen, Bavaria
Re: Get the size of the stock in a custom postprocessor
Oh thanks, that's perfect!