Work Coordinate Systems or WCS

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Post Reply
WarrenkCash
Posts: 17
Joined: Wed Aug 04, 2021 9:10 am

Work Coordinate Systems or WCS

Post by WarrenkCash »

Hello everyone.
FreeCAD's built in list of job based select-able WCS's [G53,G54,G55] etc seems to be hard coded somewhere other than the python files. My Anilam control uses G53Ox for the WCS. That is G53 the letter O not Zero and x being 1 to 99. With FreeCAD and Python there is always a way around a problem if you are able and willing to dig deep enough.
My current solution is to select the job then edit the WCS in the Property view data tab The big picture. I then deal with it in the post.
Also I would have liked to insert the big pic here if any one knows if this can be done please comment.

This solution was fine until I discovered the Path Sanity tool. Path Sanity does not load the final picture showing where X0Y0Z0 is set if the WCS is not in the job based select-able WCS list.

I have other options for now.
1. I could use G53 from the list and put the other WCS info in a comment or some other property that is currently blank and extract it in the post.
2. I can use the experimental fixture Object the small icon picture attached. I found the python file for the fixture object and edited this to suit my needs for a test. I can change the list to ['O1,'O2',etc] but can only select one WCS per fixture object. It may be possible to change some properties or listbox definitions to select multiple items or I may learn how to display the list another way in a different type of dialog. As per the big picture I can set more than one WCS with the system I am using now.

Getting to the point . Does anyone know where the Job based WCS list , ie['G53','G54'etc] is loaded from. My preferred option would be to load this list from a user defined file for each machine. As I think there would be other machines that don't use any of the job based WCS .
I just can't find where this list is loaded from currently. Maybe I am just too BLONDE! . I still learning python so sorry if I got some terms wrong.

OS: Windows 10 (10.0)
Word size of FreeCAD: 64-bit
Version: 2022.430.26244 +4758 (Git)
Build type: Release
Branch: LinkDaily
Hash: b024b876480a533018fdc702145e9e38f8c54ba6
Python version: 3.9.12
Qt version: 5.12.9
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/Australia (en_AU)
Attachments
FreeCADFixture.PNG
FreeCADFixture.PNG (806 Bytes) Viewed 468 times
https://forum.freecadweb.org/download/file.php?mode=view&id=192713&sid=9cf0776fad9184c263b130ddd0a6a734
https://forum.freecadweb.org/download/file.php?mode=view&id=192713&sid=9cf0776fad9184c263b130ddd0a6a734
FreeCADAnilamFixture.PNG (11.38 KiB) Viewed 468 times
User avatar
sliptonic
Veteran
Posts: 2964
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Work Coordinate Systems or WCS

Post by sliptonic »

Unfortunately, the list is hard-coded in the PathEdit.ui file.
The simplest solution is just to use the values in the job and then add logic to your postprocessor to translate the WCS string in the job into whatever specific string you need. Thus selecting G53 would result in "G53o1" and selecting G54 would ouput "G53o2". Not ideal but certainly workable.

I'll be curious to hear from others what WCS designators are used by various controls. Do we need to make the string literals in the job WCS selector customizable?
WarrenkCash
Posts: 17
Joined: Wed Aug 04, 2021 9:10 am

Re: Work Coordinate Systems or WCS

Post by WarrenkCash »

I have played with this for now while now. My solution for now is to change the Fixtrue.py to accept a string which I turn into a list in the post. I did try a list but found it troublesome fro me at the moment. A string or list could be auto filled from a user file for any WCS format but then you have to select or delete WCS in the string or list as needed. Obviously it is easier to delete unwanted entries than add a pile of new ones , but how many operators use more than a few WCS per program.
The lines change are below.
class Fixture:
def __init__(self,obj):
obj.addProperty("App::PropertyEnumeration", "Fixture", "Path",QtCore.QT_TRANSLATE_NOOP("App::Property","Fixture Offset Number"))
obj.Fixture=['G53','G54','G55','G56','G57','G58','G59','G59.1', 'G59.2', 'G59.3', 'G59.4', 'G59.5','G59.6','G59.7', 'G59.8', 'G59.9']
obj.addProperty("App::PropertyBool","Active","Path",QtCore.QT_TRANSLATE_NOOP("App::Property","Make False, to prevent operation from generating code"))
obj.Proxy = self

def execute(self, obj):
fixlist = ['G53', 'G54', 'G55', 'G56', 'G57', 'G58', 'G59', 'G59.1',
'G59.2', 'G59.3', 'G59.4', 'G59.5', 'G59.6', 'G59.7', 'G59.8', 'G59.9']
fixture = fixlist.index(obj.Fixture)
obj.Path = Path.Path(str(obj.Fixture))
obj.Label = "Fixture" + str(fixture)
___________________________________________________________________________________________________
New code
class Fixture:
def __init__(self,obj):
obj.addProperty("App::PropertyString", "Fixture", "Path",QtCore.QT_TRANSLATE_NOOP("App::Property","Fixture Offset Number"))
obj.Fixture=['1'] #must have an entry can be anything you need
obj.addProperty("App::PropertyBool","Active","Path",QtCore.QT_TRANSLATE_NOOP("App::Property","Make False, to prevent operation from generating code"))

obj.Proxy = self
global fixlist
def execute(self, obj):
fixlist = obj.Fixture
obj.Path = Path.Path(str(obj.Fixture))
obj.Label = "WCS "+ str(fixlist)#chnage label to show fixtures entered when updated

The line obj.addProperty("App::PropertyString could alternatively be PropertyStringList.
This get enough info for you to extract in the post to produce working G-code with one or more fixtures and no limitations on the format.
User avatar
Kunda1
Veteran
Posts: 12733
Joined: Thu Jan 05, 2017 9:03 pm

Re: Work Coordinate Systems or WCS

Post by Kunda1 »

@WarrenkCash please put your code in bbcode tags. TIA
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
Post Reply