Professional Documents
Culture Documents
22
)
( PolygonMesh
PolygonMesh -
PolygonMesh
MN M
N :
PolygonMesh
.
. PolygonMesh
PolygonMesh :
)RetVal = object.Add3Dmesh(M, N, PointsMatrix
:
: Object ModelSpace PaperSpace . Block
M : N
2 . 255
: PointsMatrix x,y,z
.
Type
. :
acBezierSurfaceMesh - acCubicSurfaceMesh - acQuadSurfaceMesh - SimpleMesh
22
)
( PolygonMesh
) SimpleMesh (
.
.
:
SURFU SURFV SURFU M SURFV
N )(6
GetVariable
SetVariable .
Type
SURFU SURFV
MDensity NDensity
M N MDensity
SURFU ) (1 NDensity
SURFV ). (1
MDensity 20 NDensity 30
:
22
)
( PolygonMesh
PolygonMesh MVertexCount
NVertexCount
Type SimpleMesh
MDensity . NDensity
PolygonMesh
N
M N
MClose NClose M N
PolygonMesh.NClose = True
PolygonMesh.NClose = False
( PolygonMesh
)22
Coordinate
Coordinates
.
:
command Form1 VBcad - 1
Add3Dmesh Caption Add3Dmesh Name
: Form1 Add3Dmesh - 2
Private Sub Add3Dmesh_Click()
'------------------'1) Open AutoCAD
On Error Resume Next
Set Acadapp = GetObject(, "AutoCAD.Application.17")
Acadapp.Documents.Add
Acadapp.Visible = True
Acadapp.WindowState = acMax
If Err.Number <> 0 Then
Set Acadapp = CreateObject("AutoCAD.Application.17")
Acadapp.Documents.Add
Acadapp.Visible = True
Acadapp.WindowState = acMax
Err.Clear
End If
Me.Show
'--------------------'*) Change the viewing direction
Dim NewDirection(0 To 2) As Double
NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
Acadapp.ActiveDocument.ActiveViewport.Direction = NewDirection
Acadapp.ActiveDocument.ActiveViewport = Acadapp.ActiveDocument.ActiveViewport
( PolygonMesh
)22
Acadapp.ZoomExtents
MsgBox "you have create a Simple PolygonMesh object"
'--------------------'3) Find the MVertexCount and NVertexCount for mesh
Dim MM, NN As Integer
MM = MeshObj.MVertexCount
NN = MeshObj.NVertexCount
MsgBox "The MVertexCount = " & MM & vbCrLf & _
"The NVertexCount = " & NN
'--------------------'4) Change the Type of PolygonMesh object
MeshObj.Type = acQuadSurfaceMesh
MeshObj.Update
MsgBox "you have Change the Type of PolygonMesh to 'acQuadSurfaceMesh'"
'--------------------'5) Find SURFU and SURFV and MDensity and NDensity
Dim curSURFU As Variant
Dim curSURFV As Variant
Dim curMDensity As Integer
Dim curNDensity As Integer
curSURFU = Acadapp.ActiveDocument.GetVariable("SURFU")
curSURFV = Acadapp.ActiveDocument.GetVariable("SURFV")
curMDensity = MeshObj.MDensity
curNDensity = MeshObj.NDensity
MsgBox "The value of system variable 'SURFU' = " & curSURFU & vbCrLf & _
"The value of system variable 'SURFV' = " & curSURFV & vbCrLf & _
"The value of 'MDensity' property = " & curMDensity & vbCrLf & _
"The value of 'NDensity' property = " & curNDensity
'--------------------'6) change the MDensity and NDensity for the mesh
MeshObj.MDensity = 20
MeshObj.NDensity = 30
MeshObj.Update
MsgBox "The New MDensity for the mesh = 20 " & vbCrLf & _
"The New NDensity for the mesh = 30 "
'--------------------'7) Close the mesh in N direction
MeshObj.NClose = True
22
)
( PolygonMesh
MeshObj.Update
"MsgBox "you have Close the mesh in N direction
End Sub
:
-1 : Acadapp
.
-2 : MeshObj PolygonMesh
Points
Msize Nsize
Add3Dmesh ModelSpace
. ActiveDocument
-3 : MVertexCount NVertexCount
.
-4 : Type
acQuadSurfaceMesh
SURFU . SURFV
-5 : SURFU SURFV
GetVariable MDensity
NDensity .
-6 : MDensity NDensity
.
-7 : N
NClose . True