Hallec
Mechanical
- Dec 4, 2018
- 49
Hello gentlemen, I have a question about parsing strings so that I can properly format the DWG title in the new formats I'm working on.
We use your typical ASME Y14.100 drawing title scheme: Text, Text, Text, Text, Text
Our DWG titles are limited to 50 characters (legacy software of course) which perhaps simplifies things a bit because we know the absolute limit to the title.
I have a parameter "TITLE" which historically has been used to contain the entire dwg title.
I also have two other parameters DWG_TITLE1 & DWG_TITLE2 to accept the output of my relation.
My thought is to run a relation that checks the TITLE parameter for string_length, and if greater than 25, at the 25th position, go BACK to the previous comma and extract everything from that point to the end of the string.... Put that output into DWG_TITLE1 and the rest into DWG_TITLE2.
Now, I have almost zero prior experience with these relations beyond x+y=z but I've managed a little progress using Google. So far, I've got:
IF string_length(TITLE) > 25
DWGTITLE1 = extract(TITLE,1,search(TITLE, ","))+extract(TITLE,search(TITLE, ","),string_length(TITLE)-search(TITLE, ","))
DWGTITLE2 = extract(TITLE,string_length(DWGTITLE1),search(extract(TITLE,25,string_length(TITLE)),",")-1)
And basically I'm not having any luck... I was hoping for something like:
TITLE = PLATE, L-ARM, CONVEYOR, RECEIVING, PANEL, BODYWELD
DWGTITLE1 = PLATE, L-ARM, CONVEYOR,
DWGTITLE2 = RECEIVING, PANEL, BODYWELD
But what I'm getting is something illogical. Before I spend too much time on this I was hoping some of you relation pro's could make sure I'm headed in the right direction? I'm not sure how to get Creo to start looking for commas AT a certain position or how to go in a particular direction (from pos25 --> pos1). Also, I suppose one other requirement is that it extracts one character AFTER the first comma back from pos 25. And now that I'm typing this, I suppose I'll also need it to delete the first space after that comma.
Boy, this is quite an issue we're left to deal with... It;s astonishing to me that a simple, workable text wrap hasn't yet been incorporated into Creo 4 (M080),
Any help is greatly appreciated!
Hallec
I'm not a vegetarian because I dislike meat... I'm a vegetarian because I HATE PLANTS!!
We use your typical ASME Y14.100 drawing title scheme: Text, Text, Text, Text, Text
Our DWG titles are limited to 50 characters (legacy software of course) which perhaps simplifies things a bit because we know the absolute limit to the title.
I have a parameter "TITLE" which historically has been used to contain the entire dwg title.
I also have two other parameters DWG_TITLE1 & DWG_TITLE2 to accept the output of my relation.
My thought is to run a relation that checks the TITLE parameter for string_length, and if greater than 25, at the 25th position, go BACK to the previous comma and extract everything from that point to the end of the string.... Put that output into DWG_TITLE1 and the rest into DWG_TITLE2.
Now, I have almost zero prior experience with these relations beyond x+y=z but I've managed a little progress using Google. So far, I've got:
IF string_length(TITLE) > 25
DWGTITLE1 = extract(TITLE,1,search(TITLE, ","))+extract(TITLE,search(TITLE, ","),string_length(TITLE)-search(TITLE, ","))
DWGTITLE2 = extract(TITLE,string_length(DWGTITLE1),search(extract(TITLE,25,string_length(TITLE)),",")-1)
And basically I'm not having any luck... I was hoping for something like:
TITLE = PLATE, L-ARM, CONVEYOR, RECEIVING, PANEL, BODYWELD
DWGTITLE1 = PLATE, L-ARM, CONVEYOR,
DWGTITLE2 = RECEIVING, PANEL, BODYWELD
But what I'm getting is something illogical. Before I spend too much time on this I was hoping some of you relation pro's could make sure I'm headed in the right direction? I'm not sure how to get Creo to start looking for commas AT a certain position or how to go in a particular direction (from pos25 --> pos1). Also, I suppose one other requirement is that it extracts one character AFTER the first comma back from pos 25. And now that I'm typing this, I suppose I'll also need it to delete the first space after that comma.
Boy, this is quite an issue we're left to deal with... It;s astonishing to me that a simple, workable text wrap hasn't yet been incorporated into Creo 4 (M080),
Any help is greatly appreciated!
Hallec
I'm not a vegetarian because I dislike meat... I'm a vegetarian because I HATE PLANTS!!