CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2019 开发者帮助

MDensity 属性 (ActiveX)

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

MDensity 属性 (ActiveX)

指定 PolygonMesh 在 M 方向上的曲面密度。

支持的平台:仅限 Windows

签名

VBA:

object.MDensity
对象

类型:PolygonMesh

此属性应用于的对象。

属性值

只读:

类型:整数

介于 2 和 256 之间的整数值。

言论

M 表面密度是以下类型的对象在 M 方向上的顶点数:、 或PolygonMeshacQuadSurfaceMeshacCubicSurfaceMeshacBezierSurfaceMesh.

此属性的初始值派生自 SURFU 系统变量 + 1 中的值。因此,如果 SURFU 的当前值为 6,则曲面拟合操作后的网格值将为 7。要对网格执行曲面拟合操作,请使用该属性更改网格类型。MDensityType

例子

VBA:

Sub Example_MDensity()
    ' This example creates a 4 X 4 polygonmesh in model space.
    ' It then changes the type of polymesh, and finds the
    ' number of points in the 'M' direction.
    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
    
    ' Create a 3Dmesh in model space
    Set meshObj = ThisDrawing.ModelSpace.Add3DMesh(mSize, nSize, points)
    
    ' Change the viewing direction of the viewport to better see the polymesh
    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
    
    ' Change the type of mesh. (MDensity is not valid for acSimpleMesh type.)
    meshObj.Type = acQuadSurfaceMesh
    meshObj.Update
    ThisDrawing.Regen acActiveViewport

    ' Find the MDensity for the mesh
    Dim currDensity As Integer
    currDensity = meshObj.MDensity
    MsgBox "The MDensity for the mesh is " & meshObj.MDensity, , "MDensity Example"
    
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_MDensity()
    ;; This example creates a 4 X 4 polygonmesh in model space.
    ;; It then changes the type of polymesh, and finds the
    ;; number of points in the 'M' direction.
    (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)
    
    ;; Create 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 polymesh
    (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)
    
    ;; Change the type of mesh. (MDensity is not valid for acSimpleMesh type.)
    (vla-put-Type meshObj acQuadSurfaceMesh)
    (vla-Update meshObj)
    (vla-Regen doc acActiveViewport)

    ;; Find the MDensity for the mesh
    (setq currDensity (vla-get-MDensity meshObj))
    (alert (strcat "The MDensity for the mesh is " (itoa currDensity)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-12-15 22:04

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部