@F.Camargo wrote:
...
SelectSimilar command select just one at the time.
And I'd like to select all the lines, polylines, arc and circle.
..
I think its a pity that its not possible. Sometime it is useful -- In my case, if I am sorting the line work coming from converted dgn, I usually convert all the line work to polylines first to take further benefit of quick selecting using SelectSimilar by other properties then object type -- usually by layer, color a linetype.
Anyway, I thought I might be a nice routine to add this feature (and still keep the setting of the original Select Similar command.
Notes:
- ignors object type differences
- ignors object style (selectsimilarmode 62)
- ignors object name (selectsimilarmode 128)
- no object pre-selection allows you change the setting (using the original Select Similar setting dialog)
- object pre-selection skips the setting
- multiple selection allowed
;; the routine takes the setting from built-in SelectSimilar command except
;; - ignors object type differences
;; - ignors object style (selectsimilarmode 62)
;; - ignors object name (selectsimilarmode 128)
;; BeekeeCZ 2018-01-25
(vl-load-com)
(defun c:SSTypeIgnored ( / lst ss sn mode mods i new old ed en)
(if (and (or (>= (atof (getvar 'acadver)) 18.1)
(prompt "\nError: The routine is using the setting of the SelectSimilar command available since AutoCAD 2011."))
(or (and (not (ssget "_I"))
(vl-cmdf "_.SELECTSIMILAR" "_Settings" ""))
T)
(setq ss (ssget))
(setq mode (getvar 'selectsimilarmode)
mods (mapcar 'cdr (vl-remove-if-not '(lambda (m) (= (car m) (logand mode (car m))))
'((1 . 62)
(1 . 420)
(2 . 8)
(4 . 6)
(8 . 48)
(16 . 370)
(32 . 390)))))
)
(progn
(repeat (setq i (sslength ss))
(setq ed (entget (ssname ss (setq i (1- i)))))
(foreach m mods
(setq new (cond ((assoc m ed)
(cdr (assoc m ed))))
lst (if (setq old (assoc m lst))
(subst (cons m (if (member new (cdr old))
(cdr old)
(cons new (cdr old))))
old
lst)
(cons (list m new) lst)))))
(setq sn (ssadd)
ss (ssget "_X" (list (cons 410 (getvar 'CTAB)))))
(repeat (setq i (sslength ss))
(setq ed (entget (setq en (ssname ss (setq i (1- i))))))
(if (not (member 'nil (mapcar '(lambda (x) (member (cond ((assoc (car x) ed)
(cdr (assoc (car x) ed))))
(cdr x)))
lst)))
(ssadd en sn)))
(vla-regen (vla-get-activedocument (vlax-get-acad-object)) 1)
(princ (strcat "\nMatching by: "
(vl-string-trim ", " (apply 'strcat (mapcar 'cdr (vl-remove-if-not
'(lambda (m) (= (car m) (logand mode (car m))))
'((1 . "COLOR, ") (2 . "LAYER, ") (4 . "LineType, ") (8 . "LT Scale, ") (16 . "LineWeight, ") (32 . "PlotStyle, "))))))))
(sssetfirst nil sn)))
(princ)
)