[Closed] Get COM object in mxs and dotnet
I want to access a COM object in 3ds Max (not the one shown in the example below).
In python we can do it like this:
import win32com.client
maxcom = win32com.client.Dispatch("Max.Application.14")
maxcom._FlagAsMethod("myRegisteredOLEFunction")
maxcom.myRegisteredOLEFunction()
Any idea how to get a COM object using maxscript? Maybe a hint in the right direction? I’ve found a dotnetClass called “System.__ComObject” but I don’t know if and how I could use that yet.
Cheers
I didn’t find a way of doing this – the only way I could do it was to write a wrapper class in .net to get access to the properties via interop. You can then use the wrapper object via MXSdotnet.
Hey Pete, thanks for your answer. In fact I tried that method shortly after, as I was provided with an interop .dll that gave me access to the COM objects via dotnet in mxs.
What turned out to be very helpful in the process was the script in the mxs docs that prints out the contents of a loaded dotnet assembly (see MXS documentation:
MAXScript Tools and Interaction with 3ds Max > DotNet In MAXScript > The MaxCustomControls Assembly > ), because the access by name is different than going the python route.
Cheers
Just found out that a simple command can be used to get the COM object as well in mxs:
myCOMObject = createOLEObject "CAT.MyClass"
Calling show/showMethods/showInterface returns nothing useful though, so you have to know what to do with it.