Notifications
Clear all

[Closed] Box extrude direction

Hey, guys!

I have to build an object from several boxes with the help of maxscript and I have a problem.

I need to align a box in a fixed point and modify it ( to change the thickness ) in only one direction.
As you know, 3ds max change the size boxes from middle, in two directions.

It is possible to change a box size in only one direction?

I attached a picture – in top view ( see here ).

Thanks!

EDIT:

Thanks, miauu! You are right, is not about extrude here (was just only in my mind) – i edit the post.

I try your solution, but is not what i want, or maybe I don’t understood what you said.
I don’t want to scale the box, just to change the size direction.
I change the picture too, now maybe is not so confused.

2 Replies

What is shown in the image is not extrude, but is how max changes the box width/length/height.
If you don’t want to convert the box to editable poly/mesh object try with this:

(
	delete $*
	b = box width:100 height:100 length:100 isSelected:true
	--	set the pivot to the point from where you want to start to "extrude"
	b.pivot = b.min
	--	this will "extrude" along X, Y and Z
	b.scale.x *= 2
	b.scale.y *= 3
	b.scale.z *= 4
)

If you are working with Box primitives, then this little script may help you. Be aware that it will align the pivot point to the node.

try (destroyDialog RO_BOX_SIZE) catch()
rollout RO_BOX_SIZE "Change Box Size" width:200 height:104
(
	GroupBox grp1 "Box Size Offset:" pos:[8,8] width:136 height:92
	spinner spn_l "Length:" pos:[16,28] width:120 height:16 range:[-1E+010,1E+010,0] scale:0.1 fieldwidth:72
	spinner spn_w "Width:"  pos:[16,52] width:120 height:16 range:[-1E+010,1E+010,0] scale:0.1 fieldwidth:72
	spinner spn_h "Heigth:" pos:[16,76] width:120 height:16 range:[-1E+010,1E+010,0] scale:0.1 fieldwidth:72
	label lbl_l "" pos:[150,28] width:44 height:16
	label lbl_w "" pos:[150,52] width:44 height:16
	label lbl_h "" pos:[150,76] width:44 height:16
	
	local oldwidth
	local oldheigth
	local oldlength
	local oldpos
	
	fn update dir arg = if (classof $ == Box) do (
		case dir of
		(
			1:
			(
				$.width = amax #((abs arg)-oldwidth, oldwidth+arg)
				$.objectOffsetPos.x = oldpos.x + arg*0.5
				lbl_w.text = $.width as string
			)
			2:
			(
				$.length = amax #((abs arg)-oldlength, oldlength+arg)
				$.objectOffsetPos.y = oldpos.y + arg*0.5
				lbl_l.text = $.length as string
			)
			3:
			(
				$.height = oldheigth+arg
				lbl_h.text = $.height as string
			)
		)
	)
	
	fn getParams = (
		if (classof $ == Box) then (
			AlignPivot $
			oldwidth  = $.width
			oldlength = $.length			
			oldheigth = $.height
			oldpos	= $.objectOffsetPos
		)else(
			print "Node is not a Box primitive!"
			lbl_w.text = ""
			lbl_l.text = ""
			lbl_h.text = ""
		)
	)
	
	fn resetSpinners = (
		spn_w.value = 0.0
		spn_l.value = 0.0
		spn_h.value = 0.0
	)
	
	on spn_w buttondown do getParams()
	on spn_w buttonup arg do resetSpinners()

	on spn_l buttondown do getParams()
	on spn_l buttonup arg do resetSpinners()
	
	on spn_h buttondown do getParams()
	on spn_h buttonup arg do resetSpinners()

	on spn_w entered do (
		getParams()
		update 1 spn_w.value
		resetSpinners()
	)
	
	on spn_l entered do (
		getParams()
		update 2 spn_l.value
		resetSpinners()
	)
	
	on spn_h entered do (
		getParams()
		update 3 spn_h.value
		resetSpinners()
	)	
	
	on spn_w changed arg inSpin do if inSpin do update 1 arg
	on spn_l changed arg inSpin do if inSpin do update 2 arg
	on spn_h changed arg inSpin do if inSpin do update 3 arg

)
createDialog RO_BOX_SIZE