dotNet + MXS


you are doing everything right. the problem is that you are using TreeView from your class to create dotnetcontrol. Max always uses object from first loaded assembly to create are recompiling and reloading the assembly, but max still using the first one

if you will use dotnetobject instead of dotnetcontrol, you will see the difference.


Sorry, I’m still unable to make it work :frowning:

try(destroyDialog theRollout)catch()
 Testdll = "C:/Testdll.dll"
 local assembly = (dotNetClass "System.Reflection.Assembly").Load ((dotNetClass "System.IO.File").ReadAllBytes Testdll)
 local myClass = assembly.CreateInstance "TestNamespace.TreeView"
 rollout theRollout "Test" width:600 height:600
        local maxForm = dotNetObject "MaxCustomControls.MaxForm"
 	local myClass = dotNetObject "TestNamespace.TreeView"
 	on theRollout open do
		maxForm.controls.add myClass
 createDialog theRollout

I was hoping to create a 3dsMax rollout, embed a custom .NET TreeView and still keep the ability to re-compile the custom dll and NOT have to restart 3dsMax every time I re-build.

Am I missing something?



it should be something like:

try(maxForm.close()) catch()
	Testdll = "C:/Testdll.dll"
	assembly = (dotNetClass "System.Reflection.Assembly").Load ((dotNetClass "System.IO.File").ReadAllBytes Testdll)

	global maxForm = dotNetObject "MaxCustomControls.MaxForm"
	myTreeView = assembly.CreateInstance "TestNamespace.TreeView"
	maxForm.controls.add myTreeView


Thanks Denis. I’m happy with getting it working in a .NET form and your code is perfect, BUT I was trying to get this functionality of dynamically re-loading the custom dll, so that the DotNetObject could be placed inside of a standard 3dsMax “rollout” UI. The issue seems to be that we rely on the “DotNetControl” wrapper to allow integration into the 3dsMax UI.

I was wondering if there is anyway around this issue, so I can have the best of both worlds…A dynamically re-loading dll which provides my custom Treeview AND the standard functionality of a 3dsMax “rollout” for UI design?

Is this possible? or am I committed to using MaxForm if I need to avoid using DotNetControl, so that I can “re-load” my assembly?

Hope this makes sense!



in this case it has to be:

 try(destroydialog dialog) catch()
 rollout dialog "My TreeView" width:200 height:200
 	Testdll = "C:/Testdll.dll"
 	assembly = (dotNetClass "System.Reflection.Assembly").Load ((dotNetClass "System.IO.File").ReadAllBytes Testdll)
 	dotnetcontrol panel "MaxCustomControls.MaxUserControl" width:190 height:190 pos:[5,5]
 	on dialog open do
 		myTreeView = assembly.CreateInstance "TestNamespace.TreeView"
 		myTreeView.Dock = myTreeView.Dock.Fill
 		panel.controls.add myTreeView
 createdialog dilaog

creating a dotnet object you can specify what assembly you want to use (just loaded in your case).
MAX loads dotnet control using first loaded assembly, and there is no way to change this behavior.


did anyone has a luck to get “ManagedServices.MaxSpinner” works or shows?


I’ve not had success with this either. Am I able to load in the DLLs with this method, and for examaple, say

  	 Testdll = ((pathConfig.GetDir #MaxData)+"Scripts\	urboTools\\FreeImageNET.dll")
  	dllMain = ((pathConfig.GetDir #MaxData)+"Scripts\	urboTools\	urboTools.BitmapUsage.dll")
  	 assembly = (dotNetClass "System.Reflection.Assembly").Load ((dotNetClass "System.IO.File").ReadAllBytes Testdll)
  	mainLoad = (dotNetClass "System.Reflection.Assembly").Load ((dotNetClass "System.IO.File").ReadAllBytes dllMain)
  	   test  = mainLoad.CreateInstance  (dotnetobject "turboTools.BitmapUsage.form1")


Hi Denis, I asked about this class on the Area SDK blog when they released the managed services dll. I was trying to find out how to develop classes using managedservices/dll without having to restart max each time (effectively bypassing the build error you get in VS)

but he did answer the question about maxspinner -


i can’t say that has cleared the picture… thanks anyway. at least i know that i’m not the only one who puzzled.


ha, yes. Answered enough to say to me “don’t pursue this any longer”


Hi guys!
Does anybode figured out solution how to use dotnet for drawing in viewports?
I guess the way is create dialog that will flow viewport’s position and size.



Does anyboday meet dotnet cant read txt file with chinese character question ~?

Here is my maxscirpt:

 Txtfile="c:\\123.txt"  ---pls put 123.txt to your c:\ then can test this maxsciprt.
 if ((dotNetclass "System.IO.File").Exists Txtfile)
 then ( 
		  encodingClass = dotNetClass "System.Text.Encoding"
		  encoding = encodingClass.GetEncoding "GBK"
		  file =dotnetobject "System.IO.StreamReader" Txtfile encoding
		  runfile = file.ReadLine()
  else(messagebox "need Txtfile";return())
  print runfile 

It’s empty when I print out the runfile, becuase some chinese character in the txtfile.
Ok, Let me upload the 123.txt , anybody can help me to test it.



Use Default property.


Has anybody been able to figure out how to fix this?

Shame that the default UI for the devexpress tools is so ugly…


it was not bad at the time of design. but it became very quickly… how to say… outmoded.
my point is that a tool has to be in the latest fashion… and it’s not a matter of discussion is the current fashion nice or ugly.


Yeah the fact that I said it’s ugly is just my opinion, but the user should still be able to customise the appearance. At the very least the default appearance should be set to mimic the 3ds max UI for some consistency. I was trying to get the lookAndFeel property to work last night but was unable to do so. Not sure what else I can try to get this working.

I still think the default devExpress UI design is ugly :wink:


well, stop playing up… :slight_smile:


Hi everyone :smiley:

This can be usefull :wink:


Why error? - Runtime error: dotNet runtime exception: Non-static method requires a target. line - serializationJson.ReadObject memStream


jsonData = “{“action”:“read”,“type”:“sequence”,“data”:[]}”

dotnet.loadAssembly “C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.Runtime.Serialization.dll”

ascii_encoder = dotNetObject “System.Text.ASCIIEncoding”
encodedPostParams = ascii_encoder.GetBytes ( jsonData as string )
memStream = dotNetObject “System.IO.MemoryStream” encodedPostParams

serializationJson = dotNetClass “System.Runtime.Serialization.Json.DataContractJsonSerializer”
serializationJson.ReadObject memStream


I think you have to create an object instance, like this:

serializationJson = dotNetObject “System.Runtime.Serialization.Json.DataContractJsonSerializer”

instead of trying to access its static method:

serializationJson = dotNetClass “System.Runtime.Serialization.Json.DataContractJsonSerializer”