CopyFrom Method (ActiveX)

Copies the settings for a dimension style, layout, or plot configuration.

Supported platforms: Windows only

Signature

VBA:

object.CopyFrom SourceObject
object

Type: DimStyle, Layout, PlotConfiguration

The objects this method applies to.

SourceObject

Access: Input-only

Type: DimStyle, Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, Document, Layout, Leader, PlotConfiguration

The source object to be copied.

Layout and PlotConfiguration: The source object must be a PlotConfiguration object.

DimStyle: The source object must be either a DimStyle, Document, Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, or Leader.

Return Value (RetVal)

No return value.

Remarks

DimStyle: This method allows users to copy dimension style data into an existing dimension style from three different types of sources.

  1. If SourceObject is a dimension (this includes all dimension objects), Tolerance, or Leader object, this method copies the style for that object plus any object overrides.
  2. If SourceObject is a DimStyle object, this method copies the style data from that dimension style.
  3. If SourceObject is a Document object, this method copies the active dimension style settings for the drawing plus any drawing overrides.

Examples

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

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