Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set custom Index values in repeat Region 1

Status
Not open for further replies.

lockarde

Mechanical
Apr 6, 2021
4
Good morning,

I'm wondering if there is a way to set custom values for the Index numbers in a repeat region? As it sits, Index value starts at 1, 2, 3 etc. Can I set it to 001,002,003 etc?


Thanks for your help!
 
Replies continue below

Recommended for you

You can create a parameter that takes the index and prefixes it with the desired leading characters and then have the balloon symbols use that parameter as their repeat region index symbol.
 
Thanks for your response @3DDave! Could you give me a brief explanation on how to go about that? I'm fairly new to Creo, I've only been using it for about 3 months. I appreciate the help!
 
It would involve 2 things. The first would be a new parameter for the index column and use in your balloons. The second is to write a repeat region relation that adds the prefix characters to the system index parameter and assigns it to you new parameter. You cannot just add '00' in front of all indexes as that would lead to 009 and then 0010 when you probably want 010. There is a good explanation of relations in the help documentation, as well as repeat region parameters.

"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli
 
Thanks @looslib, I'll dig through the help documentation and see what I can figure out!
 
I can't give a step-by-step. It's been a while and I don't have access to the software anymore. I can tell where to look, I think.

Start at
Note the "rpt.index" which is the name of the repeat region index. This is a defined item that internally numbers each line of the repeat region.

Then look at which is where relations are added. You'll need to read the section on relations. PTC provides an example:
Notice the menu sequence "rpt > rel > User Defined" to create your new parameter.

An example of using relations:

creo said:
see Pro Engineer - Relation Operators and Functions for Strings for syntax on extract() and search()

Simplified for readability, base on from (external link), which follows this.

/***************************************************************************************************
NAME = FILE_NAME
OLD = "_"
NEW = " "

if Search(NAME, OLD)!=0

NAME=extract(NAME,1,Search(NAME, OLD)-1)+NEW+extract(NAME,Search(NAME, OLD)+1,String_length(NAME)-Search(NAME, OLD))

if Search(NAME, OLD)!=0

NAME=extract(NAME,1,Search(NAME, OLD)-1)+NEW+extract(NAME,Search(NAME, OLD)+1,String_length(NAME)-Search(NAME, OLD))

if Search(NAME, OLD)!=0

NAME=extract(NAME,1,Search(NAME, OLD)-1)+NEW+extract(NAME,Search(NAME, OLD)+1,String_length(NAME)-Search(NAME, OLD))

endif
endif
endif

I doubt the ptc community link works. PTC breaks their user community forum too often.

The following operators and functions are supported for strings:

== Compares strings as equal.

!=, <>, ~= Compares strings as unequal.

+ Concatenates strings.
string_length(parameter name) returns the length in characters of the string contained by parameter name

itos(int) Converts integers to strings. Here, int can be a number or an expression. Non-integers are rounded off.

search(string, substring) Searches for substrings. The resulting value is the position of the substring in the string (0 if not found).

extract(string, position, length) Extracts pieces of strings.

Probable error in function evaluation - This message is given when the EXTRACT function is used in Relations when the parameter length is greater as the parameter name to be extracted.
For example:

If param = "abcdef", then:

flag = param == "abcdef"—returns TRUE
flag = abcdef != "ghi"—returns TRUE
new = param + "ghi"—new is abcdefghi
new = itos(10 + 7)—new is 17
new = param + itos(1.5)—new is abcdef2
where = search(param, "bcd")—where is 2
where = search(param, "bce")—where is 0
new = extract(param,2,3)—new is bcd

Note: If you use the itos function on a parameter whose value is zero (0), the return value is an empty string.
The following examples illustrate the itos function:

creo said:
integer_param = 4
string_param = itos(integer_param)
/*string_param will return 4 */

integer_param = -7
string_param = itos(integer_param)
/*string_param will return -7 */

For an integer with zero (0) value, the itos function returns a null ("") value as shown below:
integer_param = 0
string_param = itos(integer_param)
/*string_param will return an empty or null string ("") */

To return a zero string value ("0"), use the following IF statement:
integer_param = 0
string_param = itos(integer_param)
IF string_param == ""
string_param = "0"
ENDIF

Finally, see for information on changing the index value that balloons use.
 
Wow! Thank you so much @3DDave! That is extremely helpful, I think I'll be able to sort it out from the help you've provided. I was playing around with it but I didn't have the correct operators/syntax for strings. This makes it much easier to sift through, thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor