AutosoFreely 发表于 2022-7-5 17:00:53

需要帮助仅选择证书

我猜不出来。下面创建的lisp可以很好地选择所有已识别的多DText属性块,从而全局更改其宽度因子。
 
然而,我需要它做的是只选择超过11.30mm的块,并将其更改为可以输入但有人可以输入的因子。
 
(defun
C:IDEC-FERRULE_SHORT (/ CE CN DT EN NA NE NH NS NT NW OLDERR OP SL SN SS)
(setq
   OLDERR *ERROR*
   *ERROR* ERR
   CE (getvar "CMDECHO")
   SS (ssget '((0 . "INSERT")))
   CN 0
) ;_ end of setq
;;setq
    (setq NW (getreal "\nNew Text Width for Attribute: "))
    (if SS
      (repeat (setq SL (sslength SS))
      (setq
          SN (ssname SS CN)
          NE (entnext SN)
      ) ;_ end of setq
      ;;setq
      (while (and
               NE
               (/= (setq EN (cdr (assoc 0 (setq DT (entget NE)))))
                     "SEQEND"
               ) ;_ end of /=
               ) ;_ end of and
          (if (= EN "ATTRIB")
            (progn
            (setq DT (subst (cons 41 NW) (assoc 41 DT) DT))
            (entmod DT)
            (entupd SN)
            ) ;_ end of progn
            ;;progn
          ) ;_ end of if
          ;;if
          (setq NE (entnext NE))
      ) ;_ end of while
      ;;while
      (setq CN (1+ CN))
      (repeat 25 (princ "\010"))
      (princ (strcat "Total " (itoa CN) " done of " (itoa SL)))
      ) ;_ end of repeat
      ;;repeat
      (princ "\nNo input")
    ) ;_ end of if
    ;;if
   )
   ;;W
) ;_ end of cond
;;cond
(setvar "CMDECHO" CE)
(setq *ERROR* OLDERR)
(princ)
)
 
 
希望有人能帮我解决这个问题,因为我没有线索。

SLW210 发表于 2022-7-5 17:11:34

请阅读代码发布指南,并编辑代码以包含在代码标签中。
Your Code Here=
Your Code Here
 
 
请在适当的论坛上发布您的问题,我将您的帖子转移到AutoLISP、Visual LISP和DCL论坛。

Roy_043 发表于 2022-7-5 17:20:45

我对“多DText属性块”有点困惑。你是说多行属性吗?

Grrr 发表于 2022-7-5 17:29:22

也许 吧:

(defun C:test ( / *error* oldcmd SS nw limt i e enx next pcnt tcnt )

(defun *error* (m)
        (and oldcmd (setvar 'cmdecho oldcmd))
        (if m (print m)) (princ)
); defun *error*
(and (setq oldcmd (getvar 'cmdecho)) (setvar 'cmdecho 0))
(if
        (and
                (princ "\nSelect blocks to change their attrib width: ")
                (setq SS (ssget "_:L" (list (cons 0 "INSERT") (cons 66 1))))
                (not (initget (+ 2 4)))
                (or (setq nw (getreal "\nNew Text Width for Attribute < 1.0 >: ")) (setq nw 1))
                (not (initget (+ 2 4)))
                (or (setq limt (getreal "\nSpecify the upper limit units < 11.30 >:" )) (setq limt 11.3))
        ); and
        (progn
                (repeat (setq i (sslength SS))
                        (setq e (ssname SS (setq i (1- i))))
                        (setq enx (entget e))
                        (setq next (entnext e))
                        (while (and next (/= (cdr (assoc 0 (setq nextnx (entget next)))) "SEQEND"))
                                (and
                                        (= "ATTRIB" (cdr (assoc 0 nextnx)))
                                        (>= (cdr (assoc 41 nextnx)) limt)
                                        (entupd (cdr (assoc -1 (entmod (subst (cons 41 nw) (assoc 41 nextnx) nextnx)))))
                                        (or (and pcnt (setq pcnt (1+ pcnt))) (setq pcnt 0))
                                ); and
                                (setq next (entnext next))
                                (or (and tcnt (setq tcnt (1+ tcnt))) (setq tcnt 0))
                        ); while
                ); repeat
                (princ (strcat "\nModified " (if pcnt (itoa pcnt) "0") " attributes of " (itoa tcnt) " total, inside of " (itoa (1+ i)) " blocks."))
        ); progn       
        (cond
                ((not SS) (princ "\nNothing selected."))
                ((not nw) (princ "\nAttribute width not specified."))
                ((not limt) (princ "\nUpper limit not specified."))
        ); cond
); if
(and oldcmd (setvar 'cmdecho oldcmd))
(princ)
); defun       




AutosoFreely 发表于 2022-7-5 17:36:40

@Roy_043使用的块是带有可视性的单线动态块。
 
 
我知道,如果我用多行文字创建宽度,那么减少宽度会更容易,但这样一来,输入的方便性也会被消除。块内的文本宽度为标准0.8,最好减少到0.65,但仅限于超出框限制的属性。
 
 
@Grrr似乎什么也没做。
 
 
附件。dwg文件显示了我们使用的一些块以及我希望发生的事情。
 
 
我试图整合另一个lisp的一部分(用于不同的原因),以识别图形中的某些块。
 
 
但遗憾的是,这并不奏效:
 
 
(Defun c:IDEC-FERRULE ( / ss i e v f)
      (if (setq ss (ssget "_X" '((0 . "INSERT")(66 . 1)
   (2 . "TAG_TOP-LEFT,TAG_DOWN-RIGHT,TAG_BOT_FUSE,TAG_TOP_FUSE,TAG_BOTSIDE_FUSE,TAG_TOPSIDE_FUSE `*U*"))))
(repeat (setq i (sslength ss))
   (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
(if (and
   (member (strcase (vla-get-EffectiveName e)) '("TAG_TOP-LEFT" "TAG_DOWN-RIGHT" "TAG_BOT_FUSE" "TAG_TOP_FUSE" "TAG_BOTSIDE_FUSE" "TAG_TOPSIDE_FUSE"))
   (vlax-write-enabled-p e)
         )
   (progn
       (setq v (mapcar '(lambda (x)
      (if(eq (vla-get-textstring x) "") 0 1))
         (vlax-invoke e 'Getattributes)))
      
      (cond
       ( (Setq f (cadr
          (assoc v'(((1 0 0)"Off")
            ((1 1 0)"DEST_1_ONLY" )
      ((1 1 1)"DEST_2_ON" ))))
   ;;   Other Visibility States and conditions   ;:
            )
       (vla-put-value (vl-some '(lambda (z)(if (vla-get-propertyname z) "Visibility1") z)
               (vlax-invoke e 'GetDynamicBlockProperties))
       f      )
             )
      
       ( (equal v '(0 0 0)) (vla-delete e)   )
      
   ;(    or Other condtions here    );
   ;(    or Other condtions here    );
      )
   )
   )
   )
)
(princ)
)
图纸2.dwg

Grrr 发表于 2022-7-5 17:40:39

刚刚测试了我的建议,在左边的一组块上,它似乎有效,但我必须为新的宽度和上限单位输入0.6的值。
误解在于代码期望的是因子值,而不是实际长度。

Roy_043 发表于 2022-7-5 17:50:43

@自动曝光
使用(textbox)函数获取每个属性的当前宽度,并将其与所需/最大宽度进行比较。然后根据需要更改gc 41值(相对X比例因子)。

Lee Mac 发表于 2022-7-5 17:55:42

这篇文章可能会提供一些线索。

AutosoFreely 发表于 2022-7-5 18:05:23

@李·麦克
隐马尔可夫模型。。谢谢,这很有趣。
另外,我刚刚看过您创建的程序,想知道是否有可能反转boundingboxreactorv1-0 lisp。不是根据圆圈的位置或比例增加方框大小,而是根据方框减小圆圈大小?
 
 
这对文本有效吗?文本根据其周围的框大小减小宽度。
页: [1]
查看完整版本: 需要帮助仅选择证书