QUAN2518 发表于 2007-11-23 23:22:00

<p>看了下表达式</p><p>(IF ****)</p><p>当条件成立时执行操作“T”条件外时执行操作</p><p>但是我要求在条件成立时不执行任何操作。</p><p>&nbsp;&nbsp;&nbsp;&nbsp; 当条件不成立时才有操作要求。</p><p>找了下没找到关于条件不成立的比较式。 那个来提示一下谢谢了先。</p><p></p>

etom999 发表于 2008-1-25 11:03:00

多谢版主!

狂刀无痕 发表于 2008-1-25 18:40:00

;| xattd = 属性块实体属性显示&隐藏开关---ok!-----by 梁雄啸.2005.10
相关: attdisp 命令,只能全局打开或关闭属性.本程序可局部控制选中的带属性块的属性显示.
|;
(defun c:xattd (/ k kk ss vss)
(setq *doc (vla-get-activedocument(vlax-get-acad-object))) ;全局.
(initget 0 "V X")
(setq k (getkword "\n 块属性:v-显示 / x-关闭 / <自动切换>"))
(cond
    ((= k "V")(setq k ':vlax-true))
    ((= k "X")(setq k ':vlax-false))
)
(while (setq ss (ssget '((0 . "INSERT")(66 . 1)))) ;; 循环选择.
    (vla-delete (vla-item (vla-get-selectionsets *doc) 0)) ;;排除bug.
    (setq vss(vla-get-activeselectionset *doc))
    (vlax-map-collection
      vss
      '(lambda (x)
(mapcar '(lambda (y)
      (if k
      (vla-put-Visible y k)
      (progn
   (if (eq :vlax-false (vla-get-Visible y))
   (setq kk ':vlax-true)
   (setq kk ':vlax-false)
   )
   (vla-put-Visible y kk)
      )
      )
    )
   (vlax-invoke x 'GetAttributes)
)
       )
    )
)
(princ)
)

etom999 发表于 2008-1-30 11:03:00

23楼在CAD2002不能运行,<br/>;48--- 关闭属性显示 ---<br/>(DEFUN C:OFFATT()<br/>  (IF(AND(PRINC "\\n选择带属性图块 :")<br/>         (SETQ SS (SSGET '((0 . "INSERT")(66 . 1))))<br/>     )<br/>     (PROGN<br/>       (SETQ I -1)<br/>       (REPEAT(SSLENGTH SS)<br/>         (SETQ ENT (ENTGET(SSNAME SS (SETQ I (1+ I))))<br/>               ENT1 ENT<br/>         )<br/>         (WHILE(=(CDR(ASSOC 0 (SETQ ENT1 (ENTGET(ENTNEXT(CDR(ASSOC -1 ENT1))))))) "ATTRIB")<br/>           (IF(=(CDR(ASSOC 70 ENT1)) 0)<br/>             (PROGN(SETQ ENT1 (SUBST '(70 . 5)(ASSOC 70 ENT1) ENT1))<br/>               (ENTMOD ENT1)(ENTMOD ENT)<br/>             )<br/>          )<br/>        )<br/>      )<br/>    )<br/>  )<br/>  (PRINC)<br/>)<br/><br/>;49--- 打开属性显示 ---<br/>(DEFUN C:ONATT()<br/>  (IF(AND(PRINC "\\n选择带属性图块 :")<br/>         (SETQ SS (SSGET '((0 . "INSERT")(66 . 1))))<br/>     )<br/>     (PROGN<br/>       (SETQ I -1)<br/>       (REPEAT(SSLENGTH SS)<br/>         (SETQ ENT (ENTGET(SSNAME SS (SETQ I (1+ I))))<br/>               ENT1 ENT<br/>         )<br/>         (WHILE(=(CDR (ASSOC 0 (SETQ ENT1 (ENTGET(ENTNEXT(CDR(ASSOC -1 ENT1))))))) "ATTRIB")<br/>           (IF(=(CDR(ASSOC 70 ENT1)) 5)<br/>             (PROGN(SETQ ENT1 (SUBST '(70 . 0)(ASSOC 70 ENT1) ENT1))<br/>               (ENTMOD ENT1)(ENTMOD ENT)<br/>             )<br/>           )<br/>         )<br/>      )<br/>    )<br/>  )<br/>  (PRINC)<br/>)<br/><br/>;50--- 属性显示转换 ---<br/>(DEFUN C:ONFATT()<br/>  (IF(AND(PRINC "\\n选择带属性图块 :")<br/>         (SETQ SS (SSGET '((0 . "INSERT")(66 . 1))))<br/>     )<br/>     (PROGN<br/>       (SETQ I -1)<br/>       (REPEAT(SSLENGTH SS)<br/>         (SETQ ENT (ENTGET(SSNAME SS (SETQ I (1+ I))))<br/>               ENT1 ENT<br/>         )<br/>         (WHILE(=(CDR (ASSOC 0 (SETQ ENT1 (ENTGET(ENTNEXT(CDR(ASSOC -1 ENT1))))))) "ATTRIB")<br/>           (IF(=(CDR(ASSOC 70 ENT1)) 5)<br/>             (PROGN(SETQ ENT1 (SUBST '(70 . 0)(ASSOC 70 ENT1) ENT1))<br/>               (ENTMOD ENT1)(ENTMOD ENT)<br/>             )<br/>             (PROGN(SETQ ENT1 (SUBST '(70 . 5)(ASSOC 70 ENT1) ENT1))<br/>               (ENTMOD ENT1)(ENTMOD ENT)<br/>             )<br/>           )<br/>         )<br/>      )<br/>    )<br/>  )<br/>  (PRINC)<br/>)

qing6688 发表于 2008-1-30 11:52:00

<p>还用那么麻烦,用文字替代的方法,用"find"标准命令,用"A"代替"B". "B"也可以为空。</p>

bluewall 发表于 2008-1-31 16:33:00

bucuo

hao

zheng209 发表于 2008-2-13 02:53:00

如何用lisp程序提取块的属性值

hhhccc666 发表于 2008-2-17 18:34:00

<p>呵呵 学习学习 偷窥一下下</p>

pcdcglwb 发表于 2008-2-27 23:09:00

nbvnbvnvbnbvnbvnvb

brainstorm 发表于 2008-2-28 11:58:00

<p>(defun c:test (/ ss en)<br/>&nbsp;&nbsp;&nbsp; (Defun put-visible (bn visible / bl)&nbsp;;&nbsp;&nbsp;&nbsp; <br/>&nbsp;(If (Assoc 66 (EntGet bn))<br/>&nbsp;&nbsp;&nbsp;&nbsp; (Progn (SetQ bn (EntNext bn)<br/>&nbsp;&nbsp;&nbsp; bl (EntGet bn)<br/>&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp; (While (= "ATTRIB" (Cdr (Assoc 0 bl)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (setq bl&nbsp;(subst (cons 70<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if visible<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (assoc 70 bl)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bl<br/>&nbsp;&nbsp;&nbsp;&nbsp;)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (entmod bl)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (entupd bn)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (SetQ bl (EntGet (SetQ bn (EntNext bn))))<br/>&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;)<br/>&nbsp;&nbsp;&nbsp; )</p><p>&nbsp;&nbsp;&nbsp; (setq ss (ssget '((66 . 1))))<br/>&nbsp;&nbsp;&nbsp; (setq n 0)<br/>&nbsp;&nbsp;&nbsp; (repeat (sslength ss)<br/>&nbsp;(setq en (ssname ss n))<br/>&nbsp;(put-visible en t);可见<br/>&nbsp;;(put-visible en nil)不可见<br/>&nbsp;(setq n (1+ n))<br/>&nbsp;&nbsp;&nbsp; )<br/>)</p>
页: 1 2 [3] 4 5 6 7 8 9 10 11 12
查看完整版本: 修改块中文字属性值的程序