cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Use Generic Model Name For Instance Parameter

dgschaefer
21-Topaz II

Use Generic Model Name For Instance Parameter

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?

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn
1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

6 REPLIES 6

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

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,

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn

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

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

rburgess-2
14-Alexandrite
(To:dgschaefer)

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

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

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn
Top Tags