model_name + "custom text" in a drawing parameter relation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Labels:
-
2D Drawing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
No, drawing programs only allow a few specific commands:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
