CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

Add3DMesh Method (ActiveX)

2023-1-4 13:42| 发布者: admin| 查看: 769| 评论: 0|来自: AutoCAD

摘要: 根据给定 M 和 N 方向上的点数以及 M 和 N 方向上的点坐标,创建自由形式的 3D 网格。

根据给定 M 和 N 方向上的点数以及 M 和 N 方向上的点坐标,创建自由形式的 3D 网格。

支持的平台:仅窗口

签名

工 务 局:

RetVal = object.Add3Dmesh(M, N, PointsMatrix)
对象

类型:模型空间,图纸空间

此方法适用的对象。

M, N

访问:仅输入

类型:整数

点阵列的维度。MN方向上的网格大小限制在 2 到 256 之间。

点矩阵

访问:仅输入

类型:变体(双打数组)

3D WCS 坐标的 M x N矩阵。定义顶点从顶点 (0,0) 开始。必须先为M行中的每个顶点提供坐标位置,然后才能在M+ 1 行中指定顶点。

返回值(RetVal)

类型:多边形网格

Aas 新创建的 3DMesh 对象。PolygonMesh

言论

顶点可以是彼此之间的任意距离。



Ais 始终在MN方向上打开。创建网格后,可以使用对象上的 and 属性关闭网格。PolygonMeshMCloseNClosePolygonMesh

Ais 始终创建为简单的网格。创建网格后可以使用属性进行平滑处理。PolygonMeshType

例子

工 务 局:

Sub Example_Add3DMesh()
    ' This example creates a 4 X 4 polygonmesh in model space.
    Dim meshObj As AcadPolygonMesh
    Dim mSize, nSize, count As Integer
    Dim points(0 To 47) As Double
    
    ' Create the matrix of points
    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 2: points(4) = 0: points(5) = 1
    points(6) = 4: points(7) = 0: points(8) = 0
    points(9) = 6: points(10) = 0: points(11) = 1
    points(12) = 0: points(13) = 2: points(14) = 0
    points(15) = 2: points(16) = 2: points(17) = 1
    points(18) = 4: points(19) = 2: points(20) = 0
    points(21) = 6: points(22) = 2: points(23) = 1
    points(24) = 0: points(25) = 4: points(26) = 0
    points(27) = 2: points(28) = 4: points(29) = 1
    points(30) = 4: points(31) = 4: points(32) = 0
    points(33) = 6: points(34) = 4: points(35) = 0
    points(36) = 0: points(37) = 6: points(38) = 0
    points(39) = 2: points(40) = 6: points(41) = 1
    points(42) = 4: points(43) = 6: points(44) = 0
    points(45) = 6: points(46) = 6: points(47) = 0
    
    mSize = 4: nSize = 4
    
    ' creates a 3Dmesh in model space
    Set meshObj = ThisDrawing.ModelSpace.Add3DMesh(mSize, nSize, points)
    
    ' Change the viewing direction of the viewport to better see the polygonmesh
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Add3DMesh()
    ;; This example creates a 4 X 4 polygonmesh in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Create the matrix of points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 47)))  
    (vlax-safearray-fill points '(0 0 0
                                  2 0 1
                                  4 0 0
                                  6 0 1
                                  0 2 0
                                  2 2 1
                                  4 2 0
                                  6 2 1
                                  0 4 0
                                  2 4 1
                                  4 4 0
                                  6 4 0
                                  0 6 0
                                  2 6 1
                                  4 6 0
                                  6 6 0
                                 )
    )
    (setq mSize 4
	         nSize 4)
    
    ;; creates a 3Dmesh in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq meshObj (vla-Add3DMesh modelSpace mSize nSize points))
    
    ;; Change the viewing direction of the viewport to better see the polygonmesh
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 07:13

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部