Notifications
Clear all

[Closed] Can Maxscript use dotnet Threading?

Can Maxscript use dotnet Threading?

I try the code like this. but it’s not work.



fn createbox =
(
	for a = 1 to 50 do
	(
		for b = 1 to 50 do
		(
			bb=box()
			bb.pos=[a*50,b*50,0]
			bb.wirecolor=green
		)
	)
)

ts=DotNetObject "System.Threading.ThreadStart" createbox
th=DotNetObject "System.Threading.Thread" ts

th.Start()



4 Replies

yes, you can search for examples here. The problem is that max will crash if you change objects in the viewport(?) from a separate thread.

plastic: check this http://lonerobot.net/?p=50

如果你是中国人,可以看这个
http://www.cnblogs.com/sitt/archive/2011/08/31/2160609.html
有问题可以发邮件给我

sorry my english very poor



Fn BackgroundWorkerDoWork theSender theEvent = while not theSender.CancellationPending do print (random [0,0,0] [100,100,100])
BackgroundWorker = DotNetObject "System.ComponentModel.BackgroundWorker"
DotNet.AddEventHandler BackgroundWorker "DoWork" BackgroundWorkerDoWork 
BackgroundWorker.WorkerSupportsCancellation = true -- enabled can stop
BackgroundWorker.RunWorkerAsync() -- start
BackgroundWorker.CancelAsync() -- stop