GetInterfaceObject Method (ActiveX)

Accepts a program ID and attempts to load it into AutoCAD as an in-process server.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetInterfaceObject(ProgID)
object

Type: Application

The object this method applies to.

ProgID

Access: Input-only

Type: String

The program ID of the interface object to return.

Return Value (RetVal)

Type: Object

The interface object matching the program ID.

Remarks

Although the object will be loaded into AutoCAD, it will not show up in its type library. The object will have its own type library. This method lets you connect to an ActiveX Automation server.

If possible, use version-dependent ProgIDs. If a GetInterfaceObject method uses a version-independent ProgID, change the method to use a version-dependent ProgID. For example, you would change AcadLayerStateManager to AcadLayerStateManager.20.

Examples

VBA:

Sub Example_GetInterfaceObject()
    ' This example returns top level object of another application.
    On Error GoTo ERRORHANDLER
    
    Dim poly As Object
    Set poly = ThisDrawing.Application.GetInterfaceObject("Polycad.Application")

ERRORHANDLER:
    MsgBox Err.Description, , "GetInterfaceObject Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetInterfaceObject()
    ;; This example returns top level object of another application.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq poly (vl-catch-all-apply 'vla-GetInterfaceObject (list acadObj "Polycad.Application")))

    (if (= (type poly)'VL-CATCH-ALL-APPLY-ERROR)
        (alert (strcat "Error occured: \n" (vl-catch-all-error-message poly)))
    )
)