Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Expression to group components?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
ndamgaard
303 Views, 4 Replies

Expression to group components?

In Ilogic rules, is it possible to create and expression that groups a selection of components, so that all these components can be referenced with one expression (e.g. Component.Isactive(group)=True or False)?

 

To give an idea of what I am trying t

 

--------
component_group
=List("Assembly1", "Assembly2", "Assembly3", "Assembly4",..., "Assembly99")
If statement1=True Then Component.IsActive(component_group)=True If statement1=False Then
Component.IsActive(component_group)=False EndIf --------
I hope it is apparent what I am trying to achieve. Otherwise, let me know.

 

4 REPLIES 4
Message 2 of 5
theo.bot
in reply to: ndamgaard

You can use this idea, but you need to add a loop in you code to suppress each component. Here's a small sample:

 

Dim MyGroup = New String(){"P144-00030:1", "P144-00029:2","P133-00210:1"}

For Each oVal In MyGroup
		Component.IsActive(oVal) = False
Next

 

Message 3 of 5
ndamgaard
in reply to: theo.bot

Thanks for the response.

 

It works!

Message 4 of 5
ndamgaard
in reply to: theo.bot

Hello Theo,

A follow up question: Can I reference MyGroup in another rule?

I wish to keep my categories in its own rule, if possible.

Message 5 of 5
theo.bot
in reply to: ndamgaard

In your main rule you can create a SharedVariable. In other rules you can use this sharedVariable.

so rule1:

Dim MyGroup = New String(){"P144-00030:1", "P144-00029:2","P133-00210:1"}

SharedVariable("MyGroup") = MyGroup

 

Rule2:

For Each oVal In SharedVariable("MyGroup")
		Component.IsActive(oVal) = False
Next

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report