Load Method (ActiveX)

Loads a menu group from a customization (CUIx) file or the definition of a linetype from a library (LIN) file.

Supported platforms: Windows only

Signature - Linetypes

VBA:

object.Load LineTypeName, FileName
object

Type: Linetypes

The object this method applies to.

LineTypeName

Access: Input-only

Type: String

The name of the linetype to load.

FileName

Access: Input-only

Type: String

The name of the file the linetype is in.

Signature - MenuGroups

VBA:

RetVal = object.Load(MenuFileName [,BaseMenu])
object

Type: MenuGroups

The object this method applies to.

MenuFileName

Access: Input-only

Type: String

The name of the customization (CUIx) file to load.

BaseMenu

Access: Input-only; optional

Type: Variant

If this parameter is set to True, then the menu group will be loaded as a base menu (similar to the AutoCAD MENU command). If this parameter is omitted, the menu group will be loaded as a partial menu (similar to the AutoCAD CUILOAD command).

Return Value (RetVal) - Linetypes

No return value.

Return Value (RetVal) - MenuGroups

Type: MenuGroup

The MenuGroup object that is created as a result of loading the customization (CUIx) file.

Remarks

Linetypes: Although you can create a linetype and add it to the Linetypes collection object using the Add method, it will be created with the default properties only. Because you cannot edit linetype properties with this release of ActiveX Automation, use this method to load existing linetypes into your drawing.

MenuGroups: AutoCAD searches for customization files with the specified MenuFileName and a .cuix extension.

Examples

VBA:

Sub Example_Load()
    ' This example attempts to load the linetype "CENTER" from
    ' the acad.lin file. If the linetype already exists, then
    ' a message is displayed.
    
    Dim linetypeName As String
    linetypeName = "CENTER"
    
    ' Load "CENTER" line type from acad.lin file
    On Error Resume Next    ' trap any load errors
    ThisDrawing.Linetypes.Load linetypeName, "acad.lin"
    
    ' If the name already exists, then notify user
    If Err.Description = "Duplicate record name" Then
        MsgBox "A line type named '" & linetypeName & "' already exists.", , "Load Example"
    End If
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Load()
    ;; This example attempts to load the linetype "CENTER" from
    ;; the acad.lin file. If the linetype already exists, then
    ;; a message is displayed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq linetypeName "CENTER")
    
    ;; Load "CENTER" line type from acad.lin file
    (setq err (vl-catch-all-apply 'vla-Load (list (vla-get-Linetypes doc) linetypeName "acad.lin")))
    
    ;; If the name already exists, then notify user
    (if (vl-catch-all-error-p err)
        (if (= (vl-catch-all-error-message err) "Automation Error. Duplicate record name")
            (alert (strcat "A line type named '" linetypeName "' already exists."))
        )
    ) 
)