GetPlotStyleTableNames Method (ActiveX)

Gets all available plot style table names.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetPlotStyleTableNames()
object

Type: Layout, PlotConfiguration

The objects this method applies to.

Return Value (RetVal)

Type: Variant (array of strings)

The array of available plot style table names for the system.

Remarks

You should call RefreshPlotDeviceInfo before the first time you use this method. Once you have called RefreshPlotDeviceInfo, you do not need to call it again unless your plot device information changes during the session.

GetPlotStyleTableNames returns all available plot style tables found on the system, including both CTB and STB files. To filter the results for one type of plot style table, use the PSTYLEMODE system variable.

Examples

VBA:

Sub Example_GetPlotStyleTableNames()
    ' This example gets the current plot device information
    ' and then displays the list of plot device names,
    ' media names, localized media names, and plot style
    ' table entries.
    Dim Layout As ACADLayout
    Set Layout = ThisDrawing.ModelSpace.Layout
    
    ' Refresh the current plot information for
    ' this session.
    Layout.RefreshPlotDeviceInfo
    
    ' List all the valid device names for the system
    Dim plotDevices As Variant
    plotDevices = Layout.GetPlotDeviceNames()
    
    Dim x As Integer
    For x = LBound(plotDevices) To UBound(plotDevices)
        MsgBox plotDevices(x)
    Next
    
    ' List all the media names, and their localized version
    Dim mediaNames As Variant
    mediaNames = Layout.GetCanonicalMediaNames()
    
    For x = LBound(mediaNames) To UBound(mediaNames)
        MsgBox mediaNames(x)
        MsgBox Layout.GetLocaleMediaName(mediaNames(x))
    Next
    
    ' List all the entries in the plot style table
    Dim styleNames As Variant
    styleNames = Layout.GetPlotStyleTableNames()
    
    For x = LBound(styleNames) To UBound(styleNames)
        MsgBox styleNames(x)
    Next
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetPlotStyleTableNames()
    ;; This example gets the current plot device information
    ;; and then displays the list of plot device names,
    ;; media names, localized media names, and plot style
    ;; table entries.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq Layout (vla-get-Layout (vla-get-ModelSpace doc)))
    
    ;; Refresh the current plot information for
    ;; this session.
    (vla-RefreshPlotDeviceInfo Layout)
    
    ;; List all the valid device names for the system
    (setq plotDevices (vlax-variant-value (vla-GetPlotDeviceNames Layout)))
    
    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound plotDevices 1) x)
        (alert (vlax-safearray-get-element plotDevices x))
        (setq x (1+ x))
    )
    
    ;; List all the media names, and their localized version
    (setq mediaNames (vlax-variant-value (vla-GetCanonicalMediaNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound mediaNames 1) x)
        (alert (vlax-safearray-get-element mediaNames x))
        (alert (vla-GetLocaleMediaName Layout (vlax-safearray-get-element mediaNames x)))
        (setq x (1+ x))
    )
    
    ;; List all the entries in the plot style table
    (setq styleNames (vlax-variant-value (vla-GetPlotStyleTableNames Layout)))
    
    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound styleNames 1) x)
        (alert (vlax-safearray-get-element styleNames x))
        (setq x (1+ x))
    )
)