CopyFrom 示例

使用 VBA 以外的其它编程语言

Sub Example_CopyFrom()
    ' This example will create two new plot configurations 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 a new plot configuration and customize some of the properties
    Set NewPC1 = PlotConfigurations.Add("NEW_CONFIGURATION1")
        NewPC1.PlotRotation = ac270degrees
        NewPC1.PlotHidden = True
        NewPC1.PaperUnits = acMillimeters
    
    ' Add another plot configuration and leave default values intact
    Set NewPC2 = PlotConfigurations.Add("NEW_CONFIGURATION2")
    
    ' Show plot configuration settings before we copy information from PC1
    GoSub VIEWPC2SETTINGS
    
    ' Copy setting information from plot configuration to plot configuration
    NewPC2.CopyFrom NewPC1
    
    ' Show plot configuration settings after we copy information from plot configuration
    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