CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

可打印属性 (ActiveX)

2023-1-3 08:32| 发布者: admin| 查看: 500| 评论: 0|来自: AutoCAD

摘要: 指定图层是否可打印。

指定图层是否可打印。

支持的平台:仅窗口

签名

工 务 局:

object.Plottable
对象

类型:图层

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:图层是可绘制的。
  • False:图层不可绘制。

言论

没有额外的评论。

例子

工 务 局:

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

Visual 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 )

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部