Walls with dimensions name?

I spend a lot of time creating walls, measuring and renaming. I just wanted to create lines in top view and execute a command that adds 10 Outline 320 extrude mesuare the length of the line i created and rename object:
"Wall X, 10, 320" are the values that I use most.
(if there is a text box that I could imput all value and create, would be perfect, but it would probably be hard to create, I think)
thanks guys

Comments

Comment viewing options

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

Walls creation

Hi Mr.barigazy
Can u please help me in creating a script which creates walls based on spline
these walls need to be such that if they get divided by rooms they should automatically create floors for those newly created rooms just like Chief Architect software
hope you understood what am trying to say
they should detect intersection and if they get closed into a room the floors and moldings should get created automatically

AttachmentSize
walls.png 513.26 KB

Sharath pawar

Gabriel Corazza's picture

Update?

Please can anyone do a update, i export the sp line to autocad after than, but i cant find the line in project. anyone can make the sp line go down after walls created, the walls stay on 0 and sp line on -10? Its possible? Thank so much!!

barigazy's picture

...

What's new:
Extrude props: Segs, Map Coords, Caps
Shell props: Segs, Autosmooth, Override Inner - Outher - Edge Mat ID
(always use the form "number-number-number" ei. "1-2-3" or "3-2-1" or ...)
Auto multimaterial (for edge-shell mode) with tree custom diffuse colors
Convert selected shapes to spline shapes

After all of this at least can you post it in "Scripts" section.
Maybe someone else can find this tool also useful.

bga

Michele71's picture

Yes, it appears complete and

Yes, it appears complete and useful :D

It was great fun to compare the ideas for the realization of this script and I have learned a lot ;)

In the day we'll post it in the script section, but if you have time, you can do it!!

Hi Branko!

barigazy's picture

...

Ok I fixed the code :) I not test this.

try (destroyDialog ::create_wall) catch()
rollout create_wall "Create Quick Wall"
(
	local walls = #()
	fn filterLine shape = isKindOf shape SplineShape or isKindOf shape Line
 
	group "Wall Name ..." 
	(
		edittext et_wallname "" pos:[5,25] width:135 height:17 text:"Wall"
		colorPicker cp_wire "" color:[61,135,6] pos:[138,25] width:15 height:17
		checkbox cb_unique "Use Unique Name" pos:[10,45]
		checkbox cb_random "Randomize Each Color" pos:[10,65]
	)
	group "Wall Params ..." 
	(
		radiobuttons rb_mode "Mode:" labels:#("Outline-Extrude", "Extrude-Shell") pos:[10,110]
		spinner spn_outline "Outline   =  " range:[-1e5,1e5,10] type:#worldunits pos:[11,160] fieldwidth:70
		spinner spn_extrude "Extrude  =  " range:[-1e5,1e5,320] type:#worldunits pos:[10,180] fieldwidth:70
		spinner spn_extsegs "E - Segs  =  " range:[1,1e2,1] type:#integer pos:[10,200] fieldwidth:70
		checkbox cb_extsmooth "Smooth" pos:[10,220] width:60 checked:on
		checkbox cb_mapcoords "Map Coords" pos:[72,220] checked:on
		checkbox cb_capE "Cap End" pos:[10,240] width:60
		checkbox cb_capS "Cap Start" pos:[72,240]
 
		checkbox cb_extrude "Instance Extrude Modifier" checked:on pos:[10,260]
		spinner spn_shellin "Shell In   =  " range:[0,1e5,5] type:#worldunits pos:[10,280] fieldwidth:70 enabled:off
		spinner spn_shellout "Shell Out = " range:[0,1e5,5] type:#worldunits pos:[11,300] fieldwidth:70 enabled:off
		spinner spn_shellsegs "S - Segs  =  " range:[1,1e2,1] type:#integer pos:[10,320] fieldwidth:70 enabled:off
		checkbox cb_shellsmooth "Smooth" pos:[10,340] width:60 checked:on enabled:off
		spinner spn_smooth "" range:[0,180,45] pos:[69,340] fieldwidth:70 enabled:off
		checkbox cb_ids "In - Out - Edge MatID" checked:on pos:[10,360] enabled:off
		edittext et_matid "" pos:[5,380] width:100 height:17 text:"1-2-3" enabled:off
		colorPicker cp_in "" color:red pos:[105,380] width:15 height:17 enabled:off
		colorPicker cp_out "" color:green pos:[120,380] width:15 height:17 enabled:off
		colorPicker cp_edge "" color:blue pos:[135,380] width:15 height:17 enabled:off 
		checkbox cb_mat "Auto Multi-Sub Material" pos:[10,400] enabled:off
		checkbox cb_shell "Instance Shell Modifier" checked:on pos:[10,420] enabled:off
		button btn_convert "Convert To Spline" pos:[10,440] width:140 height:18
		button btn_reverse "Reverse Knots Order" pos:[10,460] width:140 height:18
		button btn_delete "Delete Walls" pos:[10,480] width:140 height:18
	)
	button btn_create "Create W A L L S !" pos:[4,506] width:152 height:30
	on rb_mode changed state do 
	(
		if state == 1 then 
		(
			spn_outline.enabled = on
			spn_shellin.enabled = spn_shellout.enabled = spn_shellsegs.enabled = cb_shell.enabled = cb_capS.checked = cb_capE.checked = off
			cb_shellsmooth.enabled = cb_ids.enabled = spn_smooth.enabled = et_matid.enabled = cb_mat.enabled = off
			cp_in.enabled = cp_out.enabled = cp_edge.enabled = off
		)
		else 
		(
			spn_outline.enabled = off
			spn_shellin.enabled = spn_shellout.enabled = spn_shellsegs.enabled = cb_shell.enabled = cb_capS.checked = cb_capE.checked = on
			cb_shellsmooth.enabled = cb_ids.enabled = cb_mat.enabled = on
			if cb_shellsmooth.checked then spn_smooth.enabled = on else spn_smooth.enabled = off
			if cb_ids.checked then et_matid.enabled = on else et_matid.enabled = off
			if cb_mat.checked then cp_in.enabled = cp_out.enabled = cp_edge.enabled = on else  cp_in.enabled = cp_out.enabled = cp_edge.enabled = off
		)
	)
	on cb_shellsmooth changed state do spn_smooth.enabled = state
	on cb_ids changed state do et_matid.enabled = state
	on cb_mat changed state do (cp_in.enabled = cp_out.enabled = cp_edge.enabled = state)
	on btn_convert pressed do if selection.count == 0 then messagebox "Select Shape Object" title:"Warning" beep:off else
	(
		with redraw off (for sp in selection where not filterLine sp do convertToSplineShape sp)
	)
	on btn_reverse pressed do if selection.count == 0 then messagebox "Select Shape Object" title:"Warning" beep:off else
	(
		with redraw off
		(
			for sp in selection where filterLine sp do 
			(
				integer = numSplines sp
				number = if (e = getSplineSelection sp).count == 0 then (#{1..numsplines sp} as array) else e
				for n in number do reverse sp n
			)
		)
	)
	on btn_delete pressed do (delete (for node in walls where isValidNode node collect node) ; free walls)
	on btn_create pressed do if selection.count == 0 then messagebox "Select Shape Object" title:"Warning" beep:off else
	(
		if et_wallname.text == "" then messagebox "Enter Some Name" title:"Warning" beep:off else
		(
			if GetCommandPanelTaskMode() != #create do setCommandPanelTaskMode #create
			node = (Extrude amount:spn_extrude.value segs:spn_extsegs.value capStart:cb_capS.checked capEnd:cb_capE.checked smooth:cb_extsmooth.checked mapcoords:cb_mapcoords.checked)
			modifier = if rb_mode.state == 2 do 
			(
				array = #(1,2,3)
				if cb_ids.checked do
				(
					if et_matid.text == "" then et_matid.text = "1-2-3" else
					(
						if (e = FilterString et_matid.text " - ").count != 3 then (et_matid.text = "1-2-3") else
						(
							if (e = for s in e where (number = s as integer) != undefined collect number).count != 3 then et_matid.text = "1-2-3" else array = #(e[1], e[2],e[3])
						)
					)
				)
				Shell innerAmount:spn_shellin.value outerAmount:spn_shellout.value Segments:spn_shellsegs.value straightenCorners:on \
				overrideInnerMatID:cb_ids.checked matInnerID:(array[1]) overrideOuterMatID:cb_ids.checked matOuterID:(array[2]) overrideMatID:cb_ids.checked matID:(array[3]) \
				autosmooth:cb_shellsmooth.checked autoSmoothAngle:spn_smooth.value
			)
			material = if rb_mode.state == 2 and cb_mat.checked do
			(
				color = #(cp_in.color, cp_out.color, cp_edge.color)
				Multimaterial materialList:(for i = 1 to 3 collect standard diffuse:color[i])
			)
			with redraw off
			(
				for sp in selection where isKindOf sp shape do 
				(
					shape = copy sp name:(if cb_unique.checked then uniquename et_wallname.text else et_wallname.text) \
					wirecolor:(if cb_random.checked then (random black white) else cp_wire.color)
					append walls shape
					if spn_outline.value != 0 and rb_mode.state == 1 do applyOffset shape spn_outline.value
					if spn_extrude.value != 0 do
					(
						if not cb_extrude.checked then addmodifier shape (copy node) else addmodifier shape node
					)
					if rb_mode.state == 2 do
					(
						if not (spn_shellin.value == 0 and spn_shellout.value == 0) do
						(
							if not cb_shell.checked then addmodifier shape (copy modifier) else addmodifier shape modifier
						)
						if cb_mat.checked do shape.mat = material
					)
				)
			)
		)
	)
)
createDialog create_wall 160 540 10 110 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

bga

Michele71's picture

---

Added:

- More messagebox for editspline and shape
- Delete only ONE wall
- Segment for extrude modifier

try (destroyDialog ::create_wall) catch()
rollout create_wall "Create Quick Wall"
(
	local walls = #(), sel, ss
	fn filterShape shape = isKindOf shape SplineShape or isKindOf shape Line 
 
	group "Wall Name ..." 
	(
		edittext et_wallname "" pos:[5,25] width:135 height:17 text:"Wall"
		colorPicker cp_wire "" color:[61,135,6] pos:[138,25] width:15 height:17
		checkbox cb_unique "Use Unique Name" pos:[10,45]
		checkbox cb_random "Randomize Each Color" pos:[10,65]
	)
	group "Wall Params ..." 
	(
		radiobuttons rb_mode "Mode:" labels:#("Outline-Extrude", "Extrude-Shell") pos:[10,110]
		spinner spn_outline "Outline   =  " range:[-1e5,1e5,10] type:#worldunits pos:[11,160] fieldwidth:70
		spinner spn_extrude "Extrude  =  " range:[-1e5, 1e5,320] type:#worldunits pos:[10,180] fieldwidth:70
		spinner spn_ext_segs "Extrude Segs = " range:[1, 1e5,1] type:#integer pos:[10,200] fieldwidth:50
		checkbox cb_extrude "Instance Extrude Modifier" checked:on pos:[10,220]
		spinner spn_shellin "Shell In   =  " range:[0,1e5,5] type:#worldunits pos:[10,240] fieldwidth:70 enabled:off
		spinner spn_shellout "Shell Out = " range:[0,1e5,5] type:#worldunits pos:[11,260] fieldwidth:70 enabled:off
		checkbox cb_shell "Instance Shell Modifier" checked:on pos:[10,280] enabled:off
		button btn_reverse "Reverse Knots Order" pos:[10,300] width:140 height:18
		button btn_delete "Delete Walls" pos:[10,320] width:140 height:18
		button btn_delete_one "Delete Single Wall" pos:[10,340] width:140 height:18
	)
	group "Create Wall ..." 
	(
		button btn_create "G O !" pos:[10,390] width:140 height:18
	)
	on rb_mode changed state do 
	(
		if state == 1 then 
		(
			spn_outline.enabled = on
			spn_shellin.enabled = spn_shellout.enabled = cb_shell.enabled = off
		)
		else 
		(
			spn_outline.enabled = off
			spn_shellin.enabled = spn_shellout.enabled = cb_shell.enabled = on
		)
	)
 
	on btn_delete pressed do 
	(
		delete (for node in walls where isValidNode node collect node) ; free walls
	)
     on btn_delete_one pressed do
	 (
		 sel = for i in selection collect i.name 
         if sel.count <=0 then messagebox "Select a single Wall..."
			 else
		   if sel.count >=2 then messagebox "Select a single Wall..."
		 else
		   if superclassof $ == shape then messagebox "You have selected the SplineShape\n Please select a Wall..."
	          else
		 if superclassof $ != shape then delete $
	 )
	on btn_reverse pressed do if selection.count == 0 then messagebox "Select Shape Object" title:"Warning" beep:on else
	(
		with redraw off
		(
			for sp in selection where filterShape sp do 
			(
				integer = numSplines sp
				number = if (e = getSplineSelection sp).count == 0 then (#{1..numsplines sp} as array) else e
				for n in number do reverse sp n
			)
		)
	)
 
	on btn_create pressed do if selection.count == 0 then messagebox "Select Shape Object" title:"Warning" beep:on else
	(
		if et_wallname.text == "" then messagebox "Enter Some Name" title:"Warning" beep:off else
		(
			if GetCommandPanelTaskMode() != #create do setCommandPanelTaskMode #create
			node = (Extrude amount:spn_extrude.value segs:spn_ext_segs.value)
			modifier = if rb_mode.state == 2 do (Shell innerAmount:spn_shellin.value outerAmount:spn_shellout.value straightenCorners:on)
			with redraw off
			(
				for sp in selection where filterShape sp do 
				(
					shape = copy sp name:(if cb_unique.checked then uniquename et_wallname.text else et_wallname.text) \
					wirecolor:(if cb_random.checked then (random black white) else cp_wire.color)
					append walls shape
					if spn_outline.value != 0 and rb_mode.state == 1 do applyOffset shape spn_outline.value
					if spn_extrude.value != 0 do
					(
						if not cb_extrude.checked then addmodifier shape (copy node) else addmodifier shape node
					)
					if rb_mode.state == 2 do
					(
						if not (spn_shellin.value == 0 and spn_shellout.value == 0) do
						(
							if not cb_shell.checked then addmodifier shape (copy modifier) else addmodifier shape modifier
						)				
					)
				)
			)
		)
	)
 
	on create_wall open do
	(
		messageBox "To work correctly with - Create Quick Wall - \n you must convert the Shape in Editable Spline " title:"Info..." beep:true
		q = querybox "You want check, select and convert to Edit Spline the Shape?" title:"Check Spline" beep:on
 
		if q then
	(
		 for o in shapes collect o.name
			if shapes.count  <=0 then messagebox "No SplineShape in the scene!" title:"Check Spline" beep:true
				else
			(
			clearSelection()
		ss = select (for s in shapes where s.category == #splines  collect s)
				converttosplineshape $selection
				)
 
		 )
 
	)
)
createDialog create_wall 160 440  style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
barigazy's picture

...

hmmm...
Do you want to start with comments what you doing wrong here?

bga

Michele71's picture

do you think it is wrong the

do you think it is wrong the warning to convert the shape in editspline?

barigazy's picture

...

I'll tell you what I mean
First of all it's very annoying that every time you start the tool you get this message and query box and overlap main script UI.
Better solution will be to add button at the top to check scene if there any spline.
Second: why do you need "Delete Single Wall" button. User can easely delete selected wall manualey. Also never use dollar sign "$" in your code.

bga

Michele71's picture

Ok! Actually I have not

Ok!

Actually I have not thought about a button to check the shapes. Yes, the message it's annoying...

For the "Delete Single Wall" button, I notice that in the previous script all the wall are deleted. Then add that button seems be a solution "acceptable" :D

For sign "$" it is my fault from the beginning of my studies with MAXScript ...

Comment viewing options

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