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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

2 lines of text, from a 1 line parameter

pshepherdson
9-Granite

2 lines of text, from a 1 line parameter

Hi,

We generate our "part description" from a parameter, pulled into the drawing.  Problem is, is that this one line of text can get rather long.  Does anyone know of a way to split a parameter line of text into two lines, at a specific point?

I'm thinking there might be a way with an old DOS or ASCII expression, like /r/n or /B or such..

thanks!

paul

9 REPLIES 9

To my knowledge, we need to create two parameter and then pulled those into the drawings.

Something like this:

                                    &description

                                    &description_1

mender
6-Contributor
(To:pshepherdson)

Not like that, but some things to consider:  1) multiple parameters that are combined into the part description.  2) the other way around, using relations to drive part_desc_line_1 and part_desc_line_2 from part_description.  3) just calling out the part description, and using word wrapping on the note to break it up.  (3) is better if the break point is not too important as long as it is between words, the others are better suited to handling the case where you want one chunk of info on each line, and it the relative length of the two lines may vary from one part to the part.

Word wrap in notes works OK as long as the note is not center justified. Creo 2 (haven't checked Creo 3 yet) leaves space characters on the ends of the lines, shifting the remainder of the visible text off-center.

If Creo understood the notion of parameter arrays, then one could handle it by placing each part in its own element and looping through the elements to get the total.

Instead you can use a relation that copes with the maximum number of lines and just skips the ones that don't exist.

ROUGHLY (look up how Creo actually does string addition to be sure)

description = ""

If exists("description_1)

description = description + " " + description_1

endif

If exists("description_2)

description = description + " " + description_2

endif

...

If exists("description_x)

description = description + " " + description_x

endif

Other than that it's a hard problem to break strings where people think they should break; there are a lot of rules, though going through the samples you have you may be able to make the rules list shorter.

(edited to fix initialization bug)

No easy way of doing it.  But one way to hack it is to create a note and a note parameter in the model and call out that note parameter in your drawing's note or a table cell (for example, in the title-block):

note_parameter_hacks.png

Works fairly well for multi-line text and also lets you incorporate formatting tricks such as rounding the display of real-valued parameters (e.g., &length[.0]).  In my example, I was just extracting the strings...

mender
6-Contributor
(To:psobejko)

I wouldn't describe a note-valued parameter as a hack, personally.  It definitely is another option, and worth mentioning.  The benefits are that it is significantly richer than using a string-valued parameter (or even a couple of them).  The drawbacks are that other applications may not support that richness, notably you can't set a different note text (and text styles) per family table instance, and I think designating them for PDM.  And you edit them with note properties instead of the parameters dialog, but that's to be expected.

If you're going through this exercise to put this parameter in a drawing format table of some kind, know that word-wrap only wraps to the &-variable, and not the value.

I could be wrong, but in my experience with this very matter, after solving it for the most part, was that the formats couldn't be made smart enough to auto-word-wrap the value of the variable.... only the &name so it would never wrap.  Therefore, be prepared to have 3 optional variables once you figure out how to populate your format.

mender
6-Contributor
(To:TomD.inPDX)

This was indeed true.  Then someone told me about it, and I fixed it in Creo 2 M220 and Creo 3 M110.  As of those builds, placing a format in a drawing where the title block (or other table) has a note with an unparsed callout that has been word-wrapped because of the cell width,

&LONG_PAR

AMETER

will new correctly produce a wrapped note calling out this parameter.

TomD.inPDX
17-Peridot
(To:mender)

Good to know.

hello

I want to do so by typing text into two lines in relation table (& rpt.rel.text).

 

if "1111-02"==partnumber
text="1111-02"\n"or"\n"1111-03"

else
text=partnumber
endif

 

("\n" indicates the line break.)

 

then in the end I will see it on the board in the drawing:

1111-02

or

1111-03

 

thanks for your help

Top Tags