[Closed] Vert Number Problem
Hi, I have a tricky problem that has stumped me.
I have a mesh which I have duplicated and offset some polys – as in the attached picture.
The position of the offset geometry is not important at this time as I will be moving each vert later.
What I need to do which has stumped me is to find a way to return the following array of vert numbers:
#(#(4,14),#(8,12),#(3,11),#(5,10),#(9,13),#(6,15))
the first of each pair is the vert on the original mesh, the second is the corresponding vert on the duplicated mesh. however, I can’t see any relationship in the vert numbers. Does anyone have any idea how I could generate the array I need?
Thanks in advance for any help.
Rhys.
from what i can see, you have duplicated the object and removed some faces. This means that the order and the number of verts have changed so there is no way you can get corresponding verts.
if you only duplicated the faces (ie. still part of the same object) you could probably build your array whilst creating the new faces?
Thanks for your reply.
What I have ended up doing is first duping the faces but not moving them. Then I just loop through each of the original verts checking the new verts for ones with matching positions. This lets me build the array then I move the faces.
Thnks again!
Rhys.
-- Make matching vert array
matchedVerts = #()
newPolyVerts = (for i = (roof1OrigCount + 1) to (polyOp.getNumVerts roof1) collect (i))
for i=1 to currPolyVerts.count do
(
tempArray = #()
append tempArray currPolyVerts[i]
for k=1 to newPolyVerts.count do
(
if ((polyop.getVert roof1 currPolyVerts[i]) == (polyop.getVert roof1 newPolyVerts[k])) do
(
append tempArray newPolyVerts[k]
)
)
append matchedVerts tempArray
)
Hope thats wht you were after.
Rhys.
havent tested this but wouldnt this work?
[left] – Make matching vert array
matchedVerts = #()
newPolyVerts = (for i = (roof1OrigCount + 1) to (polyOp.getNumVerts roof1) collect (i))
for i=1 to currPolyVerts.count do
([/left]
[left]matchedVerts[matchedVerts.count+1] = currPolyVerts[i]
for k=1 to newPolyVerts.count do
(
if ((polyop.getVert roof1 currPolyVerts[i]) == (polyop.getVert roof1 newPolyVerts[k])) then
(
matchedVerts[matchedVerts.count+1] = newPolyVerts[k][/left]
[left])
)
)[/left]
Yes it would…
To be honest, I only spent a minute or two on that piece of code once I figured out how to do it. I plan to go through afterwards and streamline everything.
Thanks!