Update grid align to view

Hello everybody, can you help me to make a script to:
I create a grid helper in max 2010,select the grid objetc, right click and align to view, but when you rotate the viewport you must select again "align to view".. the script must update automatically the grid alignment to viewport rotations.. really thanks for your help.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

there is another version ;)

there is another version ;) (script attached)

AttachmentSize
Align_2_View.ms 1.05 KB
Align_2_View_v2.ms 1.16 KB

my recent MAXScripts RSS (archive here)

Graph's picture

have phun ( -- -- -- -- --

have phun

(
	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
	-- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- 
	--      --      --      --      --      --      --      --      --      
	---  brought --- to --- you --- by --- IN-Tools.biz --
	--      --      --      --      --      --      --      --      --      
	-- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- 
	-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
 
	rollout grid2View "Align 2 View"
	(
		group ""
		(
			pickbutton pickGrid "Pick Object" width:(grid2View.width - 20) height:28 autoDisplay:true
 
			timer clock active:false
			spinner clockSpeed "Refresh Rate (s)" type:#Integer range:[1,60, 3] width:(grid2View.width - 20) align:#left
		)
 
		button start "Start Sync" width:(grid2View.width - 10) height:32 enabled:false
 
		on pickGrid picked obj do
		(
			if isValidNode obj do
			(
				start.enabled = true
			)
		)--END obj.picked
 
		on start pressed do
		(
			if pickGrid.object != undefined do
			(
				if isValidNode pickGrid.object do
				(
					clock.interval = clockspeed.value * 1000
					clock.active = true
				)
			)
		)--END start.pressed
 
		on clock tick do
		(
			if isValidNode pickGrid.object then
			(
				local viewTM = inverse (viewport.getTM())
 
		 		local pos = pickGrid.object.pos
 
				local nuTransform = viewTM
 
				nuTransform.row4 = pos
 
				pickGrid.object.transform = nuTransform
			)
			else
			(
				clock.active = false
				start.enabled = false
				pickGrid.object = undefined
			)
		)--END clock.tick
	)--END RO
	createDialog grid2View	
)

Raphael Steves

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.