## 3D 网格表示的意义

3D 网格可用于多个行业的不同目的。

3D 网格的此类用例更多，在许多行业中发挥着非常重要的作用。

## 使用 pyautocad 或 pywin32 在 Python 中启动脚本

``````from pyautocad import Autocad, aDouble

``````from win32com.client import *
import pythoncom

return win32com.client.VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_R8, (argv))``````

``````pmatrx = aDouble(10, 1, 3, 10, 5, 5, 10, 10, 3, 15, 1, 0, 15, 5, 0, 15, 10, 0, 20, 1, 0, 20, 5, -1, 20, 10, 0, 25, 1, 0, 25, 5,  0, 25, 10, 0)

## 分析新创建的 3D 网格

``pl = acad.model.AddPolyline(pmatrx)``

## 使用 pyautocad 的 3D 网格的属性

``````print("Coordinates of the mesh:", end='')
print(mesh1.Coordinates)
print("Is mesh one is closed in M direction: " + str(mesh1.MClose))
print("Density of mesh in M direction: " + str(mesh1.MDensity))
print("Number of vertices in M direction: " + str(mesh1.MVertexCount))
print("Is mesh one is closed in N direction: " + str(mesh1.NClose))
print("Density of mesh in N direction: " + str(mesh1.NDensity))
print("Number of vertices in N direction: " + str(mesh1.NVertexCount))

O/p:

Coordinates of the mesh:(10.0, 1.0, 3.0, 10.0, 5.0, 5.0, 10.0, 10.0, 3.0, 15.0, 1.0, 0.0, 15.0, 5.0, 0.0, 15.0, 10.0, 0.0, 20.0, 1.0, 0.0, 20.0, 5.0, -1.0, 20.0, 10.0, 0.0, 25.0, 1.0, 0.0, 25.0, 5.0, 0.0, 25.0, 10.0, 0.0)
Is mesh one is closed in M direction: False
Density of mesh in M direction: 0
Number of vertices in M direction: 4
Is mesh one is closed in N direction: False
Density of mesh in N direction: 0
Number of vertices in N direction: 3``````