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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

model_name + "custom text" in a drawing parameter relation

rburk
9-Granite

model_name + "custom text" in a drawing parameter relation

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

10 REPLIES 10
TomU
23-Emerald IV
(To:rburk)

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?

TomU
23-Emerald IV
(To:TomU)

Example with Creo Parametric 8.0

 

TomU_0-1662588835114.png

 

TomU_1-1662588866330.png

 

BenLoosli
23-Emerald II
(To:rburk)

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.

 

TomU
23-Emerald IV
(To:BenLoosli)

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.

rburk
9-Granite
(To:BenLoosli)

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'

BenLoosli
23-Emerald II
(To:rburk)

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

TomU
23-Emerald IV
(To:BenLoosli)

 


@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.

 

TomU_0-1662647224539.png

 

rburk
9-Granite
(To:BenLoosli)

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

TomU
23-Emerald IV
(To:rburk)

joe_morton
17-Peridot
(To:rburk)

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. 

Top Tags