Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

to make a spline in the middle of the box

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
anycganycgJ8A6A
568 Views, 4 Replies

to make a spline in the middle of the box

 

hi 
always thank you for good answer
i need some help
Can you see the attached file Code like this is too difficult for me I need help from experts Is this possible with a script?
4 REPLIES 4
Message 2 of 5

sorry  new max file 

 

Message 3 of 5

something like this (quick and dirty):

 

mapped fn createMiddleSpline node = 
(
	tm = node.transform
	bb = nodeGetBoundingBox node tm
	
	x = abs (bb[2].x - bb[1].x)
	y = abs (bb[2].y - bb[1].y)
	z = abs (bb[2].z - bb[1].z)
	
	xx = #(x, y, z)
	ss = #(x, y, z)
	sort ss
	
	i = finditem xx ss[2]
	k = finditem xx ss[3]
	
	if (i < k) do swap ss[2] ss[3]
	
	
	rect = rectangle name:(node.name + "_sp") width:ss[3] length:ss[2] transform:tm wirecolor:(node.wirecolor * 0.6) parent:node 
	rect.center = node.center
	
	n = finditem xx ss[1]
	
	in coordsys tm
	(
		case n of
		(
			1: rotate rect (eulerangles 90 0 90) 
			2: rotate rect (eulerangles 90 0 0) 
		  --3: rotate rect (eulerangles 0 0 0)
		)
	)
	
	converttosplineshape rect 
	rect
)

createMiddleSpline $
Message 4 of 5

mapped fn createMiddleSpline node = 
(
	tm = node.transform
	bb = nodeGetBoundingBox node tm
	
	x = abs (bb[2].x - bb[1].x)
	y = abs (bb[2].y - bb[1].y)
	z = abs (bb[2].z - bb[1].z)
	
	xx = #(x, y, z)
	ss = #(x, y, z)
	sort ss
	
	i = finditem xx ss[2]
	k = finditem xx ss[3]
	
	if (i < k) do swap ss[2] ss[3]
	
	
	rect = rectangle name:(node.name + "_sp") width:ss[3] length:ss[2] transform:tm wirecolor:(node.wirecolor * 0.6) parent:node 
	rect.center = node.center
	
	n = finditem xx ss[1]
	
	in coordsys tm
	(
		case n of
		(
			1: rotate rect (eulerangles 90 0 90) 
			2: rotate rect (eulerangles -90 0 0) 
		  --3: rotate rect (eulerangles 0 0 0)
		)
	)
	--format "% % % >> % >> %\n" x y z ss (finditem xx ss[1])
	
	converttosplineshape rect 
	rect
)

delete objects 

bb = for k=1 to 10 collect 
(
	box width:(random 10 100) length:(random 10 100) height:(random 10 100) \
		pos:(random -[100,100,100] [100,100,100]) rotation:(eulerangles (random 0 180) (random 0 180) (random 0 180)) \
		wirecolor:(random white black)
)
	

createMiddleSpline bb
Message 5 of 5

very very  thank you

always  perpect answer

you are genius

really really thank you

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report