明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1307|回复: 5

[求助]谁来帮我看看这个打开文件的程序?,急

[复制链接]
发表于 2007-6-30 10:20 | 显示全部楼层 |阅读模式

(vla-open (vla-get-documents (vlax-get-acad-object)) 文件名)

文件是可以打开,但是如何才能激活为当前文件?

还有就是打开此文件后,如何能运行某个指定的程序?

"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2007-6-30 10:47 | 显示全部楼层

如何能运行某个指定的程序?

Lisp本身依存于当前文件图档
可以新开文件图档,但后续程序跳不过去

如果臆测无误,您所要的或可绕道脚本(Script)

发表于 2007-6-30 12:21 | 显示全部楼层
  1. ;;____________________________________________________________________________________________________
  2. ;; ▓  (lt:DWGFile-open fn active)
  3. ;; [功能] 打开 DWG 文件
  4. ;; [参数] fn-------文件名
  5. ;;        active---非 nil 时激活该文档
  6. (defun lt:DWGFile-open (fn active / $acad *bak*)
  7.   (if (setq fn (l:filenamep fn))
  8.     (progn
  9.       (setq $acad (vlax-get-acad-object)
  10.             *bak* (vl-catch-all-apply
  11.                     'vla-open
  12.                     (list (vla-get-documents $acad) fn)
  13.                   )
  14.       )
  15.       (if (vl-catch-all-error-p *bak*)
  16.         nil
  17.         (progn
  18.           (if active (vla-put-activedocument $acad *bak*))
  19.           T
  20.         )
  21.       )
  22.     )
  23.   )
  24. )
 楼主| 发表于 2007-6-30 12:51 | 显示全部楼层

楼上:

 no function definition: L:FILENAMEP

缺少函数:L:FILENAMEP

发表于 2007-6-30 13:08 | 显示全部楼层

无关紧要,主要判断文件名的合法性

(defun l:filenameP (file)
  (if (and (= (type file) 'str)
           (setq file (findfile file))
           (not (vl-file-directory-p file))
      )
    file
  )
)

 楼主| 发表于 2007-7-2 09:09 | 显示全部楼层
有问题,访问冲突
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-18 21:02 , Processed in 0.161631 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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