ilogic - suppress component

ilogic - suppress component

marcin_bargiel
Advocate Advocate
591 Views
5 Replies
Message 1 of 6

ilogic - suppress component

marcin_bargiel
Advocate
Advocate

I need a help with iLogic, i attached an example.

 

There are 3 rectangulars and 3 circles (cubes and cylinders in fact) - i created multibody part.

 

I have 2 rules in iam file. When rectangular or circle is small <10 i want to suppress components.

 

I want to do this by iLogic - moreover i DO NOT WANT to use trigger and run both 2 rules when open (for eg.)

 

All i want is to run just ONE proper rule.

 

When i change in ipt parameter a_rect, b_rect, c_rect <=10 then iLogic should suppress those components and run just rule_rectangular.

When i change in ipt parameter a_rect, b_rect, c_rect >10 then iLogic should unsuppress those components and run just rule_rectangular.

 

When i change in ipt parameter a_circ, b_circ, c_circ <=10 then iLogic should suppress those components and run just rule_circular.

When i change in ipt parameter a_circ, b_circ, c_circ >10 then iLogic should unsuppress those components and run just rule_circular.

 

 

Why? because i have hundreds of components and a lot of rules - and if i run all of them it take a long of time....

I wish I could use function Component.IsActive from ipt file - it'll be easier...

 

 

Vote for REPLACE VARIES !
REPLACE VARIES
0 Likes
592 Views
5 Replies
Replies (5)
Message 2 of 6

rikard.nilsson
Collaborator
Collaborator
Hi,

The only way I know how to have total control over rules when they should run or not is to use "Don't Run Automatically.." in Options and then use RunRule to start Rules.

But you if your new Rule only use one Parameter and none of the other rules. ILogic will only run that one.

/Rikard
0 Likes
Message 3 of 6

b_sharanraj
Advocate
Advocate

hi @marcin_bargiel

 

Hope you are using 2018 Version so that I'm unable to look in to your attachment but still i tired my best.

 

Check the Option "Don't Run Automatically"  in iLogic rules option for both "Rule_Rectangular" & "Rule_Circular"

 

Create a new rule with the below code

 

If Parameter("ipt_Name", "a_rect") <=10 Or Parameter("ipt_Name", "b_rect") <=10  Or Parameter("ipt_Name", "c_rect") <=10 Then
Component.IsActive("ipt_Name") = False
iLogicVb.RunRule("rule_rectangular")

ElseIf If Parameter("ipt_Name", "a_rect") >10 Or Parameter("ipt_Name", "b_rect") >10  Or Parameter("ipt_Name", "c_rect") >10 Then
Component.IsActive("ipt_Name") = True
iLogicVb.RunRule("rule_rectangular")
End If

InventorVb.DocumentUpdate() iLogicVb.UpdateWhenDone = True
 

 

Regards

B.Sharan Raj

0 Likes
Message 4 of 6

marcin_bargiel
Advocate
Advocate

Thank's but It will not work !  This new rule will not run, you would have to do it manually.

 

I did it differently by linking parameter from ipt file - now when this parameter changes - inventor automatically run rule (when that parametr appear...)

 

Vote for REPLACE VARIES !
REPLACE VARIES
0 Likes
Message 5 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi @marcin_bargiel,

 

Is it working as per expectation?

 

Thanks and regards,

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 6 of 6

marcin_bargiel
Advocate
Advocate

Yes it's working as per expectation 🙂

Actually i stopped using Component.IsActive - now i use function Component.Visible - it's much better ! but there is a little bit inconvenience

when using Component.Visible in iLogic we have to use the second function Component.InventorComponent(FeatureName).BOMStructure = BOMStructureEnum.kReferenceBOMStructure to hide that component in BOM.

 

In my opinion there should be just one function to do so...

Vote for REPLACE VARIES !
REPLACE VARIES
0 Likes