我成功地编写了这段代码,它允许我更改对象的注释比例(AnnotationScale)。
当前问题:
-LISP使用“box”选择,这使我能够手动选择对象。我需要LISP来选择此时可见的所有对象。
我已经试过了(ssget“_A”),但这也会选择具有注释比例(AnnotationScale)的不可见对象。我需要它只选择当前活动annotationscale的所有对象。
而且
-LISP需要选择1:1的比例,然后才能继续进行1:2的翻译。如果没有annoscale为1:1的对象,我如何让LISP继续?有点像“没有那么大比例的物体”。然后继续。。。
希望有人能帮忙!
- (defun c:OBJECTSCHALENVERVANGEN ()
- (command "UNDO" "begin")
- (setvar 'annoallvisible 0)
- (command "_SchalenMaken" "ME")
- (SCHALEN1NEW)
- (SCHALEN2NEW)
- (command "CANNOSCALE" "NLCS_M_1:2")
- (command "undo" "end")
- )
- (defun SCHALEN1NEW ( / cmd ent idx lst scl sel )
- (command "CANNOSCALE" "NLCS_M_1:1")
- (cond
- ( (= 1 (getvar 'cvport))
- (princ "\nThis command is only available in Modelspace.")
- )
- (
- (setq scl (getvar 'cannoscale)
- )
- (command "CANNOSCALE" "HB 1:1")
- (setq sel (ssget "_:L" '((0 . "*TEXT,*DIMENSION,INSERT,HATCH,MULTILEADER"))))
- (repeat (setq idx (sslength sel))
- (if (setq ent (ssname sel (setq idx (1- idx)))
- lst (LM:annoscales ent)
- )
- (progn
- (if (not (member scl lst))
- (command "_.-objectscale" ent "" "_a" "NLCS_M_1:1" "")
- )
- (if (not (member scl lst))
- (command "_.-objectscale" ent "" "_d" "HB 1:1" "")
- )
- )
- )
- )
- (command "CANNOSCALE" "NLCS_M_1:1")
- )
- )
- (princ)
- )
- (defun SCHALEN2NEW ( / cmd ent idx lst scl sel )
- (command "CANNOSCALE" "NLCS_M_1:2")
- (cond
- ( (= 1 (getvar 'cvport))
- (princ "\nThis command is only available in Modelspace.")
- )
- (
- (setq scl (getvar 'cannoscale)
- )
- (command "CANNOSCALE" "HB 1:2")
- (setq sel (ssget "_:L" '((0 . "*TEXT,*DIMENSION,INSERT,HATCH,MULTILEADER"))))
- (repeat (setq idx (sslength sel))
- (if (setq ent (ssname sel (setq idx (1- idx)))
- lst (LM:annoscales ent)
- )
- (progn
- (if (not (member scl lst))
- (command "_.-objectscale" ent "" "_a" "NLCS_M_1:2" "")
- )
- (if (not (member scl lst))
- (command "_.-objectscale" ent "" "_d" "HB 1:2" "")
- )
- )
- )
- )
- (command "CANNOSCALE" "NLCS_M_1:2")
- )
- )
- (princ)
- )
- ;; Returns a list of all annotative scales associated with a supplied entity
- (defun LM:annoscales ( ent / dic enx itm rtn )
- (if
- (and
- (setq enx (entget ent))
- (setq dic (cdr (assoc 360 (cdr (member '(102 . "{ACAD_XDICTIONARY") enx)))))
- (setq dic (cdr (assoc -1 (dictsearch dic "acdbcontextdatamanager"))))
- (setq dic (cdr (assoc -1 (dictsearch dic "acdb_annotationscales"))))
- )
- (while (setq itm (dictnext dic (not itm)))
- (setq rtn (cons (cdr (assoc 300 (entget (cdr (assoc 340 itm))))) rtn))
- )
- )
- (reverse rtn)
- )
- (princ)
|