[Closed] Faces are missing using polyop.getNumFaces
Create a poly object. Select it. Run
vertices = #()
for i = 1 To polyop.getNumFaces $ do
(
append vertices ((polyop.getVertsUsingFace $ #{i}) as array);
print(vertices[i] as string);
)
For some reason, there are some faces and vertices missing(each time other faces are missing). What could be the reason?
I am using 3ds max 7.
Thanks in advance.
nothing can be lost. the code is almost correct but it’s a little… twisted
[/i]
poly = selection[1]
for f=1 to poly.numfaces collect
(
vv = polyop.getfaceverts poly f
format "face:% of % has verts:%
" f poly.numfaces vv
vv
)
does it skip anything?
nothing can be lost. the code is almost correct but it’s a little… schwerfällig
You must be nazi, no american would use german words.
poly = selection[1] for f=1 to poly.numfaces collect ( vv = polyop.getfaceverts poly f format "face:% of % has verts:% " f poly.numfaces vv vv )
does it skip anything?
Yes.
Actually the full code is this:
poly = selection[1]
dicke = 0.5
for i=1 to poly.numfaces collect
(
vv = polyop.getfaceverts poly i
hair = splineShape ()
addnewspline hair
addknot hair 1 #corner #line (polyop.getVert $ vv[1])
addknot hair 1 #corner #line (polyop.getVert $ vv[2])
addknot hair 1 #corner #line (polyop.getVert $ vv[3])
close hair 1
updateShape hair
hair.name = "triangle " + i as string
addModifier hair(extrude amount:dicke segs:1)
)
Use a low-poly model for that for obvious reasons. It creates a shell out of triangles.
Now run the code for the same object several times and you might notice that each time another triangle is missing.
as i said – nothing can be lost. your mistake is that a poly face can have three or more verts, so the right code has look like:
delete objects
poly = converttopoly (plane isselected:on)
dicke = 0.5
for f=1 to poly.numfaces collect
(
vv = polyop.getfaceverts poly f
format "face:% of % has verts:%
" f poly.numfaces vv
maxops.colorById f &col
hair = splineShape name:("triangle " + f as string) wirecolor:col
addnewspline hair
for v in vv do addknot hair 1 #corner #line (polyop.getVert poly v)
close hair 1
updateShape hair
addModifier hair (extrude amount:dicke segs:1)
)
That is right. I found a simple solution for this. Select all vertices by Ctrl + A. Press connect. Be happy