ssget filter out arrays?

ssget filter out arrays?

mid-awe
Collaborator Collaborator
1,221 Views
6 Replies
Message 1 of 7

ssget filter out arrays?

mid-awe
Collaborator
Collaborator

Hi all,

 

I have an ssget that allows me to select several blocks including some dynamic blocks, but when I use it, it also selects arrays. I did a quick check and found arrays also have U names. So, can anyone help me change my ssget to filter out arrays? below is my ssget as it is now.

 

(ssget (LIST (cons 0 "INSERT") (CONS 2 "`*U*,PP,P3,PC,FIX,NOZZLE,vecNOZZLE")))

Thanks in advance.

 

0 Likes
Accepted solutions (1)
1,222 Views
6 Replies
Replies (6)
Message 2 of 7

dbroad
Mentor
Mentor
Accepted solution

I don't believe there is a way to use an ssget filter to filter out array objects.  These adhoc objects were designed after ssget was created.  That said, you could loop through a selection set and delete objects that have any of the array methods.  With legacy list, you could test for a dictionary entry for the  ACDBASSOCDEPENDENCY

(cdr(assoc 0(entget(cdr(assoc 330 <array entity>)))))

activex method

;;use the presence of a method to test whether an entity is an array.
(defun isarray (ename)
 (vlax-method-applicable-p
   (vlax-ename->vla-object ename)
   'ArrayPolar))
Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 3 of 7

mid-awe
Collaborator
Collaborator

Thank you. I suspected that is how I would have to approach it, but I was hoping to simply improve my filter.

 

Again, thank you.

0 Likes
Message 4 of 7

mid-awe
Collaborator
Collaborator

Well, unfortunately the first test failed. the result is that arrays are recognized as, "IAcadBlockReference: AutoCAD Block Reference Interface" so that approach failed.

 

FYI,

I have found a way to make my filter work by adding in the Layer. since all nozzles are on the Nozzle layer it works.

 

(SSGET (LIST (CONS 0 "INSERT") (CONS 2 "`*U*,PP,P3,PC,FIX,NOZZLE,vecNOZZLE") (cons 8 "NOZZLE")))

 

Unfortunately, the Array issue is likely to show up again and as long as Arrays are treated like Dynamic Blocks by AutoCAD it will be a problem.

 

Thank you again.

0 Likes
Message 5 of 7

hmsilva
Mentor
Mentor

@mid-awe wrote:

...

Unfortunately, the Array issue is likely to show up again and as long as Arrays are treated like Dynamic Blocks by AutoCAD it will be a problem.

...


Hi mid-awe,

perhaps testing the 'effectivename property, arrays have an 'Anonymous' effectivename...

 

(not (wcmatch (vla-get-effectivename VlaObj) "`*U*"))

 

Hope this helps,
Henrique

EESignature

Message 6 of 7

mid-awe
Collaborator
Collaborator
Thank you Henrique, I'll give that a try too.
0 Likes
Message 7 of 7

dbroad
Mentor
Mentor

Sorry,

 

The activeX method was a guess.  Apparently all blocks and probably all objects have the array methods so that doesn't filter anything out.  This might work (using legacy methods).  It doesn't really guarantee anything since there could be more than one dictionary and I am only testing the first 330 code.  Someone else could add to this method to find if any of the dictionaries references are members of an acdbassocdependency dictionary.

 

Probable partial solution that is not layer dependent.

(defun test ( / ss e ei)
  (if (setq
	ss (SSGET (LIST	(CONS 0 "INSERT")
			(CONS 2 "`*U*,PP,P3,PC,FIX,NOZZLE,vecNOZZLE")
		  )
	   )
      )
    (progn (setq sl (sslength ss))
	   (repeat sl
	     (setq sl (1- sl))		;reuse length as counter
	     (setq e  (ssname ss sl)
		   ei (entget e)
	     )
	     (if (= "ACDBASSOCDEPENDENCY"
		    (cdr (assoc 0 (entget (cdr (assoc 330 ei)))))
		 )
	       (ssdel e ss)
	     )
	   )
    )
  )
  ss
)
Architect, Registered NC, VA, SC, & GA.