求助:lisp中如何打开已有图形?
lisp中如何打开已有图形?(vlax-invoke-method (vlax-get-or-create-object "Wscript.Shell") 'run "dwg文件的完整路径") ;;106.1 [功能] 打开一个文件
;;示例: (MJ:OpenDwg "D:\\紫金防雨.dwg")(MJ:OpenDwg "D:\\DrawingA.dxf")
(defun MJ:OpenDwg (fullname)
(command "vbastmt"
(strcat "AcadApplication.Documents.Open "
(chr 34) fullname (chr 34)
)
)
)
;;106.2 [功能] 打开一个文件
;;示例(MJ:OpenDwg1 "D:\\紫金防雨.dwg")(MJ:OpenDwg1 "D:\\DrawingA.dxf")
(defun MJ:OpenDwg1 (fullname / *DOC*)
(setq *DOCS* (vla-get-Documents *acad*))
(vla-open *DOCS* fullname)
)
;;Uses the 'Open' method of the Shell Object to open the specified file or folder.
;;Author: Lee Mac, Copyright © 2011 - www.lee-mac.com
;;Arguments: target - file, folder or ShellSpecialFolderConstants enum
;;Returns:T if successful, else nil
(vl-load-com)
(defun LM:Open (target / shell result)
(if
(and
(or
(eq 'INT (type target))
(setq target (findfile target))
)
(setq shell (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application"))
)
(progn
(setq result (vl-catch-all-apply 'vlax-invoke (list shell 'open target)))
(vlax-release-object shell)
(not (vl-catch-all-error-p result))
)
)
)
;Example to Open a File Selected by the User
(LM:Open (getfiled "Select File to Open" "" "" 16))
;Example to Open a Drawing File at a Specified Location:
(LM:Open "C:\\My Folder\\File.dwg")
;Example to Open a Directory:
(LM:Open "C:\\My Folder\\My SubFolder")
;Example to Open the Fonts Special Folder:
(LM:Open 20)
页:
[1]