- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
iLogic Custom iProperty not updating
Hello, I've made a rule in an assembly that updates a custom property within a part. Depending on the parameter "RESTMAAT" one of the parts custom property is updated. The first time when I change a parameter in the assembly the parameter gets updated, but the property doesn't update. If I run the rule again then the property also updates.
What do I have to change in my rule so the property updates the first time the rule is run?
If RESTMAAT <= 50 Then
If RESTMAAT = 0 Then
ZAAGMAAT = 0
Else
ZAAGMAAT = Floor(23 + Sqrt(2) * RESTMAAT) + 0.99
End If
iProperties.Value("BA50rs", "Custom", "ISAH-Memo") = FormatAsFraction(ZAAGMAAT, 2)
ElseIf RESTMAAT > 50 Then
If RESTMAAT = 0 Then
ZAAGMAAT = 0
Else
ZAAGMAAT = Floor(8 + Sqrt(2) * RESTMAAT) + 0.99
End If
iProperties.Value("BA70rs", "Custom", "ISAH-Memo") = FormatAsFraction(ZAAGMAAT, 2)
End If
InventorVb.DocumentUpdate()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Morning,
First, in the case where RESTMAAT is greater than 50, I don't see how it could be 0, so I'd remove the if/else statement there.
Next I'd move the iProperty.Value out of the statements, after the parameter is set.
Like so :
If RESTMAAT <= 50 Then If RESTMAAT = 0 Then ZAAGMAAT = 0 Else ZAAGMAAT = Floor(23 + Sqrt(2) * RESTMAAT) + 0.99 End If ElseIf RESTMAAT > 50 Then ZAAGMAAT = Floor(8 + Sqrt(2) * RESTMAAT) + 0.99 End If iProperties.Value("BA50rs", "Custom", "ISAH-Memo") = FormatAsFraction(ZAAGMAAT, 2) InventorVb.DocumentUpdate()
Maybe this does the trick ?
Regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thank you for your reply @FINET_Laurent.
RESTMAAT = 0 (if RESTMAAT > 50) was just an example, but a bad example (this line doesn't matter though).
If RESTMAAT <= 50 then the property of the part "BA50rs" is set. If RESTMAAT > 50 then the property of the part "BA70rs" is set. So I have to include the iProperty.Value within the statements.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Indeed , my mistake.
Can you check the in the option tab of the rule if the rule is run automaticaly ?
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Interestring, I don't have a clue why this doesn't work..
A work around whould be to fire the rule each time you change a parameter, using for instance Triggers ? This is easy to do. Are you familiar witht those ?
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am familiar with Triggers, but I prefer not to use them. The model that includes this code will be used next month, so for now I will wait (and hope) for another solution, otherwise I will use the trigger.
Forgot to mention in my first post, I use Inventor 2019.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'dd still pull the iproperty.Value out of the if statement.
or maybe add a document update right before changing the iproperty value ?
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@FINET_Laurent Maybe you should modify the code. This code has to run from assembly, right @L.Greft ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
https://forums.autodesk.com/t5/inventor-customization/run-rule-for-all-subbassebly-files-in-inventor...