Skip to main content
21-Topaz II
December 19, 2019
Solved

Use Generic Model Name For Instance Parameter

  • December 19, 2019
  • 6 replies
  • 5346 views

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?

Best answer by DavidBigelow

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:

 

http://support.ptc.com/help/creo/creo_pma/usascii/index.html#page/fundamentals%2Ffundamentals%2Ffund_seven_sub%2FOperators_and_Functions_for_Strings.html%23

 

Dave

6 replies

18-Opal
December 19, 2019

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:

 

http://support.ptc.com/help/creo/creo_pma/usascii/index.html#page/fundamentals%2Ffundamentals%2Ffund_seven_sub%2FOperators_and_Functions_for_Strings.html%23

 

Dave

21-Topaz II
December 19, 2019

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,

18-Opal
December 19, 2019

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).

 

2019-12-19 at 12.26 PM.png

 

Then you can just set the relation without any string calculation - or worry about the "_" being there or not.

 

PARTNO = PTC_COMMON_NAME

 

2019-12-19 at 12.27 PM.png

 

then it is done perfectly every time.

 

2019-12-19 at 12.29 PM.png

 

That might be a better solution to your issue.

 

Dave

HamsterNL
18-Opal
December 20, 2019

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

1-Visitor
December 20, 2019

You can also use report symbols &mdl.top_generic.name

21-Topaz II
December 23, 2019

I need it in part relations, that syntax won't work there.