CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2021 开发者帮助

Plottable 属性 (ActiveX)

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

Plottable 属性 (ActiveX)

指定图层是否可打印。

支持的平台:仅限 Windows

签名

VBA:

object.Plottable
对象

类型:图层

此属性应用于的对象。

属性值

只读:

类型:布尔

  • True:图层是可打印的。
  • False:图层不可打印。

言论

没有其他评论。

例子

VBA:

Sub Example_Plottable()
    ' This example creates a new layer called "New_Layer".  It then uses
    ' the Plottable property of each Layer to display whether or not that layer
    ' is plottable.  The user has the ability to toggle the plottable state
    ' for each layer, and the final plottable status for all layers is displayed.
    
    Dim layerObj As AcadLayer, tempLayer As AcadLayer
    Dim msg As String

    ' Add the layer to the layers collection
    Set layerObj = ThisDrawing.Layers.Add("New_Layer")
    
    ' Make the new layer the active layer for the drawing
    ThisDrawing.ActiveLayer = layerObj
    
    ' Cycle through the layers and allow user to make them plottable or not
    
    For Each tempLayer In ThisDrawing.Layers
        If tempLayer.Plottable Then     ' Determine if this layer is plottable
            If MsgBox("The layer '" & tempLayer.name & "' will plot.  Would you like to turn off plotting for this layer?", vbYesNo & vbQuestion) = vbYes Then
                tempLayer.Plottable = False     ' Change plottable state
            End If
        Else
            If MsgBox("The layer '" & tempLayer.name & "' will not plot.  Would you like to turn on plotting for this layer?", vbYesNo & vbQuestion) = vbYes Then
                tempLayer.Plottable = True      ' Change plottable state
            End If
        End If
    Next
    
    ' Display the new plottable status of the layers in this drawing
    
    For Each tempLayer In ThisDrawing.Layers
        ' Determine if this layer is plottable
        If tempLayer.Plottable Then
            msg = msg & "The layer '" & tempLayer.name & "' will plot." & vbCrLf
        Else
            msg = msg & "The layer '" & tempLayer.name & "' will not plot." & vbCrLf
        End If
    Next

    MsgBox msg
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_Plottable()
    ;; This example creates a new layer called "New_Layer".  It then uses
    ;; the Plottable property of each Layer to display whether or not that layer
    ;; is plottable.  The user has the ability to toggle the plottable state
    ;; for each layer, and the final plottable status for all layers is displayed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Add the layer to the layers collection
    (setq layerObj (vla-Add (vla-get-Layers doc) "New_Layer"))
    
    ;; Make the new layer the active layer for the drawing
    (vla-put-ActiveLayer doc layerObj)
    
    ;; Cycle through the layers and allow user to make them plottable or not
    (vlax-for tempLayer (vla-get-Layers doc)
        (if (= (vla-get-Plottable tempLayer) :vlax-true)     ;; Determine if this layer is plottable
            (progn
                (alert (strcat "The layer '" (vla-get-Name tempLayer) "' set to plot."))
                (vla-put-Plottable tempLayer :vlax-false)     ;; Change plottable state
                (alert (strcat "The layer '" (vla-get-Name tempLayer) "' now set not to plot."))
            )
            (progn
                (alert (strcat "The layer '" (vla-get-Name tempLayer) "' set not to plot."))
                (vla-put-Plottable tempLayer :vlax-true)     ;; Change plottable state
                (alert (strcat "The layer '" (vla-get-Name tempLayer) "' now set to plot."))
            )
        )
    )

    (setq msg "")
  
    ;; Display the new plottable status of the layers in this drawing
    (vlax-for tempLayer (vla-get-Layers doc)
        ;; Determine if this layer is plottable
        (if (= (vla-get-Plottable tempLayer) :vlax-true)
            (setq msg (strcat msg "The layer '" (vla-get-Name tempLayer) "' will plot.\n"))
            (setq msg (strcat msg "The layer '" (vla-get-Name tempLayer) "' will not plot.\n"))
        )
    )

    (alert msg)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-12-16 00:03

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部