Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Currently running Creo Parametric 7.
I'm trying to auto-populate a repeat region. In this assembly, there are two cases:
1) XXXXXX-XXXXX-000, where "000" is the component find number. This is a parameter automatically generated at the part level, and can be called via relation asm_mbr_fn
2) The second case is a manually entered find number at the assembly level. This can be called via asm_mbr_cparam_find_number
These cases are mutually exclusive, i.e
Parts that fall under case 2 do not have an automatically generated asm_mbr_fn,
Parts that fall under case 1 do not have a manually entered asm_mbr_cparam_find_number
The components that fall under either case also have a specific naming convention. (see "YYYY", "_XXX" and "_YYYY" below)
Here is the relation I have written - but it is not working correctly, specifically the second IF statement is failing. Those cells in the table are blank. The first IF statement works just fine - it correctly populates the part_name and the FIND_NO.
name_len =string_length(asm_mbr_name)
SEARCH_PARAM = search(asm_mbr_name, "_")
us_loc = SEARCH_PARAM-1
us_loc_2 = SEARCH_PARAM+1
pn_len = name_len - SEARCH_PARAM
IF string_starts(asm_mbr_name, "YYYY") & SEARCH_PARAM>0
part_name = extract(asm_mbr_name,us_loc_2,pn_len)
FIND_NO = asm_mbr_cparam_find_number
else
part_name = asm_mbr_name
FIND_NO = asm_mbr_fn
endif
IF string_ends(asm_mbr_name, "_XXX") | string_ends(asm_mbr_name,"_YYYY")
part_name = extract(asm_mbr_name,1,us_loc)
FIND_NO = asm_mbr_cparam_find_number
endif
It's also worth noting that before I included the FIND_NO lines, the part_name populated correctly for all components. Now only those components that fall under the first IF statement are populating.
I'm scratching my head here - I can't figure out why the addition of the FIND_NO messes everything up. Any help is greatly appreciated!
Solved! Go to Solution.
Thanks for the response @BenLoosli! After fiddling with it the rest of the afternoon, I was able to get it working. Basically I had to split everything up into separate IF statements. Once I removed the "else" and made that condition it's own IF, everything worked. Which is weird... but hey, it works😂.
Can you upload an example drawing, assembly and part files (zipped) that have the proper parameters for testing?
Thanks for the response @BenLoosli! After fiddling with it the rest of the afternoon, I was able to get it working. Basically I had to split everything up into separate IF statements. Once I removed the "else" and made that condition it's own IF, everything worked. Which is weird... but hey, it works😂.
You are in the wrong forum.
PTC has two CAD systems: Creo+ and Creo Parametric and Creo Elements Direct.
Which makes it confusing.
More, for Creo Elements Direct:
- The 3D software name is Modeling, and
- The 2D software name is Drafting.
For Creo+ and Creo Parametric, use only this tab:
You should move your post to this community to have a better chance to get an answer.