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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Drawing note based on modified &dwg_name parameter

JADEN_9797
4-Participant

Drawing note based on modified &dwg_name parameter

Hello all,

I am trying to have a note on my drawing that is driven by the drawing name but without the last 2 digits.

EG, drawing name is COFFEE_CUP-RED-01 and I would like a note to read COFFEE_CUP-RED

This is so multiple drawings can be linked to the same model but the notes update based on the drawing name.

I managed to write a relation as a proof of concept that would do what I want but I can't use system parameters (&dwg_name instead of rel_model_name) in the relations field I have learnt.

The relation I was using is;

NAMING_NOTE = extract(rel_model_name, 1, (search(rel_model_name, "01")-1))

 

Digging through the forums some have mentioned using the drawing program to act like relations but I  can't figure this out. I am stuck at trying to have a drawing parameter = a system parameter. Even if I got this to work I'm not sure if I can simply add the above relation into the drawing program.

 

Any ideas would be greatly appreciated.

ACCEPTED SOLUTION

Accepted Solutions
mcestnik
14-Alexandrite
(To:JADEN_9797)

Parameter rel_model_name used in drawing proprogram always shows the name of the drawing. It doesn't matter which part is added to the drawing.

 

Test this relation and it should work as you wish:
NAMING_NOTE:D = extract(rel_model_name, 1, (search(rel_model_name, "01")-1))

View solution in original post

16 REPLIES 16
mcestnik
14-Alexandrite
(To:JADEN_9797)

Just add this line to drawing program:

NAMING_NOTE: D = extract(rel_model_name, 1, (search(rel_model_name, "01")-1))

 

This will create drawing parameter NAMING_NOTE with drawing name.

Then add a note with &NAMING_NOTE.

 

Example in the attached picture.

JADEN_9797
4-Participant
(To:mcestnik)

Thanks for the reply Mcestnik 

That line works well if I base it off a model parameter (rel_model_name) but what about a system parameter (dwg_name)?

 

This line in the drawing program gives an error;

NAMING_NOTE: D=extract(dwg_name, 1, (search(dwg_name, "01")-1))

mcestnik
14-Alexandrite
(To:JADEN_9797)

Parameter rel_model_name used in drawing proprogram refers to the name of the drawing - it is the same as the &dwg_name used in notes/tables.
It gives an error because there is a space between ":" and "D".

 

It should be like this (picture attached):

NAMING_NOTE:D = extract(rel_model_name, 1, (search(rel_model_name, "01")-1))

 

 

 

 

 

JADEN_9797
4-Participant
(To:mcestnik)

Odd, not sure where the space came from, this is the exact line in my drawing program;

NAMING_NOTE:D=extract(dwg_name, 1, (search(dwg_name, "01")-1))

 

You are right, generally the model and the drawing have the same name so rel_model_name=dwg_name

but it is possible to have a drawing linked to a model with different names, eg in attached image

rel_model_name =/= dwg_name

29213-POST =/= COFFEE_CUP_RED-01

 

It is this situation why I want my note to be based on the dwg_name and not the rel_model_name PARAMETER

 

mcestnik
14-Alexandrite
(To:JADEN_9797)

Parameter rel_model_name used in drawing proprogram always shows the name of the drawing. It doesn't matter which part is added to the drawing.

 

Test this relation and it should work as you wish:
NAMING_NOTE:D = extract(rel_model_name, 1, (search(rel_model_name, "01")-1))

JADEN_9797
4-Participant
(To:mcestnik)

You are absolutely right, my hats off to you for your help. It is now working successfully.

Very odd, would have though they would have used rel_drw_name but I guess thats CREO

Is there a similar notation to "rel_model_name" that will callout the model name not the drawing name in a drawing program?

TomU
23-Emerald IV
(To:mlinscott)

&model_name can be used in a note (or table cell), but I'm not sure it will work in a drawing program...  (I know it doesn't work in repeat region relations.  There is a different workaround for that.)

mlinscott
2-Explorer
(To:TomU)

I tried the &model_name in the drawing program, but it throws a syntax error. I also tried rel_model_name:MDL but that throws a syntax error as well.

TomU
23-Emerald IV
(To:mlinscott)

Just out of curiosity, why do you need it in the drawing program itself?

motormayhem
5-Regular Member
(To:TomU)

The program modifies some parameters that are displayed by a symbol based on release status. Its a way to have the drawing water marked before release without having a .pdf generator plugin.

You can try rel_model_name...

e.g. 

NAME:D=rel_model_name

motormayhem
5-Regular Member
(To:Mahesh_Sharma)

This works syntax wise, but it pulls the drawing name not the model name.

TomU
23-Emerald IV
(To:motormayhem)

The problem with rel_model_name is that it acts more like a function than a parameter.  It can only be called inside relations, and drawing programs are not the same thing as relations.  Most relations commands do not work in a drawing program.

 

If you keep PTC_COMMON_NAME (or Windchill "Name") equal to the model's name, you can refer to that from the drawing program:

 

DRW_PARAM:D = PTC_COMMON_NAME:MDL

 

The disadvantage is that the text will probably be all lower case and include the file extension.  (Depends on some Windchill preferences.)

 

Life with Creo would be so much better if drawings could have relations...

 

Maybe consider a different approach:

  • Have two separate symbols already showing the correct information (&model_name, etc.) and then simply use the drawing program to hide and show the appropriate symbol.
  • Create a parameter and corresponding relations in the model to display what you want shown in the drawing.  This can be configured to automatically update when the model changes state, just make sure the CAD worker is configured to regenerate the models before publishing.
  • Get a PDF watermarking tool and stop trying to change the drawing based on state.  We are using a watermarking utility from Fishbowl Solutions and it works very well.
TomU
23-Emerald IV
(To:TomU)

Looks like extract() does work in drawing programs, so that will help if you need to drop the file extension.

https://www.ptc.com/en/support/article?n=CS20271

 

TomU
23-Emerald IV
(To:TomU)

Okay, one more idea.  If you're okay with using model parameters to drive the information displayed on the drawing, AND you're using Creo 5 or later, you can create a single cell repeat region that has it's contents based on the model's name and something else (like lifecycle state).  Not quite the same as a symbol, but might still accomplish what you need:  (You could also show or hide this based on the lifecycle state of the model in the drawing program.)  For example:

Repeat Region Relations - Lifecycle State.PNG

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags