明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1752|回复: 6

[原创]open的LSP程序

[复制链接]
发表于 2009-6-10 16:32:00 | 显示全部楼层 |阅读模式

(defun c:ww()
(vl-load-com)
(setq kk (getfiled "Select  File" (strcat(vla-get-path (vla-get-activedocument (vlax-get-acad-object))))  "dwg" 16))
(sopen  kk) 
  )

(defun openRO (fna)
  (vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) fna :VLAX-TRUE))
)

(defun sopen (fna / n)
  (if (= 0 (getvar "SDI"))
    (vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) fna))
    (progn
      (if (not (equal 2 (logand 2 (getvar "qaflags"))))
        (setvar "qaflags" (+ (getvar "qaflags") 2))
      )
      (if (not (equal 4 (logand 4 (getvar "qaflags"))))
       (setvar "qaflags" (+ (getvar "qaflags") 4))
      )
      (command "_.open")
      (if (not (equal 0 (getvar "dbmod")))
        (command "_y")
      )
      (command fna) 
      (setq n 0)
      (while (and (< n 4)
                  (wcmatch (getvar "cmdnames") "*OPEN*")
             )
          (T
            (command "")
          )
        (setq n (+ n 1))
      )
      (setvar "qaflags" 0)
    )
  )
)


 楼主| 发表于 2009-6-10 16:59:00 | 显示全部楼层

(setq kk (getfiled "Select  File" (strcat(vla-get-path (vla-get-activedocument (vlax-get-acad-object))))  "dwg" 16))
改成(setq kk (getfiled "Select  File" (strcat(vla-get-path (vla-get-activedocument (vlax-get-acad-object))))  "dwg;dws;dxf;dwt" 16))

就和CAD本身的open开启的选项一样了!

发表于 2009-6-10 20:04:00 | 显示全部楼层

直接用“open”命令不可以吗,

发表于 2009-6-10 22:17:00 | 显示全部楼层

能不能做个“只读”打开文件的功能 ?!

发表于 2009-6-11 08:46:00 | 显示全部楼层
LZ,能不能做个新建(QNEW)命令的LISP程序?好像QNEW命令和OPEN命令一样不能直接调用的,学习学习VLA的用法。
发表于 2011-4-18 03:07:00 | 显示全部楼层
可以应用到程序中,谢谢啦
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 08:23 , Processed in 0.174770 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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