External ilogic rule is not working

External ilogic rule is not working

niksasa
Collaborator Collaborator
1,394 Views
2 Replies
Message 1 of 3

External ilogic rule is not working

niksasa
Collaborator
Collaborator

Hello. Created in the template sheet metal rule. Please tell me why External ilogic rule is not working? User-valued parameter is created, sheet metal rule does not change.

name = ""
For Each par In ThisDoc.Document.ComponentDefinition.Parameters.UserParameters
   If par.Name = "SMR" Then 
      name = par.Name
      Exit For
   End If
Next
If name = "" Then
   Dim MyArrayList As New ArrayList
   For Each st In ThisDoc.Document.ComponentDefinition.SheetMetalStyles
      MyArrayList.add(st.Name)
   Next
   ThisDoc.Document.ComponentDefinition.Parameters.UserParameters.AddByValue("SMR", "", UnitsTypeEnum.kTextUnits)
   MultiValue.List("SMR") = MyArrayList
   Parameter("SMR") = SheetMetal.GetActiveStyle()
End If
SheetMetal.SetActiveStyle(Parameter("SMR"))
iLogicVb.UpdateWhenDone =True
PS: I will be glad of any help. Sorry for bad english. 
 
САПР - это инструмент, но только при условии грамотного подхода.
0 Likes
Accepted solutions (1)
1,395 Views
2 Replies
Replies (2)
Message 2 of 3

Vladimir.Ananyev
Alumni
Alumni
Accepted solution

When you change the multi-value list of the parameter, the actual value of the parameter does not change. This behavior is the default behavior of MultiValue (according to iLogic Help).  That’s why I prefer explicitly set options for this type of parameters using MultiValue.SetValueOptions function.  After this your rule works fine for me.

name = ""
For Each par In ThisDoc.Document.ComponentDefinition.Parameters.UserParameters
   If par.Name = "SMR" Then
      name = par.Name
      Exit For
   End If
Next
 
If name = "" Then
        'try to create new multi-value user parameter
   Dim MyArrayList As New ArrayList
   For Each st In ThisDoc.Document.ComponentDefinition.SheetMetalStyles
      MyArrayList.add(st.Name)
   Next
   MultiValue.SetValueOptions(True, DefaultIndex := 0, NumericCompare := "=")
   ThisDoc.Document.ComponentDefinition.Parameters _
               .UserParameters.AddByValue("SMR", "aaaaa", UnitsTypeEnum.kTextUnits)
   MultiValue.List("SMR") = MyArrayList
   Parameter("SMR") = SheetMetal.GetActiveStyle()
End If
SheetMetal.SetActiveStyle(Parameter("SMR"))
iLogicVb.UpdateWhenDone =True
Beep

 

If this doesn’t help could you plase upload your sheet part with the iLogic rule that should help to reproduce the problem.

You may also ask questions in Russian here:  http://adn-cis.org/forum

Cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

niksasa
Collaborator
Collaborator

Thank you, Vladimir, external rule worked. I created a new topic Здесь 

САПР - это инструмент, но только при условии грамотного подхода.
0 Likes