iLogic Custom iProperty not updating

iLogic Custom iProperty not updating

L.Greft
Advocate Advocate
945 Views
10 Replies
Message 1 of 11

iLogic Custom iProperty not updating

L.Greft
Advocate
Advocate

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()

 

Check out my ideas: https://autode.sk/2TKe6LH
0 Likes
946 Views
10 Replies
Replies (10)
Message 2 of 11

FINET_Laurent
Advisor
Advisor

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"

@LinkedIn     @JohnCockerill

0 Likes
Message 3 of 11

L.Greft
Advocate
Advocate

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.

 

Check out my ideas: https://autode.sk/2TKe6LH
0 Likes
Message 4 of 11

FINET_Laurent
Advisor
Advisor

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"

@LinkedIn     @JohnCockerill

0 Likes
Message 5 of 11

L.Greft
Advocate
Advocate

It runs automatically

Rule Options.PNG

Check out my ideas: https://autode.sk/2TKe6LH
0 Likes
Message 6 of 11

FINET_Laurent
Advisor
Advisor

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"

@LinkedIn     @JohnCockerill

Message 7 of 11

L.Greft
Advocate
Advocate

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.

Check out my ideas: https://autode.sk/2TKe6LH
0 Likes
Message 8 of 11

FINET_Laurent
Advisor
Advisor

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"

@LinkedIn     @JohnCockerill

0 Likes
Message 9 of 11

Anonymous
Not applicable

@FINET_Laurent  Maybe you should modify the code. This code has to run from assembly, right @L.Greft ? 

0 Likes
Message 10 of 11

L.Greft
Advocate
Advocate

Indeed, it has to run from the assembly @Anonymous 

Check out my ideas: https://autode.sk/2TKe6LH
0 Likes
Message 11 of 11

Anonymous
Not applicable
Im a bit busy rightnow doing autocad... 🙂 so here is one example.
https://forums.autodesk.com/t5/inventor-customization/run-rule-for-all-subbassebly-files-in-inventor...
0 Likes