明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 924|回复: 2

请教一个关于插入的问题

[复制链接]
发表于 2008-6-8 22:33 | 显示全部楼层 |阅读模式

我编了一段程序,目的要能连续插入

(defun c:TT ( / laspt)
(setq dwg "aa" laspt 1);假设CAD支持搜索目录有aa.dwg这个文件
(while laspt
(command "_.insert" dwg pause "1" "1" pause) 

)

这个程序肯定是只能按"ESC"才能退出.但按了"ESC"后老是出现"; 错误: 函数被取消",怎样才能让它不出现这个提示.能不能让提示是"取消"

程序怎样改一下,可以实现不按"ESC",按了空格或回车也能退出呢?不过前提是指定插入点时不用getpoint函数,而要用pause.这样的目的是想在插入前能看到插入对象的外形.

发表于 2008-6-9 17:44 | 显示全部楼层

楼上看看我的程序吧,也是插入的,不要按ESC,我记得有个函数可以关闭错误提示,现在一时半会想不起来了。
我的程序把输入内容保存到注册表,每次都读,而不是每次打开CAD都进行初始化。

(defun c:vv (/ d s oldosmode jtbl sdg)   ;插入接头,可以统计
  (prompt "\n新建接头,缆线图上用,可以统计工作量!VC命令画接头,不可以统计个数!")
  (setq sdg (getvar "cmdecho"))
  (setq oldosmode (getvar "osmode"))
  (setvar "cmdecho" 0)
  (vl-cmdf "osnap" "end,mid,cen,nod,qua,int,ins,per,tan,nea,qui,app,ext,par")
  (banquanshuminghhb)
  (progn
    (setq s (findfile "接头.dwg"))
    (if (not s) (VL-EXIT-WITH-ERROR (alert "\n没有找到 “接头.dwg” !!\n自己定义一个图块吧!!做好后放在  ◇BLOCK◇  目录中就OK了!")))
   )

  (setq jtbld1 (vl-registry-READ jietoushj "NEW接头"))
  (if (not jtbld1)
    (progn
      (vl-registry-write jietoushj "NEW接头" "1.8")
      (setq jtbld 1.8))
    (setq jtbld (atof jtbld1))
    )

  (setq jtbl (getdist (strcat "\n输入<拾取>接头绘制直径<" (rtos jtbld) ">:")))
  (if (not jtbl)
    (setq jtbl jtbld)
    (setq jtbld jtbl))
  (PROMPT (STRCAT "\n当前新接头图上直径为:" (rtos jtbl)))
  (while t
    (initget 6 "c")
    (setq d (getpoint "\n指定插入点[修改直径<C>]:"))
    (if (= d "c") (c:vv))
    (if (not d) (VL-EXIT-WITH-ERROR "")
     (PROGN
       (vl-cmdf "insert" "接头" "s" (/ jtbl 1.9) d "")
       (vl-registry-write jietoushj "NEW接头" (rtos jtbld))
       )
      )
    (initget 6 "c")
    )
  ;(if (not d)    (c:vv)  )
 ;o (setq d nil) 
  (setvar "cmdecho" sdg)
  (setvar "osmode" oldosmode)
  (princ)
)

 楼主| 发表于 2008-6-9 21:32 | 显示全部楼层
??
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-2 09:58 , Processed in 0.646402 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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