明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1919|回复: 3

已知路径请问如何用LISP语句打开?

[复制链接]
发表于 2004-9-5 20:13:00 | 显示全部楼层 |阅读模式
已知路径,例: c:\\abc\\wh1023.dwg


请问如何用LISP语句打开?
发表于 2004-9-5 23:59:00 | 显示全部楼层
(command "open" "c:/abc/wh1023")
发表于 2004-9-6 12:25:00 | 显示全部楼层
;;--------------------------------------------------------------
(vl-load-com)
;;;In MDI mode
(vla-open (vla-get-documents (vlax-get-acad-object))
"yourdrawing"
)
;;;In SDI mode
(vla-open (vla-get-activedocument (vlax-get-acad-object))
"yourdrawing"
)
;;--------------------------------------------------------------
(vla-activate
(vla-open (vla-get-documents (vlax-get-acad-object)))
)
;;--------------------------------------------------------------
;;; opens and activates a file as Read-Only
(defun OPENRO (FNA)
(vla-activate
(vla-open (vla-get-documents (vlax-get-acad-object))
FNA
:vlax-true
)
)
)
;;--------------------------------------------------------------
(defun C:OPENDWG (/ NAME)
(vl-load-com)
(setq NAME (getfiled "Select File" (getvar "dwgprefix") "dwg" 16))
(if (= 0 (getvar "SDI"))
(command "_.VBASTMT"
(strcat "AcadApplication.Documents.Open \"" NAME "\"")
)
(command "_.VBASTMT"
(strcat "AcadApplication.activedocument.Open \"" NAME "\"")
)
)
)
;;=============================================================
(command "fileopen" "y" "路径名") ;;=============================================================
(defun OPENFILE (DWGFILE / ACAD ACADDOC OPENDOC)
(vl-load-com)
(setq ACAD (vlax-get-acad-object))
(setq ACADDOC (vlax-get-property ACAD 'DOCUMENTS)) (setq OPENDOC (vlax-invoke-method ACADDOC 'open DWGFILE))
(if (/= OPENDOC NIL)
(vlax-invoke-method OPENDOC 'ACTIVATE)
(prompt "\nFailed to open drawing file.")
)
)
(defun c:test ()
(command "sdi" "1")
(command "new" "y" "C:\\Program Files\\AutoCAD 2002\\Template\\acad.dwt")
(command "sdi" "0")
)
发表于 2004-9-6 20:01:00 | 显示全部楼层
在程序中这样有些问题(command "open"...)


刚打开CAD时能行,如果有图的话不行(如在菜单下调用lisp)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-18 17:47 , Processed in 0.181816 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表