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: 

Suppress based off of a reference parameter

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
BMiller63
663 Views, 2 Replies

Suppress based off of a reference parameter

This is not my day for iLogic, it seems. Smiley Sad

 

I'm trying to suppress a hole feature based off of a reference parameter value, after setting the size of a model parameter. The problem is the reference parameter doesn't update during the rule.

 

Open the attached part file (Inventor 2010 format) and use the iTrigger button to run the rule.

Select 200 from the list to set the width.

The rule contains an if, then to set the hole supression:

 

 

trigger = iTrigger0
Width= InputListBox("Enter Width", MultiValue.List("Standard_Widths"), Standard_Widths, Title := "Widths", ListName := "Available Standard Widths")

Parameter.UpdateAfterChange = True
RuleParametersOutput()
InventorVb.DocumentUpdate()


if Center_Hole_Space >= 80 then
Feature.IsActive("Hole2") = True
Else 
Feature.IsActive("Hole2") = False
End if

iLogicVb.UpdateWhenDone = True

'display for test
MessageBox.Show("Center_Hole_Space = " & Center_Hole_Space, "Test")

 

But the Center_Hole_Space parameter is always one step behind when switching sizes.

 

Any thoughts?

 

P.S. I've tried adding these one at a time or in combo with no luck:

Parameter.UpdateAfterChange = True
RuleParametersOutput()
InventorVb.DocumentUpdate()

 

 

2 REPLIES 2
Message 2 of 3
BMiller63
in reply to: BMiller63

update:

 

I resolved this by breaking the if/then out into an seperate rule.

Message 3 of 3
MjDeck
in reply to: BMiller63

Breaking out the if/then into a seperate rule should work.  Here's another solution.

 

The problem is that parameters that appear as variable names in the rule (such as Center_Hole_Space in your rule) aren't "live" links.  Within the rule, they're simple local variables.  They get values from the Inventor model only at the time the rule starts.  If the parameter is changed by something external to the rule while the rule is running, then you have to use the Parameter function to get the changed value.

 You can do this by adding the line:

Center_Hole_Space = Parameter("Center_Hole_Space")

before the line:

If Center_Hole_Space >= 80 Then


Mike Deck
Software Developer
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report