明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1530|回复: 3

加入尺寸类型选择,执行代码

[复制链接]
发表于 2010-10-10 21:35:00 | 显示全部楼层 |阅读模式

路过的高手,帮帮忙啊!这个程序谁能帮忙加个尺寸类型的选择啊,

;;;修改属性值
(defun c:SZ (/ e1)
(setvar "cmdecho" 0)(setvar "pickbox" 21)
(setq e1 (entget (car (setq s1 (entsel "选择编辑对象:")))))
(if (= (cdr (assoc 0 e1)) "TEXT") (command "DDEDIT" s1))

(if (= (cdr (assoc 0 e1)) "MTEXT") (command "DDEDIT" s1))
(if (= (cdr (assoc 0 e1)) "INSERT") (command "DDATTE" s1))(princ))

 

就是说如果我选择的类型是“尺寸”哦:  '((0 . "DIMENSION"))  ,  那么我就执行以下这些代码:

(defun TDZ (/ nqz nhz QZ HZ )
(SETQ DS (getstring (strcat "\n 输入替代值:" )))
(if (= DS nil ) (command "dim1" "new" (strcat DS "<>{}{}") e1 ""))
(if (/= DS nil ) (command "dim1" "new" (strcat DS "{}{}") e1 ""))
(princ))


 

 

发表于 2010-10-11 11:26:00 | 显示全部楼层

(defun c:SZ (/ e1)
  (setvar "cmdecho" 0)
  (setvar "pickbox" 21)
  (setq e1 (entget (car (setq s1 (entsel "选择编辑对象:")))))
  (if (= (cdr (assoc 0 e1)) "TEXT")
    (command "DDEDIT" s1)
  )

  (if (= (cdr (assoc 0 e1)) "MTEXT")
    (command "DDEDIT" s1)
  )
  (if (= (cdr (assoc 0 e1)) "INSERT")
    (command "DDATTE" s1)
  )
  (if (= (cdr (assoc 0 e1)) "DIMENSION")
    (TDZ)
  )
  (princ)
)

 楼主| 发表于 2010-10-11 12:17:00 | 显示全部楼层

谢谢啦

 

发表于 2011-10-22 19:49:09 | 显示全部楼层
淡定淡定淡淡的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-28 09:24 , Processed in 0.164171 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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