Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
After being away from Creo for about a year, I'm back doing some freelance work in Creo 2 (yeah, old version, not my choice). I'm a bit rusty, but it's coming back pretty quickly.
We are 3D printing these parts and some need to be printed in multiple pieces to fit in the printer and then glued together. I've created a family table with instances for the various pieces. The generic file name is the P/N (12345), the instances are something like 12345_F, 12345_R, etc.
The PART_NO parameter is driven by the file name (PART_NUMBER = REL_MODEL_NAME in my relations) and I'm also using the P/N parameter to drive a protrusion on the part so that the P/N is on the printed part.
The problem is that the instances have suffixes so the protrusions have extra information in the PART_NO parameter. I'd like to drive the PART_NO parameter in all instances by the generic file name, not the instance model name.
How can I do that?
Solved! Go to Solution.
Can you use a relation in the generic model to check for the instance extension you want removed and derive a new value based on some logic? If I understand your goal...
12345_F needs to become 12345
12345_R needs to become 12345
so something like:
charPos =search(REL_MODEL_NAME,"_")
PARTNO = extract(REL_MODEL_NAME,1,charPos-1)
It is not easy to do - limited functionality for doing this - but this may be helpful:
Dave
Can you use a relation in the generic model to check for the instance extension you want removed and derive a new value based on some logic? If I understand your goal...
12345_F needs to become 12345
12345_R needs to become 12345
so something like:
charPos =search(REL_MODEL_NAME,"_")
PARTNO = extract(REL_MODEL_NAME,1,charPos-1)
It is not easy to do - limited functionality for doing this - but this may be helpful:
Dave
Long shot, I knew, but I was hoping there might be some function to call the generic name.
Your method assumes all suffixes start with an underscore. That is likely, but it is also true that all P/Ns are 5 digits, so I guess I could use:
PARTNO = extract(REL_MODEL_NAME,1,5)
In cases where it isn't, I can change the last digit.
Thanks,
Yep - that would be one of a handful of functions that I wish PTC would just add the the relations editor - I am not aware of another way to get there by functions off hand in the relation editor.
HOWEVER..... Another (slicker) option - would be to try to get the PTC_COMMON NAME instead in the instance (a default column in the family table). You can simply export to Excel, mass change these and save them back to the generic in I think.... 🤔
So - in your family table - you just populate the PTC_COMMON_NAME - as your model name (e.g. 12345_R = Instance Name, but 12345 = Common Name).
Then you can just set the relation without any string calculation - or worry about the "_" being there or not.
PARTNO = PTC_COMMON_NAME
then it is done perfectly every time.
That might be a better solution to your issue.
Dave
We use a similar method for stripping the "_FLATx" part of the name with sheetmetal parts:
IF SEARCH(REL_MODEL_NAME,"_FLAT") == 0
/* THIS IS THE GENERIC
MODELNAME=REL_MODEL_NAME
ELSE
/* THIS IS THE FLAT
MODELNAME=EXTRACT(REL_MODEL_NAME,1,SEARCH(REL_MODEL_NAME,"_FLAT")-1)
ENDIF
You can also use report symbols &mdl.top_generic.name
I need it in part relations, that syntax won't work there.