ade_dsattach

AutoCAD Map 3D AutoLISP

Up a level
ade_dsattach
 
 

Attaches a drawing to the project drawing.

(ade_dsattach dwgname)

Returns the ID of the attached drawing or nil.

dwgname Path alias and file name (string)

This function returns an ID even if the drawing does not exist. A system administrator can use this function to define a drawing set before the drawing files it references are created or installed. A drawing must exist before you can make it active.

(ade_aliasadd "dwg_drive" "d:\\myproject\\mydir") 
(setq dwg_id 
    (ade_dsattach "dwg_drive:\\mydrawing.dwg") 
)
; check if drawing was successfully attached
(if dwg_id ; check if it returned an ID
    (princ "\nSuccessfully attached.") 
    (princ "\nDid not attach.") 
)