CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2022 开发者帮助

NumberOfVertices 属性 (ActiveX)

2024-5-18 18:45| 发布者: admin| 查看: 131| 评论: 0|原作者: admin|来自: AutoCAD

NumberOfVertices 属性 (ActiveX)

获取 PolyfaceMesh 的顶点数。

支持的平台:仅限 Windows

签名

VBA:

object.NumberOfVertices
对象

类型:PolyFaceMesh

此属性应用于的对象。

属性值

只读:是的

类型:

中的顶点数。PolyfaceMesh

言论

没有其他评论。

例子

VBA:

Sub Example_NumberOfVertices()
    ' This example creates a PolyFaceMesh and displays the number of vertices it contains
    
    Dim vertexList(0 To 17) As Double
    Dim FaceList(0 To 7) As Integer
    Dim NewPolyFaceMeshObj As AcadPolyfaceMesh
    Dim direction(0 To 2) As Double
    
    'Data for new PolyFaceMesh object
    vertexList(0) = 4: vertexList(1) = 7: vertexList(2) = 0
    vertexList(3) = 5: vertexList(4) = 7: vertexList(5) = 0
    vertexList(6) = 6: vertexList(7) = 7: vertexList(8) = 0
    vertexList(9) = 4: vertexList(10) = 6: vertexList(11) = 0
    vertexList(12) = 5: vertexList(13) = 6: vertexList(14) = 0
    vertexList(15) = 6: vertexList(16) = 6: vertexList(17) = 6
    
    FaceList(0) = 1:    FaceList(1) = 2:    FaceList(2) = 5
    FaceList(3) = 4:    FaceList(4) = 2:    FaceList(5) = 3
    FaceList(6) = 6:    FaceList(7) = 5

    ' Create new PolyFaceMesh object
    Set NewPolyFaceMeshObj = ModelSpace.AddPolyfaceMesh(vertexList, FaceList)
    NewPolyFaceMeshObj.Update

    ' Change the viewing direction of the viewport to
    ' better see the polyface mesh
    direction(0) = -1: direction(1) = -1: direction(2) = 1
    ThisDrawing.ActiveViewport.direction = direction
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ThisDrawing.Application.ZoomAll
    
    ' Display number of vertices in this PolyFaceMesh
    MsgBox "The new PolyFaceMesh contains " & NewPolyFaceMeshObj.NumberOfVertices & " vertices."
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_NumberOfVertices()
    ;; This example creates a PolyFaceMesh and displays the number of vertices it contains
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Data for new PolyFaceMesh object
    (setq vertexList (vlax-make-safearray vlax-vbDouble '(0 . 17)))
    (vlax-safearray-fill vertexList '(4 7 0
				      5 7 0
				      6 7 0
				      4 6 0
				      5 6 0
				      6 6 6
				     )
    )
    
    (setq FaceList (vlax-make-safearray vlax-vbInteger '(0 . 7)))
    (vlax-safearray-fill FaceList '(1
				    2
				    5
				    4
				    2
				    3
				    6
				    5
				   )
    )

    ;; Create new PolyFaceMesh object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq NewPolyFaceMeshObj (vla-AddPolyfaceMesh modelSpace vertexList FaceList))
    (vla-Update NewPolyFaceMeshObj)

    ;; Change the viewing direction of the viewport to
    ;; better see the polyface mesh
    (setq direction (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport direction)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
    
    ;; Display number of vertices in this PolyFaceMesh
    (alert (strcat "The new PolyFaceMesh contains " (itoa (vla-get-NumberOfVertices NewPolyFaceMeshObj)) " vertices."))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1   苏公网安备32011402011833)

GMT+8, 2025-3-14 05:38

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部