Community Tip - You can change your system assigned username to something more personal in your community settings. X
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.
Solved! Go to Solution.
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))
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.
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))
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))
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
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))
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?
&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.)
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.
Just out of curiosity, why do you need it in the drawing program itself?
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
This works syntax wise, but it pulls the drawing name not the model name.
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:
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
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: