dotNet + MXS


Don’t help
– Runtime error: No constructor found which matched argument list: System.Runtime.Serialization.Json.DataContractJsonSerializer
– Unknown property: “ReadObject” in undefined


The class you are trying to instantiate does not have a constructor which accepts 0 arguments:


serializationJson = dotNetObject “System.Runtime.Serialization.Json.DataContractJsonSerializer” (dotnetclass “System.string”)


Thanks, maxscriptlaborer! But now I transfer my program to Python because it is more flexible and I have a little the next question:

I need rotate in XForm gizmo. But I can not do that, tell me what the problem is and how to rotate it? Thank you for your attention.

from Py3dsMax import mxs

for obj in mxs.objects:
     XForm = mxs.pyhelper.namify('XForm') #  set flag
     obj.modifiers[XForm].gizmo.rotation += mxs.quat(0.707107, 0, 0, 0.707107) #  rotate 90"


I solved the problem though not completely in Python. I would like to make it completely in Python.

mxs.addModifier(obj, mxs.XForm())
XForm = mxs.pyhelper.namify('XForm') #  set flag
mxs.execute('max modify mode')
mxs.execute('mod_obj = modPanel.getCurrentObject();gizmo_rotation = mod_obj.gizmo.rotation;mod_obj.gizmo.rotation += quat 0.707107 0 0 0.707107') #  rotate 90"


I’m a little late to the .NET revolution. And I couldn’t read 37 pages… so maybe this was already answered.

What I want to know is the best practice of building .NET UIs/Forms for MAXScript tools. Right now I’ve been scrounging around learning tidbits here and there. But I’m only finding examples of plopping .NET components into a MAXScript by typing out all the code manually.

What I’m getting at is that I’d like to build a UI for a tool where all the components are in .NET and I’m simply not familiar with the method of doing an entire MAXScript tool in .NET. Visuallzing the components is impossible with the MAXScript editor. I’m assuming you do this in Visual Studio… but I still have no clue where to begin in starting/managing a .NET > MAXScript process.

What is the best resource for getting someone with almost no .NET experience using Visual Studio to build MAXScript UIs? (In my mind, I’m hoping it is as simple as building components in an IDE like Flex/Flashbuilder for flash projects.) I need a mental bootstrap here.


I have some information on my (not updated in a really long time) blog that may be useful to you…

And I’d look at LoneRobot’s site for even more useful info…

Hope that helps.


Hey James, Thanks for the mention - I just wanted to point out the address is You’ll find loads of examples of integrating custom dotnet tools in 3dsmax.


Hey lonerobot,

Great tutorials. However letting you know that some of the images in those tuts (your older ones especially) are not showing up for me. Tried from home as well (hoping it was my office network) and they’re not showing up there either.

Here’s one of them:


Ack Pesky wordpress. I had some XMLRPC issues with my site recently so decided to swap it to Linux hosting package. I setup a WAMP server and tested my site offline and in migrating it back it appears that it has kept the image paths to the offline localhost.

The link has been fixed now. I’ll take a look at the site and track down any others but if you see any articles that are missing pictures, don’t hesitate to let me know.


Hi Guys,

Has anyone been able to figure out how to use the devExpress lookAndFeel in Max 2012 / 2013 without it causing an exception yet?

I’ve still not been able to get it working and I’ve pretty much exhausted their entire online documentation…

This code:

(dotNetObject "DevExpress.XtraTreeList.TreeList").lookAndFeel

Brings up this error:
– Runtime error: dotNet runtime exception: MethodInfo must be a runtime MethodInfo object.
Parameter name: method

But in Max 2011 and below it works perfectly… :curious:

I’ve tried almost every damn method on these objects/classes:

ulf = dotNetClass "DevExpress.LookAndFeel.UserLookAndFeel"
dlf = dotNetObject "DevExpress.LookAndFeel.DefaultLookAndFeel"
alfs = dotNetClass "DevExpress.LookAndFeel.ActiveLookAndFeelStyle"
lfs= dotNetClass "DevExpress.LookAndFeel.LookAndFeelStyle"
lfh = dotNetObject "DevExpress.LookAndFeel.LookAndFeelHelper"
sm = dotNetObject "DevExpress.Skins.SkinManager"

Anyone got any ideas? :argh:


it’s broken since max 2012. i couldn’t find a way to set lookAndFeel


Thanks for confirming my suspicions. That’s a real shame.

This seems to be a similar issue to the link below and the problems is incorrectly deployed DLL’s. I wonder if the error in Max is also a similar problem:



just one question that might seem simple but I don’t get it.

Try this code:

a = dotNetObject “System.Byte[]” 1
(dotNetClass “System.Array”).Resize &a 5

Gives me an error “No method found which matched the argument list”.
But it says Resize is static and has to pass a reference to the array and a size. Is the reference the problem and how might this be fixed?

Thanks in advance.


Maybe it is because “size” should be an object, i remember that color,size etc. in dotnot are objects. when a method requires an “size”, it requires an object which is the instance of class size. I dont know if this address your problem:-)


I want to choose date by mouseclick on the dotNet month calendar. But I don’t know how to do it.Can anyone help?


There’s a sample for this in the maxscript help

However, it doesn’t include the date bit. Here it is.

rollout test "test" height:200 width:220
dotNetControl f1 "MonthCalendar" align:#left height:180 width:200
on f1 mousedown val do
	format "DATE : %
" (f1.SelectionStart.tostring())

	format "Day : %
	format "Month : %
" f1.SelectionStart.month
	format "Year : %
" f1.SelectionStart.year

createdialog test escapeEnable:true


Actually I had found the “DateTimePicker” to solve my problem.
It give me the calender I want and can easily choose the date time.
However thanks a lot Pete.


I have problem with the dotNet background-worker-thread.
What I’m trying to do is simply replace the material in the active material-editor slot from a background-thread.
But whatever I do, every kind of update of the active slot results in some kind of infinite update loop until the background thread is stopped. After that the Material Editor doesn’t properly update the ui anymore until you close and open it again.

What I’ve found out so far:

  • temporarily making another slot active hangs as well

  • changing the other slots is no problem

  • trying to hide the material Editor with MatEditor.Close()
    doesn’t close it but seems to disable any updating of editor UI
    so the changes get made without hanging but you can’t see them until you manualy close and reopen the editor

  • calling MatEditor.Open() after MatEditor.Close() crashes max

Here is a stripped down version to illustrate the problem:

fn BackgroundWorkerTest theSender theEvent = 
 	print "BackgroundWorker running"
 	slot = medit.GetActiveMtlSlot()
 	-- SCENARIO 1 - this will hang
 	meditmaterials[slot] = standardMaterial()
 	-- SCENARIO 2 - this will hang
 	--medit.SetActiveMtlSlot (slot + 1) False 
 	-- SCENARIO 3 - setting inactive slot > this works
 	--meditmaterials[slot + 1] = standardMaterial()
 	/* SCENARIO 4 - disables proper refreshing of the Editors UI
 	meditmaterials[slot] = standardMaterial()
 	/* SCENARIO 5 - autocrash
 	print "BackgroundWorker stopped"
 BackgroundWorker = DotNetObject "System.ComponentModel.BackgroundWorker"
 DotNet.AddEventHandler BackgroundWorker "DoWork" BackgroundWorkerTest
 BackgroundWorker.WorkerSupportsCancellation = true


3ds Max is not a thread safe program, and all UI updates must take place in the main thread with the UI temporarily paused. Many functions in Max when executed with a background worker will cause Max to crash or become very unstable/unpredictable.

If you have some intensive calculations before a UI update, you can safely use the ‘DoWork’ event. Once this has been completed it fires the ‘RunWorkerCompleted’ event which is executed in the main thread, temporarily pausing the max UI. Use the ‘RunWorkerCompleted’ for any UI updates.

Also, try using this worker instead as it is more stable with Max. There was an article on lonerobot about it:

dotNetObject "CSharpUtilities.SynchronizingBackgroundWorker"