Hi Alls,
I just attempt a code to open one session,and then close again,but this code still got trouble,what am I doing wrong?
(defun c:test (/ fn vgad vgao vgd)
(vl-load-com)
(setq fn "D:/YBI/Drawing/Lat/Test-1.dwg")
(setq vgao (vlax-get-acad-object))
(setq vgad (vla-get-activedocument vgao))
(setq vgd (vla-get-documents vgao))
(if
(= 0 (getvar "SDI"))
(vla-activate (vla-open vgd fn)) ; if sdi = 0
(vla-sendcommand vgad (strcat "(command \"_open\")\n" fn "\n")); if sdi = 1
) ; if
(command "_copyclip" "all" "")
;(vla-close vgad)
(vla-sendcommand vgad (strcat "(command \"_quit\")\n" fn "\n"))
(princ)
)