Distribute grouped objects along edges

hi. I'm stuck at trying to distribute grouped objects along a given objects edges. At first I thought it was similar as with the case of vertices but it turned out to be quite complicated.
Hope I was clear. Anyones help highly appreciated.

Comments

Comment viewing options

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

#2 example

And this is the thing that you asked

delete objects
numOfCopy = 8
obj = converttopoly (Box length:200 width:200 height:200 isselected:on wirecolor:black)
polyop.setEdgeSelection obj 8
max modify mode ; subobjectLevel = 2 ; max zoomext sel all
 
selEdge = (polyop.getEdgeSelection obj as array)[1]
edgVerts = polyOp.getEdgeVerts obj selEdge
a = for i = 1 to 2 collect (polyOp.getvert obj edgVerts[i])
theDir = normalize (a[2]-a[1])
theLength = (distance a[2] a[1])/(numOfCopy-1)
ball = sphere radius:5 pos:a[1]
for i = 1 to (numOfCopy-1) do
(
	ballCopy = copy ball
	ballCopy.pos += (i*theLength*theDir) 
	ballCopy.wirecolor = random black white
)

bga

barigazy's picture

#1 example

In this example I use splineShape

delete objects
numOfCopy = 8
a = #([15,30,20], [200,300,500])
b = splineshape wirecolor:yellow
addnewspline b
for i = 1 to 2 do addKnot b 1 #corner #curve a[i]
updateshape b
theDir = normalize (a[2]-a[1])
theLength = (distance a[2] a[1])/(numOfCopy-1)
ball = sphere radius:5 pos:a[1]
for i = 1 to (numOfCopy-1) do
(
	ballCopy = copy ball
	ballCopy.pos += (i*theLength*theDir) 
)

bga

Comment viewing options

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