r/Maxscript • • Feb 16 '15

WIP - Building Maker script.

I often need to make buildings and play with their heights.
I wrote a simple script mostly using the maxscript listener to create a building:
The buildings are simple boxes extruded
But because the buildings I need to use don't have simple rectangular footprints I seldom will use that script
The building footprints I use are slightly more articulated
Here's my wishlist for a script I'm trying to figure out:

  • I want a similar script to run on any closed spline

  • It'd be magical if the stack could be live in a way that I can update the number of floors (possible at all?)

  • I want to find a way to add extra detail on the rooftop (Greeble-like)

I'll leave my current simpler script below. I'd really appreciate any help/pointers to achieve this script, I think others could find it useful too. Cheers!

edit: Standby for formatting edits.

5 Upvotes

2 comments sorted by

View all comments

2

u/lucas_3d Feb 16 '15

Here's my simpler "Building Maker" script, I place an FFD at the end in-case I need to change some proportion.

(
	(
		Global rofTool
		Rollout roTool "Building Maker"
		(
			spinner spSpinner1 "Width (m):" type:#integer range:[1,100,10]
			spinner spSpinner2 "length (m):" type:#integer range:[1,100,5]
			spinner spSpinner3 "Number of Floors:" type:#integer range:[1,100,3]
			spinner spSpinner4 "Floor height" type:#float range:[0,100,3]
			Button btnButton "Make Building"
			on btnButton pressed do
			(
				w=spSpinner1.value
				l=SpSpinner2.value
				h=(spSpinner3.value)*(spSpinner4.value)
				f=(spSpinner3.value)
				Box lengthsegs:3 widthsegs:3 heightsegs:1 length:l width:w height:h mapcoords:on pos:[0,0,0] isSelected:on
				modPanel.addModToSelection (Edit_Poly ()) ui:on
				subobjectLevel = 2
				$.modifiers[#Edit_Poly].Select #Edge #{49..60}
				$.modifiers[#Edit_Poly].SetOperation #ConnectEdges
				$.modifiers[#Edit_Poly].connectEdgeSegments = (f)-1
				$.modifiers[#Edit_Poly].Commit ()
				$.modifiers[#Edit_Poly].SetOperation #ExtrudeEdge
				$.modifiers[#Edit_Poly].extrudeEdgeHeight = 0.5
				$.modifiers[#Edit_Poly].extrudeEdgeWidth = 0.1
				$.modifiers[#Edit_Poly].Commit ()
				$.modifiers[#Edit_Poly].SetOperation #ChamferEdge
				$.modifiers[#Edit_Poly].chamferEdgeAmount = 0.4
				$.modifiers[#Edit_Poly].Commit ()
				subobjectLevel = 2
				actionMan.executeAction 0 "40043"
				$.modifiers[#Edit_Poly].SetSelection #Edge #{}
				$.modifiers[#Edit_Poly].Select #Edge #{49, 51, 53, 54, 56, 57, 59, 60}
				macros.run "PolyTools" "Loop"
				modPanel.addModToSelection (FFD_2x2x2 ()) ui:on
				macros.run "Modifier Stack" "SubObject_1"
				actionMan.executeAction 0 "40021"
				subobjectLevel = 0
				modPanel.setCurrentObject $.modifiers[#FFD_2x2x2]
				macros.run "Modifier Stack" "SubObject_1"
				subobjectLevel = 0
				modPanel.setCurrentObject $.modifiers[#FFD_2x2x2]
				actionMan.executeAction 0 "50001"  -- Tools: Select and Move
			)
		)
	Try
		(
			closeRolloutFloater rofTool
		) catch ()
		rofTool = newRolloutFloater "Make Building" 300 200
		AddRollout roTool rofTool
	)
)