Driving parameters from assembly level into parts with changing names

Driving parameters from assembly level into parts with changing names

Anonymous
Not applicable
400 Views
2 Replies
Message 1 of 3

Driving parameters from assembly level into parts with changing names

Anonymous
Not applicable

I have the following piece of code which works great when everything is kept standard.

However when the part is made non-standard, users change the prefix of a file from an 'A' to an 'AN'. Obviously when this happens my rule can no longer find the file.

How can I re-code this to work with both names, or even better to write to the same part everytime, no matter what the name is changed to?

 

If Hinge_Side = "Left"
hinge = 0
Parameter("A01909:1", "hinge") = 0
Parameter("A01906:1", "hinge") = 0
Parameter("A01903:1", "hinge") = 0


ElseIf Hinge_Side = "Right"
Parameter ("hinge") = 1
Parameter("A01909:1", "hinge") = 1
Parameter("A01906:1", "hinge") = 1
Parameter("A01903:1", "hinge") = 1

 

End If

0 Likes
401 Views
2 Replies
Replies (2)
Message 2 of 3

HermJan.Otterman
Advisor
Advisor

Did you rename the components in the browser before you used them in the code?

if you do, changing the filename does not change the browsername anymore, so the code keeps on working.

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 3 of 3

Owner2229
Advisor
Advisor

Hi, you might try something like this:

 

Dim oHinge As Integer

If Hinge_Side = "Left"
    oHinge = 0
ElseIf Hinge_Side = "Right"
    oHinge = 1
Else
Return End If Parameter ("hinge") = oHinge On Error Resume Next Parameter("A01909:1", "hinge") = oHinge Parameter("A01906:1", "hinge") = oHinge Parameter("A01903:1", "hinge") = oHinge Parameter("AN01909:1", "hinge") = oHinge Parameter("AN01906:1", "hinge") = oHinge Parameter("AN01903:1", "hinge") = oHinge
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes