09-26-2024
05:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-26-2024
05:36 AM
I wouldn't call this the best way, but I often need the Rule Objects in functions that are in an external VB file, and I get them by passing in the iLogicVb object and using the CreateObjectProvider function to get access to the rest of the rule objects. Here's an example using your code, the following would go into VB/whatever:
Sub CreateSideList(iLogicVb As ILowLevelSupport)
Dim doc As AssemblyDocument = iLogicVb.RuleDocument
Dim oAssDef As AssemblyComponentDefinition = doc.ComponentDefinition
Dim oUsPar As UserParameters = oAssDef.Parameters.UserParameters
Dim oPar As UserParameter = oUsPar.AddByValue("Side", "", UnitsTypeEnum.kTextUnits)
Dim mValue As IMultiValueParam = iLogicVb.CreateObjectProvider(doc).MultiValue
Dim oArr As ArrayList = mValue.List("Side")
oArr.Add("Left Side")
oArr.Add("Right Side")
mValue.SetList("Side", oArr.ToArray())
End SubThen, in an inventor rule, you would call it like this:
CreateSideList(iLogicVb)We make use of an addin to put bottons on our ribbon a lot, but we usually have the button link to iLogic rules so it's easier to update the code as we need to and don't need to update the add-in.
Hope this helps