make money

jav online; jav streaming; 1pondo; caribbeancom; heyzo - tokyo hot

Award Winning Design Blog

MAXScript: Find Area of Circle

By on December 10, 2012 in Autodesk 3DS Max, MAXScript with 0 Comments

Here is a little script I whipped up in about 15 minutes last night out of pure laziness. My daughters homework was to find the area of a circle based on radius or diameter. There were quite a few problems and I didn’t want to have to do the calculations each time. So, I came up with this. Checking took no time!

fn getarea rad dia=
	if rad>0 then(
		local ar = (rad*rad)*3.14
		local r = (dia/2)
		local ar = (r*r)*3.14
	return ar
rollout areaFinder "area finder"
	spinner spn_radius "radius" range:[0,250000,0] type:#float enabled:false across:2
	checkbox chk_rad
	spinner spn_dia "diameter" range:[0,250000,0] type:#float enabled:false across:2
	checkbox chk_dia
	spinner spn_area "area" range:[0,250000,0] type:#float enabled:false across:2
	checkbox chk_area	
	button btn_go "go"
	edittext edit_rad "Radius: "
	edittext edit_dia "Diameter: "
	edittext edit_area "Area: "
		on chk_rad changed state do (
			if spn_radius.enabled==true then spn_radius.enabled=false else spn_radius.enabled=true
		on chk_dia changed state do (
			if spn_dia.enabled==true then spn_dia.enabled=false else spn_dia.enabled=true
		on chk_area changed state do (
			if spn_area.enabled==true then spn_area.enabled=false else spn_area.enabled=true
		on spn_radius changed val do
			local r = spn_radius.value
			local d = 0
			ans = getarea r d
			edit_area.text = ans as string
		on spn_dia changed val do
			local r = 0
			local d = spn_dia.value
			ans = getarea r d
			edit_area.text = ans as string
	on btngo pressed do

				)--end on
)--end rollout
try(destroyDialog areaFinder)catch()
createDialog areaFinder width:200

To install:

In 3DS Max select MAXScript > Editor
Paste the code
Press CTRL+E to execute
The Area will be updated by scrubbing either the radius or diameter spinners. You can also just type in a number.

Tags: , ,

About the Author

About the Author: Hi! I am currently an Autodesk Solutions Engineer working to deliver real time solutions to our Enterprise customers. I have been involved with industrial design software for nearly 15 years and am a 3DS Max Professional who is passionate about design visualization. .


If you enjoyed this article, subscribe now to receive more just like it.

Post a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.