Jozef13 Posted January 27, 2018 Posted January 27, 2018 Hello, is there a way to select (filter) all arrays from selection set? (Arrays made by arrayrec command) Quote
jamalflash Posted January 28, 2018 Posted January 28, 2018 The AutoCAD considers the array as Block so you can use "filter command" and choose "block" option best regards Quote
Jozef13 Posted January 28, 2018 Author Posted January 28, 2018 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. Quote
Roy_043 Posted January 28, 2018 Posted January 28, 2018 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" ) ) ) Quote
Grrr Posted January 28, 2018 Posted January 28, 2018 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. Quote
Roy_043 Posted January 28, 2018 Posted January 28, 2018 @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? Quote
Roy_043 Posted February 9, 2018 Posted February 9, 2018 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" ) ) ) ) Quote
3dwannab Posted March 28, 2019 Posted March 28, 2019 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) Quote
Roy_043 Posted March 28, 2019 Posted March 28, 2019 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. Quote
3dwannab Posted March 28, 2019 Posted March 28, 2019 1 hour ago, Roy_043 said: case where BricsCAD is not compatible Opps. Sorry to hear that. At least the OP has vanilla AC. Quote
ronjonp Posted March 28, 2019 Posted March 28, 2019 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)) ) 1 Quote
3dwannab Posted March 28, 2019 Posted March 28, 2019 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. Quote
Recommended Posts
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.