[Closed] New Article on LoneRobot.com – Calling Maxscript Functions from DotNet
Hello peeps,
just posted a new article on my site detailing the inclusion of new methods in the dotnet SDK for r2010. I hope it is of interest! It is now possible to call maxscript functions directly from a Dotnet assembly to be used in max. It’s a great addition. To demonstrate this, i wrote a Maxscript browser that runs and loads scripts – its an inherited treeview and all of the handling code is in the assembly, you just plonk it on a rollout and it runs the scripts from DotNet!
Just added some more info I found out – you can use this new class to retrieve the max UI colors so that your custom control will match the light or dark UI scheme that you have going on – A bit like how the maxform class does it – This was the same minimal code, just with the control placed on the rollout –
Dude! That’s really cool!
Can I ask why you’re not using c# but vb? I ask mainly because I’m learning c# and don’t feel like learning vb
Again, this info will be invaluable in the time to come, thanks for sharing so much!
-Johan
Reading over your code a bit better I notice “ExecuteFloatMaxscriptQuery” does that mean, executing a maxscript command and retreiving whatever output it generates, float I guess, in this example and retreiving that info back in dotnet?
Just downloaded Red Gate’s .Net Reflector and opened ManagedServices.dll, real nice! All sorts of querytypes. That’s one handy tool! I’m getting more excited with .Net everyday… maybe I’ll even stop my python endevours…
I’m waiting for the moment we can edit maxObjects like spline and editpoly in dotnet.
Just a note maybe you can create your sample scripts like this
(
local assembly = getFilenamePath (getSourceFileName()) + "MXSDotNet"
dotnet.loadassembly assembly
rollout MXSviaDotNet "MXSviaDotNet" width:419 height:548
(
dotNetControl MaxTV "MXSDotNet.MXSBot" pos:[0,0] width:420 height:546
)
createdialog MXSviaDotNet
)
That way you can run it from anywhere… like the desktop, which looks just as messy as my desk offcourse…
Real cool stuff!
-Johan
Hi Johan,
sorry about the code path, that was just me being lazy and posting my code. I’ll update it in future.
As for the C#/VB thing, I’m not a programmer, so VB was easier for me to pick up. They are similar so I can understand C# but as it’s all part of the framework, the properties and methods are the same. I just find VB easier to read and understand.
All the methods are listed in my article, and im getting some success in using them Currently i am registering a Maxscript function via the assembly and using the dotnet query commands to get the return value. I don’t know if im doing that wrong so have asked Chris D at the area for clarification. There is a method relating to color but i dont know how to get it working. However, my current method of getting the RGB values as integers does at least work! If you were worried about an assembly creating lots of globals then you can use executemaxscriptcommand to set the function variable to undefined at the end of the dotnet assembly call.