April 17, 2002

at 12:00 pm /

#11113
Okay, I came up with the following routine. It may not be pretty, but it does the job. Mostly.

andnbsp;’get face index

andnbsp; andnbsp;For FaceIndex = 0 to FaceCount -1

andnbsp; andnbsp; andnbsp; andnbsp;’get the face

andnbsp; andnbsp; andnbsp; andnbsp;Set Face = Object.GetFace(FaceIndex)

andnbsp; andnbsp; andnbsp; andnbsp;’get the number of normals in the face

andnbsp; andnbsp; andnbsp; andnbsp;FaceNormalCount = Face.GetNormalCount andnbsp; andnbsp; andnbsp; andnbsp;

andnbsp; andnbsp; andnbsp; andnbsp;’run through the normals

andnbsp; andnbsp; andnbsp; andnbsp;For NormalIndex = 0 To FaceNormalCount – 1

andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;’get the normal and point index

andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;Normal = Face.GetNormal(NormalIndex)

andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;Point = Face.GetPoint(NormalIndex)

andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;’cross-reference point to normal

andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;Vertex (Normal) = Point

andnbsp; andnbsp; andnbsp; andnbsp;Next

andnbsp; andnbsp;Next

andnbsp; andnbsp;’write the vertex list

andnbsp; andnbsp;For NormalIndex = 0 To NormalCount – 1

andnbsp; andnbsp; andnbsp; andnbsp;’get the normal, point andamp; UV

andnbsp; andnbsp; andnbsp; andnbsp;Object.GetNormal NormalIndex, Xn, Yn, Zn

andnbsp; andnbsp; andnbsp; andnbsp;Object.GetPoint Vertex (NormalIndex), X, Y, Z

andnbsp; andnbsp; andnbsp; andnbsp;Object.GetPointTextureCoordinate Vertex (NormalIndex), U, V

andnbsp; andnbsp; andnbsp; andnbsp;FileObject.WriteLine m3DCApp.FormatScientific(X) andamp; andquot; andquot; andamp; m3DCApp.FormatScientific(Y) andamp; andquot; andquot; andamp; m3DCApp.FormatScientific(Z) andamp; andquot; andquot; andamp; m3DCApp.FormatScientific(Xn) andamp; andquot; andquot; andamp; m3DCApp.FormatScientific(Yn) andamp; andquot; andquot; andamp; m3DCApp.FormatScientific(Zn) andamp; andquot; andquot; andamp; CStr(CSng(1+U)) andamp; andquot; andquot; andamp; CStr(CSng(1+V))

andnbsp; andnbsp;Next

However, I get strange and unusable results after performing a crease operation on an object (make hard edges). The number of total points (normals) seems to decrease, and the triangle list gets messed up. Instead of the usual:

0 1 2

0 2 3

etc.

I get things like:

0 1 1

2 2 2

Have I missed something obvious again?