马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Question
Why 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.
|