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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Replace Underscores with Spaces in Relations

dgschaefer
21-Topaz II

Replace Underscores with Spaces in Relations

We use the format <vendor name>_<vendor p/n> for some of our purchased components.  In order to show the info in a more readable format on drawings, that same info gets added to our "Description" parameter with spaces instead of the underscores.  I'd like to avoid typos by driving the parameter from the filename via relations while replacing the underscores with spaces. Of course, not every vendor name is the same number of characters, so using the string length isn't an option.  I need to be able to find the underscores and replace them.

 

Possible?

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn
ACCEPTED SOLUTION

Accepted Solutions
4 REPLIES 4

That should do it, I just now need to sort out the full syntax since there might be spaces in the vendor name as well.  I think I can sort that out.

 

Thanks.

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn

You could try this:

 

The trick here is that COMP_NAME_NICE will be "out-of-date" after the FIRST and SECOND parameters have changed, thus another regeneration is required.

 

Problem is that you first need to run this once, then uncomment the line.

 

COMP_NAME = "MY_COMPANY_NAME_WITH_UNDERSCORES"
COMP_NAME_NICE = COMP_NAME /* COMP_NAME_NICE = FIRST + " " + SECOND IF search(COMP_NAME_NICE,"_") > 0 FIRST = extract(COMP_NAME_NICE,1,search(COMP_NAME_NICE,"_")-1) SECOND = extract(COMP_NAME_NICE,search(COMP_NAME_NICE,"_")+1,string_length(COMP_NAME_NICE)-search(COMP_NAME_NICE,"_")) ENDIF

 

Wow, that's great stuff, thanks.  I've since realized that in most cases the file name will become the P/N of the purchased item, but not in all.  So this will still be useful, but not universal as I had thought.

 

Thanks again.

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn
Announcements


Top Tags