Create list of Layergroups

Create list of Layergroups

niels_dedecker
Explorer Explorer
690 Views
6 Replies
Message 1 of 7

Create list of Layergroups

niels_dedecker
Explorer
Explorer

Greetings,

 

i'm trying to create a lisp to print multiple pdf's from one drawing based on the amount of Layergroups.

they are old drawings that contain several grouplayers wich each containing a component:

niels_dedecker_0-1679397421508.png

"base layergroup" is the group that contains stuff like the frame and logo of the template and the others are seperate components.

so the main goal is to freeze all, thawn "base layergroup", thawn "1" and print; next  freeze all, thwan "base layergroup", thawn "1A" and print; ... .

 

the major problem is that all the drawings i recieve all have layergroups but rarly the same name aside from "base layergroup", so i'm trying to first extract a list of layergroups and starting the loop of printing till all layergroups are done.

 

i've scoured allot of forums and i did find something from Mac Lee to generate a list of layergroups but i'm unable to get it working. i've tried allot myself but i'm unable to find the location of these layergroups...

0 Likes
691 Views
6 Replies
Replies (6)
Message 2 of 7

ronjonp
Mentor
Mentor

It would help to upload a sample drawing and the code that you found from Lee.

0 Likes
Message 3 of 7

niels_dedecker
Explorer
Explorer

My appologies, i'm not used to posting on forum myself 🙂

 

In the attachment you can find a very trimmed version of a simple drawing i recieve and this is the code that i found from Lee:

(defun LM:grouplayerfilters nil
   (   (lambda ( foo ) (foo (entget (cdr (assoc 330 (entget (tblobjname "layer" "0")))))))
       (lambda ( enx / dic itm rtn )
           (and (setq dic (cdr (assoc 360 (member '(102 . "{ACAD_XDICTIONARY") enx))))
                (setq dic (cdr (assoc -1  (dictsearch dic "aclydictionary"))))
                (while (setq itm (dictnext dic (not itm)))
                    (if (= "AcLyLayerGroup" (cdr (assoc 1 itm)))
                        (setq rtn (cons (cons (cdr (assoc 300 itm)) (foo itm)) rtn))
                    )
                )
           )
           (reverse rtn)
       )
   )
)

 

0 Likes
Message 4 of 7

komondormrex
Mentor
Mentor

i can't found no layer group in attached sample.

0 Likes
Message 5 of 7

niels_dedecker
Explorer
Explorer

Maybe it's because i use Autocad Mechanical ? "AMLAYERGROUP" should give you the selection

0 Likes
Message 6 of 7

sachindkini
Advocate
Advocate
0 Likes
Message 7 of 7

niels_dedecker
Explorer
Explorer

Thanks for the reply Sachinidkini but i've found that one aswell but that works for Layer filters or something.

Apparently the Layergroups i get from command AMLAYERGROUP is something different 😞

0 Likes