明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1495|回复: 2

LISP文件存在查询的求助!

[复制链接]
发表于 2004-6-1 10:39:00 | 显示全部楼层 |阅读模式
请问要在lisp程序中要加入一个块,怎么判定该块名是否存在,比如要先建立一个块,插入各点: (command "color" "1")
(setq t21c (polar t21 0 30));插入点t21c---------------------------
(setq ccd1 "1.6")

(setq ch 3.5)
(setq ch1 (* ch 1.61658))
(setq cp1 (polar t21c (/ pi 3) (* 2 ch1)))
(setq cp2 (polar t21c (/ pi 3) ch1))
(setq cp3 (polar cp2 pi ch1))
(setq cp4 (polar t21c (/ pi 2) (* 1.4 ch1)))
(command "pline" cp2 cp3 t21c cp1 "")
(setq cc1 (entlast))
(command "text" "m" cp4 ch "0" ccd1)
(setq cc2 (entlast)) ;(command "-block" "c63" t21c cc1 cc2 "");块c63------------------- (setq t7c (polar t7 (/ pi 2) 5));粗糙度标注点1(270度);-------------
(setq t0c (polar t0 (* pi 1.5) r));粗糙度标注点2(0度)--------------
(setq p5c (polar p5 (* pi 1.5) 20 ));粗糙度标注点3(270度)---------- (command "insert" "c63" "r" "0" t21c "" "" "")
(command "insert" "c63" "r" "270" t7c "" "" "")
(command "insert" "c63" "r" "0" t0c "" "" "")
(command "insert" "c63" "r" "270" p5c "" "" "") 但是第二次以后运行就会出现重定义,如何实现判定该块不存在的时候才定义成块!
发表于 2004-6-1 10:44:00 | 显示全部楼层
(tblsearch "block "c63")
 楼主| 发表于 2004-6-1 19:36:00 | 显示全部楼层
谢谢,是不是这样?: (setq kuai (tblsearch "block "c63") ) (if (= kuai nil) (command "-block" "c63" t21c cc1 cc2 "")
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-6 07:18 , Processed in 0.184782 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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