Jump to content

Recommended Posts

Posted

Hello,

 

is there a way to select (filter) all arrays from selection set?

(Arrays made by arrayrec command)

Posted

The AutoCAD considers the array as Block

so you can use "filter command" and choose "block" option

best regards

Posted

Hmm,

yes you are right.

But they are anonymous blocks and I have many dynamic blocks in my dwg and they are all almost anonymous. Furthermore my arrays consist of dynamic blocks.

So I am not able to select only arrays which I want to explode.

Posted

This may help:

; (AssocArrayType (car (entsel))) => "R" or "P" or nil
(defun AssocArrayType (enm / lst)
 (if
   (and
     (setq lst (entget enm))
     (vl-position '(0 . "INSERT") lst)
     (wcmatch (strcase (cdr (assoc 2 lst))) "`*U*")
     (setq lst (cdr (member '(102 . "{ACAD_REACTORS") lst)))
     (= (caar lst) 330)
     (setq lst (entget (cdar lst)))
     (vl-position '(0 . "ACDBASSOCDEPENDENCY") lst) ; Required?
     (setq lst (entget (cdr (assoc 330 lst))))
     (vl-position '(0 . "ACDBASSOCACTION") lst) ; Required?
   )
   (if (vl-position '(1 . "AxesAngle") lst)
     "R"
     "P"
   )
 )
)

Posted

Nice Roy!

Maybe it would be good to make sure that the array is polar (if theres a surprise in the newer ACAD versions) :

 

(cond 
 ( (vl-position '(1 . "Radius") lst) "P")
 ( (vl-position '(1 . "AxesAngle") lst) "R")
)

 

Also once for some reason I had "`*T*" block, so till then I always use "`**" pattern for the annonymous block name checking.

Posted

@Grrr:

AFAIK '*T' blocks are used for tables only. When dealing with user input you have to keep 'What if' scenarios in mind of course. But in this particular case I disagree with your suggestion. I am not saying you are wrong but why stop there?

  • 2 weeks later...
Posted

FWIW:

; (KGA_Sys_ArrayType (car (entsel))) => nil/"PATH"/"POLAR"/"RECTANGULAR"
(defun KGA_Sys_ArrayType (enm / elst)
 (if
   (and
     (setq elst (entget enm))
     (vl-position '(0 . "INSERT") elst)
     (wcmatch (cdr (assoc 2 elst)) "`*[uu]*")
     (setq elst (cdr (member '(102 . "{ACAD_REACTORS") elst)))
     (= (caar elst) 330)
     (setq elst (entget (cdar elst)))
     (vl-position '(0 . "ACDBASSOCDEPENDENCY") elst) ; Required?
     (setq elst (entget (cdr (assoc 330 elst))))
     (vl-position '(0 . "ACDBASSOCACTION") elst) ; Required?
   )
   (cond
     ((vl-position '(1 . "FillPath") elst)
       "PATH"
     )
     ((vl-position '(1 . "Radius") elst)
       "POLAR"
     )
     (T
       "RECTANGULAR"
     )
   )
 )
)

  • 1 year later...
Posted

Why not check getpropertyvalue for the value. It can be then easily broken down into the 3 different types or array. If I had time I would add the ability to type a filter option to select an array of your choosing but this may do 99% of use case scenarios.

 

This method is fairly simple without having to dig deep into DXF codes.

 

;; Quick select arrays by 3dwannab 28.03.2019

;; CMDLINE syntax: "QSArrays"

(defun c:--ldQSArrays ( / ) (progn (LOAD "QSArrays") (C:QSArrays)))
(defun c:QSArrays ( / l s ss1 obj )
	(setq ss1 (ssadd))
	(setq l (ssget ":L" '((0 . "*"))))
	(repeat (setq i (sslength l))
		(setq s (ssname l (setq i (1- i))))
		(setq obj (vlax-ename->vla-object s))
		; (print (getpropertyvalue s "ClassName"))
		(if (or
			(wcmatch (getpropertyvalue s "ClassName") "AcDbAssociativePolarArray")
			(wcmatch (getpropertyvalue s "ClassName") "AcDbAssociativePathArray")
			(wcmatch (getpropertyvalue s "ClassName") "AcDbAssociativeRectangularArray")
			)
		(setq ss1 (ssadd s ss1))
		)
		)
	(if (> (sslength ss1) 0)
		(progn
			(sssetfirst nil ss1)
			(princ (strcat "\n: -------------------------\n" (itoa (setq len (sslength ss1))) (if (> len 1) " arrays" " array") " selected.\n: -------------------------\n"))
			)
		(princ (strcat "\n: -------------------------\nNada arrays to be found in selected objects !\n: -------------------------\n"))
		)
	(princ)
	)
(princ)

 

Posted
1 hour ago, 3dwannab said:

Why not...

This must be a case where BricsCAD is not compatible. Dynamic arrays use anonymous blocks as containers in BricsCAD, without any of those class names in the entity list of the block references. Also BC does not have the getpropertyvalue function.

Posted
1 hour ago, Roy_043 said:

case where BricsCAD is not compatible

Opps. Sorry to hear that. At least the OP has vanilla AC. :)

Posted
1 hour ago, 3dwannab said:

Opps. Sorry to hear that. At least the OP has vanilla AC. :)

FWIW .. since you're just looking at arrays I'd think your wcmatch could be as simple as this:

(if (wcmatch (getpropertyvalue s "ClassName") "*Array")
  (setq ss1 (ssadd s ss1))
)

 

  • Like 1
Posted
1 minute ago, ronjonp said:

be as simple as this

Yeah, I noticed that would be fine for all Arrays.

 

Maybe the OP can narrrow down their selection with AcDbAssociativeRectangularArray as there ClassName filter.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...