положение края полигона в maxscript

Я хочу получить положения краев многоугольника 3Ds Max с помощью maxscript. Я пробовал следующее:

tmesh = snapshotAsMesh selection[1]
out_name = ((GetDir #export)+"/testmesh.dat")
out_file = createfile out_name
num_verts = tmesh.numverts
num_faces = tmesh.numfaces

format "% % %\n" num_verts num_faces to:out_file

for v = 1 to num_verts do
(
 vert = getVert tmesh v
 format "%," vert to:out_file
)

format "\n" to:out_file

for f = 1 to num_faces do
(
 face = getFace tmesh f
 format "%," face to:out_file
)

close out_file
delete tmesh
edit out_name

Вывод должен быть чем-то вроде формата файла OBJ, но я хочу, чтобы в каркасе отображались только краевые соединения.

Пример вывода:

[0,0,0],[1,0,0],[0,1,0],[1,1,0]
[1,2],[2,3],[3,4],[4,1]

РЕДАКТИРОВАТЬ: с помощью этого кода я мог найти невидимые края.

for f = 1 to num_faces do
(
   face = getFace tmesh f   
   edge1 = getEdgeVis tmesh f 1
   edge2 = getEdgeVis tmesh f 2
   edge3 = getEdgeVis tmesh f 3
   format "%,[%,%,%]" face edge1 edge2 edge3 to:out_file
   format "\n" to:out_file
)

person Afshin    schedule 25.04.2015    source источник


Ответы (1)


Вы можете получить вершины для ребра, используя meshop.GetVertsUsingEdge следующим образом:

tmesh = snapshotAsMesh selection[1]

allverts = #()

for v = 1 to num_verts do
(
    vert = getVert tmesh v
    append allverts vert
)
print allverts

format "\n" --to:out_file

edges = tmesh.Edges
for ed in edges do
(
    print ed
    edverts = meshop.GetVertsUsingEdge tmesh ed
    print "ed verts: "
    for v in edverts do (
        print allverts[v]
    )
    print "\n"
)

delete tmesh
person Hoser    schedule 27.04.2015