Notifications
Clear all

[Closed] BackgroundWorker

Hi there

I made a post about the pause of a spinner while increasing a global value and i taught that the dotNet “System.Timers.Timer” was the answer for this problem , but lo said that it is not possible.

Now my question is , can dotNet BackgroundWorker be an answer for the question ? or using the another thread ?
Here in the example below i have a global value ” posval ” and a spinner which changes the posval value and i have a simple function which will repeat in each timer ticks ,

Now i like to know is it possible to put the increasing or decreasing posval in a thread or BackgroundWorker and the fuction on another thread and solve the pause problem ?
here it is the very simple snip and what am i looking for:

	rollout test_ "***"
	(
		global posval = 0
		fn create_Box =		(	box pos:[posval,0,0]	)	
				
		timer clock active:off interval:10
		spinner pos_sp "Bx_pos"	range:[-1000,1000,0]
		checkbutton 'Goo' "GO"  width:50 height:48 highlightColor:(color 255 85 85) align:#left		

		on pos_sp changed val do ( posval = val )
		
		on Goo changed state do
		(			
		if state == on then (clock.active = true )
		else (clock.active = false)
		)
			
		on clock tick do	(		create_Box()		)

	)
	
CreateDialog test_ 100 80	

Thanks in advance

2 Replies

It’s crashing because you’re trying to rotate an object from a background thread which is a big nono in 3dsmax.

There’s nothing to add here.

OK

Sorry if the question looks silly,I don’t know much about dotnet, But how about this :

Is it possible to put just the changing value (spinner and the global value) to a different thread not the main function ? Is this the same as lo said?