ILogic Classes and Parameters

ILogic Classes and Parameters

alexGX8TC
Participant Participant
1,819 Views
2 Replies
Message 1 of 3

ILogic Classes and Parameters

alexGX8TC
Participant
Participant

I have some Parameters I'm using in a Form and want to get their values into a class I made. This is a simplified example of what I want to do. 

Sub Main
	Dim al As New Test
	al.UpdateSize()
End Sub
Public Class Test
	Inherits ThisRule
	Public Sub UpdateSize() 
		Parameter("Part1:1","Length") = Parameter("Length")
		Parameter("Part1:1","Width") = Parameter("Width")
	End Sub
	Public Sub New()
	End Sub
End Class

When I run it it says "Object reference not set to an instance of an object."

 

I noticed that doing "Inherits ThisRule" changed the color of Parameter to the correct color so I just left it in there, not sure if it's right. 

 

Thanks

0 Likes
Accepted solutions (1)
1,820 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

This should work.

 

Sub Main
	
	Dim al As New Test(Parameter)
	al.UpdateSize()

End Sub

Public Class Test 
	
	Dim Parameter As IParamDynamic
	
	Public Sub New(oParam As IParamDynamic)
		
		Parameter = oParam
		
	End Sub
		
	Public Sub UpdateSize() 
		
		Parameter("Part1:1","Length") = Parameter("Length")
		Parameter("Part1:1", "Width") = Parameter("Width")
		
	End Sub
	
End Class

 It seems Inheriting ThisRule doesn't pass the usable IParamDynamic Interface, so you can just do it manually. I don't know anything about ILogic's backend, but I assume inheriting ThisRule passes the IParamDynamic without initializing something so Parameter is empty. Inheritance and Interfaces are still a bit beyond me.

0 Likes
Message 3 of 3

alexGX8TC
Participant
Participant

Thank you so much I never would've figured this out!

0 Likes