Hi @rhasell
Yes, that's how I've used it.
I've seen it used two ways:
Class ThisRule
'declarations here
End Class
Sub Main
'code here
End Sub
Class ThisRule
'declarations here
Sub Main
'code here
End Sub
End Class
Here is some info from the ilogic help that discusses the use of Class ThisRule.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Excerpted from here:
https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2014...
Additional statements
If you use Sub Main(), the rule follows standard VB.NET format for a class, except that the Class... and End Class statements are not visible, and the statements before Sub Main() are outside the class. Therefore, place all assignment statements inside a Sub, Function, or Property. You can include declaration statements for class member variables such as Private temp As Double = 4.5 outside of a subroutine or function.
You can add Sub, Function, Property, and Class definitions after Sub Main()... End Sub. Any Class you add is nested in the main rule Class for that rule and cannot be used from another rule. To add an independent Class or Module, explicitly declare the rule Class using the following:
Class ThisRule ' ...
Sub Main
End Sub
' ...
End Class
You can then add another Class or Module (or more than one) outside of this code. Class ThisRule becomes your main rule Class, and iLogic calls Sub Main (within it) to run your rule.
To include a Moduleor Class that is visible to multiple rules, put it in an external assembly (DLL). You can put more than one in the same DLL. You can also use AddVbRule to put them in a rule identified as "Straight VB code" within the Inventor document (). Or, use AddVbFile to put them in an external VB file.
When you develop advanced VB.NET code, use Visual Studio or Visual Basic Express rather than coding directly in a rule. You can then cut and paste relatively small snippets of code from Visual Studio into a rule. You can even paste in an entire dialog box Class (although resources are not easily supported). For larger units of code, or where required, create an assembly and use it as an external DLL from a rule.
You can store objects that are instances of a user-defined Class using the iLogic rule Shared Variable functions. To store these objects, serialize the Class, or it must be derived from MarshalByRefObject.