CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

MClose Property (ActiveX)

2023-1-3 11:12| 发布者: admin| 查看: 464| 评论: 0|来自: AutoCAD

摘要: 指定多边形网格是否在 M 方向上闭合。

指定多边形网格是否在 M 方向上闭合。

支持的平台:仅窗口

签名

工 务 局:

object.MClose
对象

类型:多边形网格

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:在M方向上闭合。PolygonMesh
  • False:在M方向上打开。PolygonMesh

言论

如果关闭,它将被视为从最后一行到第一行的连续。如果打开,它将被视为最后一行和第一行之间的不连续。PolygonMeshPolygonMesh

例子

工 务 局:

Sub Example_MClose()
    ' This example creates a 4 X 4 polygonmesh in model space.
    ' It then closes the polymesh 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) = 2: points(1) = 2: points(2) = 1
    points(3) = 2.5: points(4) = 2: points(5) = 0
    points(6) = 5: points(7) = 2: points(8) = 0
    points(9) = 5.5: points(10) = 2: points(11) = 1
    points(12) = 2: points(13) = 4: points(14) = 0.5
    points(15) = 2.5: points(16) = 4: points(17) = 0
    points(18) = 5: points(19) = 4: points(20) = 0
    points(21) = 5.5: points(22) = 4: points(23) = 0.5
    points(24) = 2: points(25) = 6: points(26) = 0.5
    points(27) = 2.5: points(28) = 6: points(29) = 0
    points(30) = 5: points(31) = 6: points(32) = 0
    points(33) = 5.5: points(34) = 6: points(35) = 0.5
    points(36) = 2: points(37) = 8: points(38) = 1
    points(39) = 2.5: points(40) = 8: points(41) = 0
    points(42) = 5: points(43) = 8: points(44) = 0
    points(45) = 5.5: points(46) = 8: points(47) = 1
    
    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 cylinder
    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
    
    ' Close the polymesh in the 'M' direction
    MsgBox "The polymesh is " & IIf(meshObj.MClose, "closed", "open") & " in the 'M' direction.", , "MClose Example"
    meshObj.MClose = True
    ThisDrawing.Regen acActiveViewport
    MsgBox "The polymesh is " & IIf(meshObj.MClose, "closed", "open") & " in the 'M' direction.", , "MClose Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MClose()
    ;; This example creates a 4 X 4 polygonmesh in model space.
    ;; It then closes the polymesh 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 '(2 2 1
				  2.5 2 0
				  5 2 0
				  5.5 2 1
				  2 4 0.5
				  2.5 4 0
				  5 4 0
				  5.5 4 0.5
				  2 6 0.5
				  2.5 6 0
				  5 6 0
				  5.5 6 0.5
				  2 8 1
				  2.5 8 0
				  5 8 0
				  5.5 8 1
				 )
    )
    
    (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 cylinder
    (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)
    
    ;; Close the polymesh in the 'M' direction
    (alert (strcat "The polymesh is " (if (= (vla-get-MClose meshObj) :vlax-true) "closed" "open") " in the 'M' direction."))
    (vla-put-MClose meshObj :vlax-true)
    (vla-Regen doc acActiveViewport)
    (alert (strcat "The polymesh is " (if (= (vla-get-MClose meshObj) :vlax-true) "closed" "open") " in the 'M' direction."))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 03:48

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部