External Rule referencing part parameters

External Rule referencing part parameters

Anonymous
Not applicable
767 Views
6 Replies
Message 1 of 7

External Rule referencing part parameters

Anonymous
Not applicable

All,

 

I'm trying to get a case statment in an external rule to read the multi-value list (text type) in a part to play nice with each other.

 

The basis for my code is 

 

SyntaxEditor Code Snippet

Dim oDoc as Document = ThisDoc.Document

ChannelSize = Parameter("ChannelSize")

Select Case ChannelSize

Case = "C3 X 3.5"
iProperties.Value("Summary", "Keywords") = "C3 X 3.5 MS CHANNEL"
G_IR=0.237489154
G_ER=0.08
G_H=3
G_W=1.37
G_T=0.132
G_C=0.616175
G_T1=0.273
G_NG=0.0524
iProperties.Value("Project", "Stock Number") = "PUT STOCK NUMBER HERE"
If iProperties.Value("Project", "Stock Number") = "PUT STOCK NUMBER HERE" 'DONT PUT STOCK NUMBER HERE!!!
MessageBox.Show("Part needs assigned a part number. Tell Someone.", "NEW PART")
End If


Case = "C3 X 4.1"
iProperties.Value("Summary", "Keywords") = "C3 X 4.1 MS CHANNEL"
G_IR=0.237489154
G_ER=0.08
G_H=3
G_W=1.41
G_T=0.17
G_C=0.616175
G_T1=0.273
G_NG=0.0524
iProperties.Value("Project", "Stock Number") = "56-60C3X4.1-01"
If iProperties.Value("Project", "Stock Number") = ""
MessageBox.Show("Part needs assigned a part number. Please Tell someone.", "NEW PART")
End If

 

For the life of me. We have tried a bunch of different ideas and are at a loss. Any help you guys have would be great. 

 

We know that the rule runs as we get our assigned error message, however the parameters do not update any dimensions.

 

This rule was created from an internal rule that works just fine. We just want to make it external, so that we can push new code out with newer information.

 

Thanks.

0 Likes
Accepted solutions (1)
768 Views
6 Replies
Replies (6)
Message 2 of 7

frederic.vandenplas
Collaborator
Collaborator

Hi,

 

As an internal rule, everything works fine, but as an external rule, you need to place Parameter("d0")=100

Try this:

 

Dim oDoc as Document = ThisDoc.Document

ChannelSize = Parameter("ChannelSize")

Select Case ChannelSize
Case = "C3 X 3.5"
Parameter("d0") = 500
Case = "C3 X 4.1"
Parameter("d0") = 1000
End Select

iLogicVb.UpdateWhenDone = True

 

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 3 of 7

Anonymous
Not applicable

 

 

This issue is still that Inventor does not color the ChannelSize, so no this did not solve the problem. 

 In "select case" line 5 is not the right color, therefore does not recognize it as a controllable parameter. See Attachment, in the Internal rule the circled term is in blue, and all of the parameters do work. The goal is that I need it to be an external rule so that I can push new sizes into existing items. Also This is Joey Baker , I am working with Mike Ellek the original poster.  Thanks for the help. 

0 Likes
Message 4 of 7

frederic.vandenplas
Collaborator
Collaborator

if you are talking about the textcolor in the rule of the word ChannelSize --> same color here and it does recognize.

i tried with different models and external rules, works perfectly, did you placed this line at the end? (rebuild)

Do you get any errors running the rule, if not, everything works.

 

iLogicVb.UpdateWhenDone = True

Please provide a sample model and your external rule so i can test what is happening

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 5 of 7

Anonymous
Not applicable

Hi this is Thad, also working with these guys. Anyways it seems as soon as we copy the rule to the external rule, the original rule suppressed, the external rule does not control the parameter. The only difference is that the ChannelSize after the Select Case changes color to brown from blue, and the parameters are no longer controlled. I've tried event triggers, adding the Parameter ("d0") etc.. no luck as well.

0 Likes
Message 6 of 7

Anonymous
Not applicable

Here is the part file we are working with. When the internal rule is unsuppressed, the external rule functions normally. When the internal rule is suppressed, the external rule breaks. Thanks again for any help!

 

Joey

0 Likes
Message 7 of 7

Anonymous
Not applicable
Accepted solution

Hi,

 

I've checked your part and created the external rule myself (an exact copy of the one provided + changes to the parameter declaration ( they are not recognized by default as mentioned earlier)

 

I've attached the part, as well the external rule, they both work as far as i can check. (please just check the event triggers)

 

Hope this is a solution now!

0 Likes