Select objects by property

Select objects by property

samyg
Enthusiast Enthusiast
1,684 Views
6 Replies
Message 1 of 7

Select objects by property

samyg
Enthusiast
Enthusiast

Is there a quick way to select objects by a property and Isolate them, for example:

Select all  pipes and components where Material (P3D) is SS and Isolate them for a following operation like Ortho.

I tried filtering via DATAMANAGER but whatever is filtered is not selected yet.  Using AutoCAD Quick Select  can be done by object type, so you have to repeat for all object types (Pipes, Inline Assets ...)

0 Likes
1,685 Views
6 Replies
Replies (6)
Message 2 of 7

pendean
Community Legend
Community Legend
QSELECT and FILTER commands are the built in tools for the task.

0 Likes
Message 3 of 7

jabowabo
Mentor
Mentor

There's not really a great built-in way to do this but you can use LISP to get many of the properties:

; [email protected]
; 
(defun c:P3dFindByProp ( / selPick selAll selProp itemProp)
  (vl-load-com)
  (setq selPick(ssadd))
  (setq selProp "Spec"); propety name here
  (setq selMatch "G2H"); value to match
  
   (if (setq selAll (ssget "x" '((0 . "ACPP*"))))
        (progn
            (setq i 0
                  n (sslength selAll)
            )
            (while (< i n)
				(setq ent (ssname selAll i)) 
				;convert to vl object
				(setq vlaObj (vlax-ename->vla-object ent))
				(if (vlax-property-available-p vlaObj selProp)
				(progn
					(setq itemProp (vlax-get-property vlaObj selProp))
					(if (= itemProp selMatch)
						(ssadd ent selPick)
					)
				)
				)
				(setq i (1+ i))
            );while
        )
    )
	
  (sssetfirst nil selPick) 
  (princ)
)

Available Plant 3D properties to search:

;   InsulationThickness
;   InsulationType
;   LineNumberTag 
;   MaterialCode
;   PartFamilyLongDesc
;   PnPClassName
;   PnPMaterial
;   PressureClass
;   Schedule
;   Service
;   Size
;   Spec
;   Status
;   Tag
;   TieInNumber
Message 4 of 7

samyg
Enthusiast
Enthusiast

Thanks for your efforts.

I will try it.

SAmy

0 Likes
Message 5 of 7

marcus.zavala26CZM
Participant
Participant

Is this selection restricted to those available P3D properties? How would I go about selecting by a custom property? Any help appreciated!!

0 Likes
Message 6 of 7

jabowabo
Mentor
Mentor

Edit: This would exclude custom properties.

 

I believe that it will work with all VLA-Object properties. These can be found by running this LISP on an object:

 

credit: @Lee_Mac 

 

;;---------------------=={ Dump Object }==--------------------;;
;;                                                            ;;
;;  Lists the properties & methods of a supplied VLA-Object   ;;
;;  or VLA-Object equivalent of a supplied ename or DXF list. ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2013 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  obj - VLA-Object, Entity Name, or Entity DXF List         ;;
;;------------------------------------------------------------;;

(defun c:dump  nil (LM:dump (car (entsel))))
(defun c:dumpn nil (LM:dump (car (nentsel))))

(defun LM:dump ( obj )
    (cond
        (   (or (= 'ename (type obj))
                (and (listp obj) (= 'ename (type (setq obj (cdr (assoc -1 obj))))))
            )
            (vlax-dump-object (vlax-ename->vla-object obj) t)
        )
        (   (= 'vla-object (type obj))
            (vlax-dump-object obj t)
        )
    )
    (princ)
)
(vl-load-com) (princ)

 

 

 

Message 7 of 7

Michiel.Valcke
Advisor
Advisor
Quick Select also lets you sort/filter/select on custom properties
0 Likes