mstg007 发表于 2015-9-16 09:18:33

重置-删除所有对象的所有注释性比例

好吧。对这个不感兴趣。有人能帮我解决这个问题吗?哈哈。我有几个mtext、dtext、维度、mLead,它们都有不同的比例。我所要做的就是删除这些对象中的所有比例,除了当前的比例。
**** Hidden Message *****

Crank 发表于 2015-9-16 13:54:34

我确信这可以做得更好,但这是我使用的:
(defun c:OnlyCScale (/ l3 l4 l5 l6 l7 SS CS n waarden ent lijst)
        (setq SS (ssget "I"))
        (command ".undo" "begin")
        (while (not SS)(setq SS (ssget)))
        (command ".chprop" ss "" "Annotative" "y" "")
        (setq CS (getvar "CANNOSCALE"))
        (command "-OBJECTSCALE" SS "" "Add" CS "")
        (setq n 0 lijst '())
        (repeat (sslength SS)
                (setq ent (ssname SS n))
                (setq waarden (get_ent_scales (entget ent)))
                (if waarden (setq lijst (append waarden lijst)))
                (setq n (1+ n))
        )
       
        (setq lijst (remove_doubles lijst))
       
        (foreach n lijst
                (if (/= n CS)(progn
                        (if (= (strlen n) 3)(setq l3 (vl-sort (cons n l3)'<)))
                        (if (= (strlen n) 4)(setq l4 (vl-sort (cons n l4)'<)))
                        (if (= (strlen n) 5)(setq l5 (vl-sort (cons n l5)'<)))
                        (if (= (strlen n) 6)(setq l6 (vl-sort (cons n l6)'<)))
                        (if (= (strlen n) 7)(setq l7 (vl-sort (cons n l7)'<)))
                        (command "-OBJECTSCALE" SS "" "Del" n "")
                ))
        )
        (setq lijst (append l3 l4 l5 l6 l7))
        (princ (strcat "\n\nThis scale was added " CS))
        (if lijst (progn
                (princ "\nand these have been removed:")
                (foreach n lijst (princ (strcat " " n)))
        ))
        (command ".undo" "end")
        (princ)
)
(defun remove_doubles (lst); by Gile
        (if lst (cons (car lst) (remove_doubles (vl-remove (car lst) lst))))
)
(defun get_ent_scales (ent / annotative lijst n schalen collect)
        ; zie ook: http://www.theswamp.org/index.php?topic=24171.0
        (defun collect (key lijst / n return)
                (foreach n lijst
                        (if (= key (car n))
                                (setq return (cons (cdr n) return))
                        )
                )
                return
        )
        (setq annotative (cdr (assoc 360 ent)))
        (if annotative (progn
                (setq lijst
                        (entget (cdr (assoc 350
                                (entget (cdr (assoc 360
                                        (member '(3 . "AcDbContextDataManager"); Get the right 360-code
                                                (entget annotative)
                                        )
                                )))
                        )))
                )
                (foreach n (collect 350 lijst)
                        (setq schalen        (cons
                                                                (cdr (assoc 300 (entget (cdr (assoc 340 (entget n))))))
                                                                schalen
                                                        )
                        )
                )
                schalen
        ))
)

mstg007 发表于 2015-9-16 15:23:23

哥们儿。你真棒。非常感谢!
页: [1]
查看完整版本: 重置-删除所有对象的所有注释性比例