New Measure Distance Tool

1 vote
Version: 
1.3
Date Updated: 
06/01/2009

A macroscript tool for measuring the distance between 2 objects. Creates a feedback window giving the distance between 2 mouse click. Stays open allowing you to continue measuring until you're done. The most user-friendly method, better than the Tape Measure Helper or the Measure Distance tool. As a macroscript, once installed, it's fast and easy.

Additional Info: 

unzip the macro and place it in your macroscripts folder (typically: C:\Program Files\Autodesk\3ds Max XXXX\UI\MacroScripts). You'll find the macro under "DAS Tools" when you go to "Customize\Customize User Interface\Toolbars\Category: All Commands".Place the macro on any toolbar. If you are not familiar with loading macroscripts see the max help regarding Customizing the User Interface. The script will prompt you to click in the viewport to declare the beginning of the measurement. If that point is registered you'll be prompted to click a second location after which a dialog will pop up showing you the distance between the 2 clicks. You'll be prompted to contiue measuring more points or exit.

Version Requirement: 
tested with max 2008 and up

Comments

Comment viewing options

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

-- A new version of measure

-- A new version of measure disatance tool that works
-- VERSION 1.1   6/2009
--   2.5D 捕获模式 任意2点间距 --
-- MacroScript DAS_NewMeasureTool    ButtonText:"New Measure Tool"	   Category:"DAS Tools" 	Tooltip:"DAS New Measure Tool"
(	
	execute
	(
 
		global pp1 = undefined
		global pp2 = undefined
		global dd = undefined
		global Unittxt = ""
		global ddAdj = 1
		global bmapG = bitmap 200 39 color:green
		global bmap = bitmap 200 39 color:[200,200,200]
 
		     (----------	扑捉点开
			  snapMode.type = #2_5D
			  SM = snapmode.active
	          if ( SM == true and snapmode.type != undefined ) do ( ST = snapmode.type )
			  SMV = snapmode.getOSnapItemActive 7 1  
		      snapmode.setOSnapItemActive 7 1 true    -- (7)  (1-6)==顶点、端点、边/线段、中点、面、中心面 
		      snapmode.active = true
			 ) 
 
		rollout NM "Distance"
		(
 
			button agn "Again" images:#(bmap,undefined,1,1,1,1,1) width:200 height:50 offset:[-1,-10]enabled:false border:false
			label lb1 "Pick 1st Point" offset:[0,-45]
 
			on NM open do
			(
				case of -- SET UP UNITS DECLARATION 
				(
					(units.SystemType == #inches): 
					(
 
						if units.DisplayType == #US then
						(
							case of -- inches to feet compensation if Display type is feet 
							(
								(units.USType == #Frac_In): (ddAdj = 1 ; Unittxt = " inches")
								(units.USType == #Dec_In): (ddAdj = 1 ; Unittxt = " inches")
								(units.USType == #Frac_Ft): (ddAdj = 12 ; Unittxt = " ft.")
								(units.USType == #Dec_Ft): (ddAdj = 12 ; Unittxt = " ft.")
								(units.USType == #Ft_Frac_In): (ddAdj = 12 ; Unittxt = " ft.")
								(units.USType == #Ft_Dec_In): (ddAdj = 12 ; Unittxt = " ft.")
								default: (ddAdj = 1 ; Unittxt = " inches")
							)
						)
					)
					(units.SystemType == #feet):  Unittxt = " ft."
					(units.SystemType == #miles): Unittxt = " miles"
					(units.SystemType == #millimeters): Unittxt = " mm"
					(units.SystemType == #centimeters): Unittxt = " cm"
					(units.SystemType == #meters): Unittxt = " meters"
					(units.SystemType == #kilometers): Unittxt = " km"
					default: Unittxt = ""
				)
 
 
 
 
				pp1 = pickPoint prompt:"Pick the 1st point" snap:#3D
				if classOf pp1 == Point3 then 
				(
					agn.images =  #(bmapG,undefined,1,1,1,1,1)
					lb1.text = "Pick 2nd Point"
					pp2 = pickPoint prompt:"Pick the 2nd point" snap:#3D rubberband:pp1
					if classOf pp2 == Point3 then
					(
						dd = (distance pp1 pp2)/ddAdj
						ddtxt = dd as string
						NM.width = (ddtxt.count + Unittxt.count) * 7
						lb1.text = (dd as string + Unittxt)
						agn.images = #(bmap,undefined,1,1,1,1,1)
						if querybox ("Distance: " + dd as string + Unittxt + "  Try Again?") title:"Distance" then 
						(
							DestroyDialog NM
							createDialog NM 90 24 100 100 escapeEnable:true
						)
						else DestroyDialog NM
						--agn.enabled = true
					)	
					else 
					(
						--lb1.text = "Invalid Entry"
						DestroyDialog NM -- Get rid of it and re-open to initialize in case you want to continue to measure things
						createDialog NM 90 24 100 100 escapeEnable:true -- hides error warning when pick is not a point 3
					)
				)
				else -- exit the script if "Esc" or R-Click before 1st point is chosen
				(
					--lb1.text = "Invalid Entry"
					DestroyDialog NM
					--createDialog NM 90 30 100 100 escapeEnable:true
				)
		-- 		case of -- ANOTHER WAY OF DOING IT ALLOWING FOR DIFFERENT FUNCTIONS BASED ON KEY PRESS, ETC
		-- 		(
		-- 			(pp1 == undefined): DestroyDialog NM
		-- 			(pp1 == #rightClick): DestroyDialog NM
		-- 			(classOf pp1 == Point3): 
		-- 				(
		-- 					--pp1txt = pp1 as string
		-- 					--NM.width = pp1txt.count * 7
		-- 					lb1.text = "Pick 2nd Point"
		-- 					
		-- 					pp2 = pickPoint prompt:"Pick the 2nd point" snap:#3D rubberband:pp1
		-- 					case of
		-- 					(
		-- 						(pp2 == undefined): DestroyDialog NM
		-- 						(pp2 == #rightClick): DestroyDialog NM
		-- 						(classOf pp2 == Point3): 
		-- 							(
		-- 								--lb1.text = pp2 as string
		-- 								dd = distance pp1 pp2
		-- 								ddtxt = dd as string
		-- 								
		-- 								NM.width = (ddtxt.count + Unittxt.count) * 7
		-- 								lb1.text = (dd as string + Unittxt)
		-- 							)
		-- 						(classOf pp2 == String): 
		-- 							(
		-- 								lb1.text = "Invalid Entry"
		-- 								DestroyDialog NM
		-- 								createDialog NM 90 30 900 200 escapeEnable:true
		-- 							)
		-- 						default: DestroyDialog NM
		-- 					)		 		
		-- 					pp1 = undefined
		-- 					pp2 = undefined
		-- 					dd = undefined					
		-- 				)
		-- 			(classOf pp1 == String): 
		-- 				(
		-- 					lb1.text = "Invalid Entry"
		-- 					DestroyDialog NM
		-- 					createDialog NM 90 30 900 200 escapeEnable:true
		-- 				)
		-- 			default: DestroyDialog NM
		-- 		)
			)
		-- 	on agn pressed do -- RE-INITIALIZE
		-- 	(
		-- 		DestroyDialog NM
		-- 		createDialog NM 90 24 100 100 escapeEnable:true
		-- 	)
 
		)
		createDialog NM 90 24 100 100 escapeEnable:true --style:#(#style_toolwindow)
 
		     (----------	扑捉点关
			  snapMode.type = #3D
	          snapmode.active = SM
	          if ( SM == true and ST != undefined ) do ( snapmode.type = ST )
	          snapmode.setOSnapItemActive 7 1 SMV
			 ) 
 
	)
)
 
 
/**
(  --  切换捕获模式 --
	if not snapMode.active then
		snapMode.active = on
	else case snapMode.type of
	(
		#2D : snapMode.type = #2_5D
		#2_5D : snapMode.type = #3D
		#3D : snapMode.type = #2D
	)
)
**/
Kurai's picture

Please Improve

This is much better than the Max helper because I don't have to keep deleting the lines when I've finished... which is annoying. I hope you can improve this tool so it mimics Sketchup tapemeasure.... it would be create if you could add constructions lines too.

This tool is a BIG help.... :)

Digital Animation Services's picture

Thanks barigazy. I'll look

Thanks barigazy. I'll look into that when I have a few minutes.

barigazy's picture

Very nice tool. Nice and

Very nice tool. Nice and simple.
Why the rollout change size (shrink) when shows distance.
Can you create also simple script (not macro)?
Put this at the and to reduce roll size a bit:

createDialog NM 90 24 100 100 escapeEnable:true \
style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

bga

Comment viewing options

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