Why doesn't the AutoLISP (command) function not work in AutoCAD 2000 MDI mode?
QuestionWhy doesn't the AutoLISP (command) function not work in AutoCAD 2000 MDI mode?
Answer
The following construct is expected to fail in AutoCAD 2000 when SDI is set to
0:
(command ".open" "test.dwg")
You must use the Automation Object Model to do this in AutoCAD 2000.
Here's how to create a new document:
(vl-load-com)
(setq acadDocs (vla-Get-Documents (vlax-get-acad-object)))
(vla-add acadDocs)
And here's how to open a document in AutoLISP:
(vl-load-com)
(setq acadDocs (vla-Get-Documents (vlax-get-acad-object)))
(vla-Open acadDocs "test.dwg")
(princ "Printed text") ; test1
(setq myvar 2) ; test2
Notice that although another document, "test.dwg" is opened, the document that
executes the code will remain active. It is this document and not the newly
opened document that displays the printed phrase and contains the variable,
myvar.
页:
[1]