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

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

Feature Name to Reference Part Property instead of Session ID

mroberts
4-Participant

Feature Name to Reference Part Property instead of Session ID

I'm using CREO Parametric 7. I am trying to use CREO's built-in mass properties in my assembly drawings. I can use the session ID for each part to get the right numbers. "&pro_mp_mass:sessionid", but it's tedious to find the right session ID, and if the assembly changes, it's tedious to go through and change every session ID.

 

I would rather use the feature name, or even Feat ID. It looks like I might be able to do something like "&pro_mp_mass:fid_FIND1" or "&pro_mp_mass:fid_40" (see attached image) but I can't get this to work.

 

I know that I can get a nice full list of all the values in a repeat region, but I want to reference the value in another annotation, individually by part.

 

Any thoughts?

 

Problem.png

1 ACCEPTED SOLUTION

Accepted Solutions
mroberts
4-Participant
(To:mroberts)

I ultimately used the suggestion from @sacquarone and created relations using the Component ID. This also allows me to round the values, and convert the units if I need to. I'm sure this can be done easier with a repeat region, but this solution allows me to reference these values in other annotations.

 

In the assembly relations, I have defined lb_fn1 using the component id. In the note, I can reference the value as &lb_fn1[.0].

 

Now if only I could format the values with a comma like 857,900

 

resolution.png

View solution in original post

9 REPLIES 9
sacquarone
20-Turquoise
(To:mroberts)

Hello @mroberts 

 

Please consider that if a given "session id" - called in a relation or in a note - changes in the future, the relation/note will update accordingly. But you're right, in some situations (like "Replace" - see article URL provided later) , it's much better to drive the relations using the component identifier, rather than session identifier.

 

Therefore, if you prefer driving the relation with identifiers, instead of session identifier, in this context, what matter's is the Component ID (cid), and not the Feature ID (fid). in other words, if you need a "note" (or a relation) retrieveing mass (pro_mp_mass) of  SUBPART1 (cid_40) in your snapshot, you need following syntax:

&pro_mp_mass:cid_40

 

For information and future reference if needed, we document this in our article 136660

 

Regards,

 

Serge

mroberts
4-Participant
(To:sacquarone)

Thanks for linking this article. It suggests that this solution only works up until CREO 4.0. I tried using your solution "&pro_mp_mass:cid_40" in CREO 7.0 and it's not working. Is there another way to accomplish this in CREO 7.0?

sacquarone
20-Turquoise
(To:mroberts)

Hello @mroberts 

 

You're right sorry. I was aware of this syntax and shared my suggestion too quickly. I should have verified this first. Sorry for the confusion.

 

I confirm that syntaxt pro_mp-mass:cid<feature id of xcomponent>:

  • Is effective in Relations (within the assembly in 3D Mode)
  • BUT is not effective in Notes - when preceeded by "&" character - whatever if the Note is inserted:
    • In a Drawing
    • OR as a "Flat" or "Annotation Element" Note in the top assembly (3D Mode):
      • This limitation applies whatever Creo Parametric version (not a regression of version 7.0 versus 4.0 - I tested it before answering and confirm consistent behaviors in both versions)
      • If "cid" logic is preferred instead of "session id" one, the approach consists in:
        • Creating first the "good Relation" in assembly (example MASS_SUBPART1=pro_mp-mass:cid_40)
        • Creating the Note (in 2D or 3D mode) with syntax &MASS_SUBPART1

 

Not eligible as a SPR (because limitation is consistent over versions, and we have internal documentation confirming this as expected currently), but nevertheless a good point to report as a new Idea, if you would like to.

 

Regards,

 

Serge

StephenW
23-Emerald II
(To:sacquarone)

Wouldn't this only really be of use if you used the replace command? Any other changes to the assembly  (added components, deleted components,etc) would require the specific component ID to be determined and the assembly relations to be corrected/added?

 

In terms of the drawing, this is where repeat regions do such an excellent job, they just handle changes to the assembly without user intervention (assuming indexes are not fixed and all required parameters are correct in the components.

Chris3
20-Turquoise
(To:mroberts)

We use a modified version of the text file attached in the thread below along with a mapkey. The mapkey loads the text file into the 0,0 position on the drawing so you get a quick list of the session IDs and then you can delete the note after you have found the one you want.

https://community.ptc.com/t5/Customization/Parameter-Syntax-digging-deeper/m-p/43749/highlight/true#M3399 

mroberts
4-Participant
(To:mroberts)

I ultimately used the suggestion from @sacquarone and created relations using the Component ID. This also allows me to round the values, and convert the units if I need to. I'm sure this can be done easier with a repeat region, but this solution allows me to reference these values in other annotations.

 

In the assembly relations, I have defined lb_fn1 using the component id. In the note, I can reference the value as &lb_fn1[.0].

 

Now if only I could format the values with a comma like 857,900

 

resolution.png

We often put volumes on our drawings that are "rounded" to the nearest 10mm^2. Since they are usually quite large values, I like to put commas in as "thousands separators". The only way to have a number with such commas inserted (or "." if you're in the rest of the world) is to build a text string to represent the number. Here's a sample of relations code I use:

voltotal      = VOLUME:FID_MXVOLUME
voltotapprox  = 10[mm^3] * floor ( voltotal / 10[mm^3] + 0.5 )
voltottext    = ""
IF voltotapprox > 999999.0[mm^3]
  voltottext    = voltottext + ITOS ( floor ( voltotapprox / 1000000[mm^3] ) ) + ","
  voltottext    = voltottext + EXTRACT ( ITOS ( 1000 * ( 1 + voltotapprox / 1000000[mm^3] - floor ( voltotapprox / 1000000[mm^3] ) ) ), 2, 3 )
  voltottext    = voltottext + ","
ELSE
  voltottext    = voltottext + ITOS ( floor ( voltotapprox / 1000[mm^3] ) ) + ","
ENDIF
voltottext    = voltottext + EXTRACT ( ITOS ( 1000 * ( 1 + voltotapprox / 1000[mm^3] - floor ( voltotapprox / 1000[mm^3] ) ) ), 2, 3 )

In terms of nomenclature, voltotal is the actual non-rounded volume value, voltotapprox is the value rounded to the closest 10mm^2, and voltottext is the voltotapprox value with thousands separators inserted. It seems like a lot, but that's relations for you. They're convenient, like assembly language programming.

mroberts
4-Participant
(To:KenFarley)

If I could wrap that up in a custom function, I'd do it. But that's so much to copy-paste dozens of times.

There are no user defined functions in relations. They are, in essence, code that is read thru sequentially, like a tape.

Yes, it's a lot of copy and paste, but it gets the job done. Sometimes I'm dealing with three or four regions of a part that I need to show area, volume, mass, etc. It gets to be a real mess.

Note also the calculations are done with units specified for things like the 1000 used to divide. If you don't do this the default units for the divisor will be assumed and you will get very confusing results.

Top Tags