Notifications
Clear all

[Closed] Setting options on AlignTools through MaxScript – Possible?

I often find myself having to switch from “Center” to “Pivot” on the Align Selection tool i 3dsMax, even though I (almost) never use the “Center” option. Here’s a screenshot of the tool I’m talking about:
AlignTool

I was wondering if there’s exposed some functionality in MaxScript that lets me switch from “Center” to “Pivot”? It would be great if I could change the position and rotation also, but it’s primarily the “Center” that bothers me

Just on a sidenote, does anyone know why this keep happening? It would be interesting to know

1 Reply

I’m not sure that it will work with the newer max versions, but hope you get the idea. Tested it on 2014.

-- macroScript macroName
-- category:"macroCategory"
-- tooltip:"Align Selection by Center"
(
	global catchAlignSelectionDialog
		
	fn catchAlignSelectionDialog = 
	(

		local hwnd = DialogMonitorOPS.GetWindowHandle()

		if hwnd != undefined do
		(		
			local data = windows.getHWNDData hwnd
			
			if data[4] == "#32770" and MatchPattern data[5] pattern:"Align*" do
			(
				for c in windows.getChildrenHWND data[1] where c[5] == "Center" do
				(				
					windows.sendMessage c[1] 0x21 0 0
					windows.sendMessage c[1] 0x201 1 0
					windows.sendMessage c[1] 0x202 1 0
				)
				
			)
			
		)
		
		if toolMode.CommandMode != #pick do
		(		
			DialogMonitorOPS.UnRegisterNotification id:#alignDialog
			DialogMonitorOPS.enabled = false
		)

		true
	)


	DialogMonitorOPS.UnRegisterNotification id:#alignDialog
	DialogMonitorOPS.RegisterNotification catchAlignSelectionDialog id:#alignDialog

	actionMan.executeAction 0 "40113" -- Align Selection
	DialogMonitorOPS.Enabled = true

)