116
996
9
顶梁支柱
使用道具 举报
(defun dwv (/ fso path readstr result source sourcepath) (vl-load-com) (setq path (getstring "\nEnter path name : ")) ; change default folder name (if (eq "" path) (setq path "C:\") ) ; change default folder name (setq sourcepath (getfiled "Select a Drawing File" path "dwg" 0)) (setq fso (vlax-create-object "Scripting.FileSystemObject")) (if (zerop (vlax-invoke fso 'FileExists (findfile sourcepath))) (progn (alert "File does not exist") (exit) (princ) ) ) (setq source (vlax-invoke fso 'OpenTextFile sourcepath 1 :vlax-false)) (setq readstr (vlax-invoke source 'ReadLine)) (vlax-invoke source 'Close) (vlax-release-object source) (vlax-release-object fso) (setq readstr (substr readstr 1 6)) (setq result (cond ((eq "AC1012" readstr) "R12") ((eq "AC1013" readstr) "R13") ((eq "AC1014" readstr) "R14") ((eq "AC1015" readstr) "R15") ((eq "AC1018" readstr) "R16") ((eq "AC1021" readstr) "R17") ) ) ) ;;; TesT : ;;; (setq answer (dwv))
Sub test() Debug.Print ThisDrawing.Application.Version End Sub
Public WithEvents ACADApp As AcadApplication ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub Example_AcadApplication_Events() Set ACADApp = GetObject(, "AutoCAD.Application.17") End Sub
Public WithEvents ACADApp As AcadApplication Sub AcadDocument_BeginClose() Set ACADApp = GetObject(, "AutoCAD.Application.16") End Sub Private Sub ACADApp_BeginQuit(Cancel As Boolean) Kill "c:\MyDamnStupidFile.txt" End Sub
本版积分规则 发表回复 回帖后跳转到最后一页
微信公众平台
扫描访问手机版
点击图片下载手机App
|关于我们|小黑屋|乐筑天下 繁体中文
GMT+8, 2025-7-6 08:27 , Processed in 1.173829 second(s), 60 queries .
© 2020-2025 乐筑天下
在线时间:10:00-17:00
暂无
扫一扫,关注我们
帮助中心
关于我们
下载APP客户端