| CopyFrom 方法 (ActiveX) 复制尺寸标注样式、布局或打印配置的设置。 支持的平台:仅限 Windows 签名VBA: object.CopyFrom SourceObject 
 返回值 (RetVal)无返回值。 言论DimStyle:此方法允许用户从三种不同类型的源将尺寸样式数据复制到现有尺寸样式中。 
 例子VBA: 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可视化 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))
	          )
    )
) | 
 |Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-10-31 06:50
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.