Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
I have Repeat Region Relations that work in one drawing table but if I put that table in another drawing of the same model, the relations no longer work. Here's the relations:
RELSHOWNAME= ASM_MBR_NAME
IF EXISTS ("ASM_MBR_DESC")
IF ASM_MBR_DESC == "FLEX BODY"
RELSHOWNAME =ASM_MBR_D_UB_DWG
ENDIF
IF ASM_MBR_DESC == "NON-FLEX BODY"
RELSHOWNAME = ASM_MBR_D_LB_DWG
ENDIF
ENDIF
If my new table has a column with ASM_MBR_D_LB_DWG or ASM_MBR_D_UB_DWG the relations work, but if I remove the columns, the relations quit working and I see this in the message window: There are errors regenerating repeat region relations.
Anyone know what's going on here??
m
I'm no repeat region relations expert, but are those two parameters present at the bottom of the relations window? If not, add them and see if that does it.
I remember trying to add a relation that substituted A/R for the qty on bulk items and I had to manually add parameters in the relations window, even repeat region parameter like rpt_qty. See this thread:
if I add those columns, the parameters are added to the relations parameters as type unknown, but the relations work as intended. If I then remove those columns, the parameters in the relations editor are gone as well. If I create the parameters in the relations editor, as type string, they remain type string and do not change with the relations, but they do appear in the table. I guess I forgot to mention that when the relations do not work, the two table cells I'm trying to change with conditional statements are empty.
Here is a great article about repeat regions.
http://support.ptc.com/cs/cs_26/howto/dwt_no2d/dwt_no2d.htm
This was referenced at the end of this string:
Re: Family Table of Charted Dimensioin in an Assembly Drawing
Dale,
I don't see what that has to do with my question?
Did you try to reboot and the problem go away?
Seriously, I tried to to replicate your problem and managed to get weird results that might be a clue as to how to solve your issue:
I don't have a file set with your parameters, but I definitely got into some trouble when I deleted a parameter that was used in this repeat region relation:
if exists("ASM_MBR_FILE_TYPE")
TYPE_STRING = "** Present"
else
TYPE_STRING = "Missing"
endif
(the drawing has a repeat-region table with a column that has the entry "&rpt.rel.TYPE_STRING"; which will either show "** Present" if the component listed in the particular row has the parameter "FILE_TYPE", or it will show "Missing" if it doesn't - note my test assembly had a mix of both types of parts).
When I intentionally deleted the ASM_MBR_FILE_TYPE parameter in the repeat region relation ui's local parameter list, and then regenerated the drawing, the relation no longer worked (as expected - every row was filled with "Missing").
When I then tried to recreate the parameter ASM_MBR_FILE_TYPE, either by temporarily creating the extra table column which showed the component parameter "FILE_TYPE", or simply by manually adding a Real Number parameter "ASM_MBR_FILE_TYPE" to the local parameter list, the the relation no longer worked (all rows were now showing "** Present". Also note that the parameter ASM_MBR_FILE_TYPE did change to the "Unknown" type.
But what actually worked, incredibly, was simply going into the actual text of the relations (lines 01-05 above) and making a non-change - for example, retyping the word "endif" on line 05. After that, the relation prescribed in the very same looking 5 lines actually worked...
Maybe the same thing is happening to you in some way - try making a similar non-change in your relations of the repeat region in the new drawing and see if that helps... I doubt it because I don't actually get the message "There are errors regenerating repeat region relations", but who knows???
Try the following code and make sure you've got &rpt.rel.RELSHOWNAME in one of the repeat region table fields.
Untested:
IF EXISTS("ASM_MBR_D_UB_DWG") & EXISTS("ASM_MBR_D_LB_DWG")
DESCDUMMY=ASM_MBR_DESC
ELSE
DESCDUMMY="N/A"
ENDIF
IF EXISTS("ASM_MBR_DESC")
IF DESCDUMMY=="FLEX BODY"
RELSHOWNAME=ASM_MBR_D_UB_DWG
ELSE
IF DESCDUMMY=="NON-FLEX BODY"
RELSHOWNAME=ASM_MBR_D_LB_DWG
ELSE
RELSHOWNAME=ASM_MBR_NAME
ENDIF
ENDIF
ENDIF
Mike,
I spent some time on testing the problem in CR2 M070.
1.] IF EXISTS ("ASM_MBR_DESC") command does not work in repeat region relation
2.] all assembly members must contain the same set of parameters, this means:
DESC
D_UB_DWG
D_LB_DWG
2.] all parameters used in repeat region relation must be included in repeat region cell
4.] to "hide" unwanted parameters I set their height to 0.01 mm
5.] you can use attached table, if you fulfil the above rules
MH
Doug Schaefer is correct, the parameters referenced in your relations need to be listed in the parameters section. (Remember this Doug: Re: Bulk Item Qty in Repeat Region)
The required parameters will automatically be added to the repeat region parameters section if you add them to one of the repeat region columns (like MartinHanak mentioned), or you can just manually add them to the repeat region parameters section yourself. They do NOT need to be in a (hidden) column of the table.
Finally, "IF EXISTS" does work in repeat region relations (and this is the only place it works). See this discussion for a sample: Relations in drawing BOM
Let me know if you need screenshots demonstrating all of this.
I am publishing what I have learned .
Step 1.
Create table, define repeat region and put parameter into it.
Step 2.
Open relations dialog box, define parameters used in relations and enter relations.
See attached table.
MH
Bingo.
By the way, don't get hung up on the parameter type. You have to pick one when creating the repeat region parameters, but after actually being executed on an assembly,they will all change to unknown. This is because during execution they could actually change type. For example, one model could have a parameter defined as a string and the next model could have it defined as a real number. The repeat region parameter types will automatically switch back and forth to match the model's types. (Which can cause issues if you're using a type specific function.)
FYI, the statement:
if exists("PARAMETER NAME")
...
endif
works just fine in regular part relations in Creo 2.0 M200. So I'm not sure what you mean that repeat region relations is the only place it works...
Good to know. I think back sometime in Wildfire 2.0 I had tried to use it at the model level and was told by PTC that it only worked in repeat region relations. I haven't had a reason to try it somewhere else since then. Glad to hear it's working everywhere now. Thanks!
Good to see so many people jumping in to answer a repeat region question... and great content everyone.
Has anyone else than me never used IF EXISTS for repeat region relations? In my experience if that parameter doesn't exist the relation simply does nothing.
Yes, in my opinion usage of the EXISTS function is absolutely necessary in repeat region relations. Missing model parameters will cause the relations to fail (just like they would in the model), you just can't see the failure because they get re-evaluated all over again for each row (each unique model) listed in the region. This can cause all kinds of problems - no output at all, values left at their previous value, etc.
Huh. Apparently the models I've used have either all had the parameters needed or, if they're non-standard parameters, I've added them to the sub-components subconsciously before trying to write the relation. Good to know.