CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

CopyFrom Method (ActiveX)

2023-1-4 11:17| 发布者: admin| 查看: 556| 评论: 0|来自: AutoCAD

摘要: 复制标注样式、布局或打印配置的设置。

复制标注样式、布局或打印配置的设置。

支持的平台:仅窗口

签名

工 务 局:

object.CopyFrom SourceObject
对象

类型:暗型布局绘图配置

此方法适用的对象。

源对象

访问:仅输入

类型:暗淡样式,暗三点角度,暗对齐,暗角,暗弧长度,暗直径,暗坐标,暗径向,暗径向大,暗旋转文档布局引线绘图配置

要复制的源对象。

布局和打印配置:源对象必须是 PlotConfiguration 对象。

DimStyle:源对象必须是 DimStyle、Document、Dim3PointAngular、DimAligned、DimAngular、DimArcLength、DimDiametric、DimOrdinate、DimRadial、DimRadialLarge、DimRotated 或 Leader。

返回值(RetVal)

无返回值。

言论

DimStyle:此方法允许用户将标注样式数据从三种不同类型的源复制到现有标注样式中。

  1. 如果SourceObject是尺寸(包括所有尺寸对象)、容差或引线对象,则此方法将复制该对象的样式以及任何对象重写。
  2. 如果SourceObject是对象,则此方法从该标注样式复制样式数据。DimStyle
  3. 如果SourceObject是对象,则此方法将复制图形的活动标注样式设置以及任何图形替代。Document

例子

工 务 局:

Sub Example_CopyFrom()
    ' This example will create two new plot configurations, NewPC1 and NewPC2, and will use
    ' the CopyFrom method to duplicate the settings in the first plot configuration
    ' to the second plot configuration.

    Dim PlotConfigurations As AcadPlotConfigurations
    Dim PlotConfiguration As AcadPlotConfiguration
    Dim NewPC1 As AcadPlotConfiguration, NewPC2 As AcadPlotConfiguration
    
    ' Get PlotConfigurations collection from document object
    Set PlotConfigurations = ThisDrawing.PlotConfigurations
    
    ' Add NewPC1 and customize some of the properties
    Set NewPC1 = PlotConfigurations.Add("NEW_CONFIGURATION1")
    NewPC1.PlotRotation = ac270degrees
    NewPC1.PlotHidden = True
    NewPC1.PaperUnits = acMillimeters
    
    ' Add NewPC2 and leave default values intact
    Set NewPC2 = PlotConfigurations.Add("NEW_CONFIGURATION2")
    
    ' Show NewPC2 settings before we copy information from NewPC1
    GoSub VIEWPC2SETTINGS
    
    ' Copy setting information from NewPC1 to NewPC2
    NewPC2.CopyFrom NewPC1
    NewPC2.name = "NEW_CONFIGURATION2"
    
    ' Show NewPC2 settings after we copy information from NewPC1
    GoSub VIEWPC2SETTINGS
    
    Exit Sub
    
VIEWPC2SETTINGS:
    MsgBox "The settings for NEW_CONFIGURATION2 are: " & vbCrLf & _
           "Plot Rotation: " & NewPC2.PlotRotation & vbCrLf & _
           "Plot Hidden: " & NewPC2.PlotHidden & vbCrLf & _
           "Paper Units: " & NewPC2.PaperUnits

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CopyFrom()
    ;; This example will create two new plot configurations, NewPC1 and NewPC2, and will use
    ;; the CopyFrom method to duplicate the settings in the first plot configuration
    ;; to the second plot configuration.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Get PlotConfigurations collection from document object
    (setq PlotConfigurations (vla-get-PlotConfigurations doc))
    
    ;; Add NewPC1 and customize some of the properties
    (setq NewPC1 (vla-Add PlotConfigurations "NEW_CONFIGURATION1"))
    (vla-put-PlotRotation NewPC1 ac270degrees)
    (vla-put-PlotHidden NewPC1 :vlax-true)
    (vla-put-PaperUnits NewPC1 acMillimeters)
    
    ;; Add NewPC2 and leave default values intact
    (setq NewPC2 (vla-Add PlotConfigurations "NEW_CONFIGURATION2"))
    
    ;; Show NewPC2 settings before we copy information from NewPC1
    (alert (strcat "The settings for NEW_CONFIGURATION2 are: "
                   "\nPlot Rotation: " (itoa (vla-get-PlotRotation NewPC2))
                   "\nPlot Hidden: " (if (= (vla-get-PlotHidden NewPC2) :vlax-true) "True" "False")
                   "\nPaper Units: " (itoa (vla-get-PaperUnits NewPC2))
	          )
    )
    
    ;; Copy setting information from NewPC1 to NewPC2
    (vla-CopyFrom NewPC2 NewPC1)
    (vla-put-Name NewPC2 "NEW_CONFIGURATION2")

    ;; Show NewPC2 settings after we copy information from NewPC1
    (alert (strcat "The settings for NEW_CONFIGURATION2 are: "
                   "\nPlot Rotation: " (itoa (vla-get-PlotRotation NewPC2))
                   "\nPlot Hidden: " (if (= (vla-get-PlotHidden NewPC2) :vlax-true) "True" "False")
                   "\nPaper Units: " (itoa (vla-get-PaperUnits NewPC2))
	          )
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 14:11

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部