Writing VB Code that Hooks into XSI
1. Create an ActiveX plug-in (the example below uses VBUtils.Plugin with method HelloWorld)
2. Type the following lines in the code window for your new class:
Public Sub HelloWorld()
Dim xsimath As SIMATHLib.CXSIMath
Set xsimath = New SIMATHLib.CXSIMath
Dim v3
Set v3 = xsimath.CreateVector3
v3.Set 1, 2, 3
MsgBox "HelloWorld " & v3.X & "," _
& v3.Y & "," & v3.Z
End Sub
3. Compile and save your project.
![]()
|
When you save your project, do not create a DLL. Click OK to create a component, which will allow you to interactively debug your ActiveX control inside VB. |
Debugging Your VB Program in XSI
1. Open XSI.
2. Open the script editor and type the following in the Editing pane, where myTest is the project name and myTestThing is the class name:
Set plugin = CreateObject("VBUtils.Plugin")
plugin.HelloWorld
If your program’s hooks to XSI are not working, the following error message appears in the History pane of the script editor:
'ERROR : "ActiveX component can't create object: 'VBUtils.Plugin'"
If you made a successful connection between your VB code and XSI, no error message appears in the History pane.