Hello everyone,
As always I am struggling with a scripted I wish to make.
I need to make something that act pretty much as the Fill mode (edgeloop selectio) in the Object Paint since it seems impossible to access this option via maxscript.
So I tried to do it by myself with no success unfortunately (the code below is the closer one I got).
Actually my code it's far to be perfect but pretty ok when I duplicate my instances along an edge longer than the distance I set (5 in this case but should be modifiable). When the edge length is shorter than 5 I don't get what I want whatever I tried.
I guess the solution should be to set every edge's length to 5 by moving or creating vertex but I don't know if that's possible.
Could you help me?
Clearlistener()
-- "To test it well your edgeloop selection should have some edge's length shorter thant 5"
Inst = Pyramid width: 5.0 height: 5.0 depth: 5.0 pos:[0,0,0]
for obj in selection do
(
C = [0,0,0]
D = [0,0,0]
H = 0
M = 0
vert = #()
j = 1
tot = 0
A = polyop.getedgeselection obj
for i in A do
(
B = polyop.getEdgeVerts obj i
append vert B
)
while j <= (vert.count) do
(
C = polyop.getVert obj vert[j][1]
D = polyop.getVert obj vert[j][2]
H = distance C D
if H < 5 then
(
while H < 5 do
(
H = distance C D
M += 1
tot = M + j
if tot > vert.count then
(exit)
D = polyop.getVert obj vert[tot][2]
print tot
)
H = distance C D
j = tot
M = 0
)
else if H >= 5 then
(
j = j+1
M = 0
)
H = distance C D
G = (H / 5) as integer
for i = 1 to G do
(
ofS = [0,0,5 * (i - 1)]
P = (instance Inst)
P.pos = C
P.dir = (D - C)
P.objectOffsetPos = ofS
)
)
)