Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Change Tag Layer (color) in a Block

sapien.nyc
Participant

Change Tag Layer (color) in a Block

sapien.nyc
Participant
Participant

Hi, I am working in cad files that are exported from ArchiCAD. I am able to change most of the layers to my own system, with the exception of door tags and other tags that are blocks. The tag show as this green color, even after I changed the block to my own layer, and I can't find how to change the tag to my own layer. Can someone help? Thank you!

 

sapiennyc_0-1715722898344.png

 

0 Me gusta
Responder
Soluciones aceptadas (1)
938 Vistas
11 Respuestas
Respuestas (11)

paullimapa
Mentor
Mentor

Can you share a sample portion of the dwg with these tags and the layer name you prefer them to go onto?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Me gusta

sapien.nyc
Participant
Participant

You can download a copy/paste version of it here. All the ds- layers are my layers, and all the A- layers come from ArchiCAD.

 

https://darrenvinci.net/s/9832-sample.dwg

0 Me gusta

paullimapa
Mentor
Mentor

Run the attached code and select all to change the attribute layers to match with the corresponding block layer and color to bylayer.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Me gusta

sapien.nyc
Participant
Participant

How do I run it? :cara_sonriente_con_la_boca_abierta_y_sudor_frío:

0 Me gusta

paullimapa
Mentor
Mentor
Solución aceptada

Save the Attedlab.lsp to one of the AutoCAD Support File Search Path found under command Options>Files tab

paullimapa_1-1715746509676.png

Then at command prompt enter:

(load"Attedlab")

Then to run the command enter:

Attedlab

ALL

Hit Enter (2x)

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos

sapien.nyc
Participant
Participant

wow it did it! thank you so much

0 Me gusta

paullimapa
Mentor
Mentor

glad to have helped...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Me gusta

sapien.nyc
Participant
Participant

Hi Paul,

 

I kept working on the file's elevations. I used the LSP files you made to change the text to the layer's color and shrink their size. Great! But this time the circles of the tags are still on a different layer from the tag's layer, and each of them is a separate block! Can you help write a LSP that will change the layer of the circles to match the blocks? I placed a cloud around the drawing w/ the issue. Thanks in advance!

 

@paullimapa 

0 Me gusta

paullimapa
Mentor
Mentor

I found this lisp routine norm.lsp that should change all the objects inside blocks to layer 0. Give this a try:

https://www.cadtutor.net/forum/topic/962-lisp-for-changing-all-objects-in-a-block-to-layer-quot0quot...

(defun c:norm (/ *error* adoc lst_layer func_restore-layers)
 (defun *error* (msg)
   (func_restore-layers)
   (vla-endundomark adoc)
   (princ msg)
   (princ)
   ) ;_ end of defun

 (defun func_restore-layers ()
   (foreach item lst_layer
     (vla-put-lock (car item) (cdr (assoc "lock" (cdr item))))
     (vl-catch-all-apply
       '(lambda ()
          (vla-put-freeze (car item) (cdr (assoc "freeze" (cdr item))))
          ) ;_ end of lambda
       ) ;_ end of vl-catch-all-apply
     ) ;_ end of foreach
   ) ;_ end of defun

 (vl-load-com)
 (vla-startundomark
   (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
   ) ;_ end of vla-startundomark
 (vlax-for item (vla-get-layers adoc)
   (setq lst_layer (cons (list item
                               (cons "lock" (vla-get-lock item))
                               (cons "freeze" (vla-get-freeze item))
                               ) ;_ end of list
                         lst_layer
                         ) ;_ end of cons
         ) ;_ end of setq
   (vla-put-lock item :vlax-false)
   (vl-catch-all-apply '(lambda () (vla-put-freeze item :vlax-false)))
   ) ;_ end of vlax-for
 (vlax-for blk (vla-get-blocks adoc)
   (if (and (equal (vla-get-islayout blk) :vlax-false)
            (equal (vla-get-isxref blk) :vlax-false)
            ) ;_ end of and
     (progn
       (vlax-for subent blk
         (vla-put-layer subent "0")
         (vla-put-color subent 0)
         (vla-put-lineweight subent aclnwtbyblock)
         (vla-put-linetype subent "byblock")
         ) ;_ end of vlax-for
       ) ;_ end of progn
     ) ;_ end of if
   ) ;_ end of vlax-for
 (func_restore-layers)
 (vla-endundomark adoc)
 (princ)
 ) ;_ end of defun

Before running norm.lsp this is how your tag's with circles look like:

paullimapa_0-1718067860485.png

After running norm.lsp this is now the look after a REGEN:

paullimapa_1-1718067930170.png

 

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos

sapien.nyc
Participant
Participant

Worked as usual. You are awesome!

0 Me gusta

paullimapa
Mentor
Mentor

glad to have helped again...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Me gusta