Spheres out of Points

Hi Scriptpot community,

I just started using 3DS / MAX scripts, so apologize for being naive.

I have network composed by links and points,
now with Max script, i need to:

1) Create spheres (with different sizes) for each point of the network (around 10000 points)

2) Give a thin solidity to the links, as at moment they are just empty invisible lines. I guess i need to convert them to small cilinders.

is there any script to do this for all the elements?

Tx
Luis

AttachmentSize
screen_shot_2013-07-30_at_4.30.31_pm.png80.18 KB

Comments

Comment viewing options

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

Ok let's assume the sphere

Ok let's assume the sphere are instances, so they have equal dimensions,
how the script would look like?

L

miauu's picture

.

This will create 100 points in random position and then will create 100 spheres and will place them in the positions of the points:

(
	max create mode
	with redraw off
	(
		--//	Prepare the scene
		--	delete all objects in the scene
		delete $*
		--	create points
		for p = 1 to 100 do point pos:[(random -1000 1000), (random -1000 1000), (random -1000 1000)] wirecolor:green
		--//	actual code that places sphere in the points position
		--	create spheres and place them on the points position
		s = sphere radius:10 wirecolor:yellow
		--//	get the points count.
		for h in helpers do
		(
			ss = instance s
			ss.pos = h.pos
		)
		--	delete the first sphere
		delete s
		--	if you want to delete the helpers uncoment the next line
-- 		delete helpers
	)
)

This will get all splines/lines in the scene and will made them to looks like cylinders. The code above not creates aplines.

(
	max create mode
	--	get all splines
	for s in shapes where classof s == Line or classof s == SplineShape do with redraw off with undo off
	(
		s.render_renderable = true	--	turn On Enable In Renderer
		s.render_displayRenderMesh = true	--	turn On Enable In Viewport
		s.render_thickness = 10	--	radial thickness match the sphere radius
		s.render_sides = 8	--	sides of the spline
	)
)
miauu's picture

Upload a scene(not with 10

Upload a scene(not with 10 000 points).
Placing spheres in the position of points(with different size) is not a problem. 10 000 spheres can take a time, because you want each sphere to have different size, so they can't be instances.
The lines(I assume that you uses lines or editable splines) don't have to be converted to cylinders. You can turn On Enable in renderer and Enable in Viewport and can set the shape(radial or rectangular) and the size.

Comment viewing options

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