Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
is there any way to add custom "text" to end of drawing parameter relation below?
we'd like to truncate the "model name last 3 characters" then add text "DOC1"
for our drawing title blocks
DOC_NO=extract(rel_model_name(),1,string_length(rel_model_name())-3)"DOC1"
thanks
Rich
Drawing programs have a greatly reduced subset of valid commands. You should be able to display this on the drawing by using a single cell repeat region as long as you don't actually need a drawing parameter populated with this value. What version of Creo Parametric are you running?
You had it close.
DOC_NO=extract(rel_model_name(),1,(string_length(rel_model_name())-3))+'DOC1'
Test the extract portion to be sure it gives you what you want.
That will work as long as they want to add the relation to the model, but it won't work in a drawing unless it's added to a repeat region.
thank Benloosi,
we are using Creo6
this works
DOC_NO=extract(rel_model_name(),1,(string_length(rel_model_name())-3))+'DOC1'
is it possible to search rel_model_name for "001" - not all model names have "001"
something like this:
if rel_model_name has "001"
DOC_NO=extract(rel_model_name(),1,(string_length(rel_model_name())-3))+'DOC1'
else
DOC_NO=extract(rel_model_name(),1,(string_length(rel_model_name())-3))+'CDOC1'
I did it in steps, but could be combined into a single line.
Relations do have a limit of 80 characters.
The first line finds the start position of the required search string.
rtn=search(rel_model_name,'001')
if rtn <> 0
DOC_NO=extract(rel_model_name(),1,(string_length(rel_model_name())-3))+'CDOC1'
endif
@BenLoosli wrote:
Relations do have a limit of 80 characters.
... for a single line. You can continue a single relations statement on as many lines as you want, you just have to use the continuation character ( \ ) so each line doesn't exceed 80 characters.
can this be written for the drawing program ?
RTN=search(rel_model_name,'001')
IF RTN <> 0
DOC_NO:D=extract(rel_model_name(),1,(string_length(rel_model_name())-3))+"DOC1"
ELSE
DOC_NO:D=rel_model_name()+"CDOC1"
ENDIF
No, drawing programs only allow a few specific commands:
Do you have 1 drawing per model? You might be able to add the relation in the model itself, then reference that parameter in the drawing. This might be a little more flexible to use than dealing with repeat regions.