Jump to content

Recommended Posts

Posted

Is there any easy way, to put an entire drawing on one layer - when its made up of about 100 to start with, the drawing is full of blocks aswell.

 

Im just making some XREFs of a massive site layout

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • Nick-H-

    11

  • alanjt

    9

  • Cadologist

    3

  • CarlB

    1

Top Posters In This Topic

Posted

Yeah it's possible but some of the entities you get you may not prefer (ie: exploded blocks).

 

Explode all the blocks, cross window everything and move it all to the desired layer. That will get everything there, plus if your xrefing it, it's all 'one entity' in your new drawing so that may not be too bad.

 

You 'may' have to do it in multiple stages, as in isolate a layer or layers, and cut/paste at the same coordinates or 'paste to original coordinates' into a new drawing, then move what is already there to a preferred layer, then continue again and again. You would only have to do this if your system is having performance issues or it's crashing while you move everything from the 100 layers to the single one as you are wanting.

 

The other way to do it, with retaining the blocks as 'blocks' (ie: not exploding them) would be to re-create each block so it's going to your preferred layer, then re-insert them, which is heavily time consuming.

 

ADDED NOTE: it's usually not 'preferred' to put everything on a single layer, most CAD users and most users in general prefer to be able to isolate a centerline off or shut off legal lines, turn on power poles and leave gas lines off, whatever it is. I am unaware of your reasoning for putting everything on the same layer as you may have a specific requirement for that.

Posted

:(

 

There should be some easy way, like purge all layers into one

Posted

Maybe the "laymrg" command, to merge all layers into one layer.

Posted

This will not do anything for layers nested within a block:

 

(defun All2Layer (#Layer / #Doc #SS)
 (vl-load-com)
 (cond ((tblsearch "layer" #Layer)
        (vlax-for L (vla-get-layers (setq #Doc (vla-get-activedocument (vlax-get-acad-object))))
          (vl-catch-all-apply
            '(lambda (i) (vla-put-freeze i :vlax-false) (vla-put-lock i :vlax-false))
          ) ;_ vl-catch-all-apply
          (if (setq #SS (ssget "_X" (list (cons 8 (vla-get-name L)))))
            (progn
              (vlax-for x (setq #SS (vla-get-activeselectionset #Doc))
                (vl-catch-all-apply 'vla-put-layer (list x #Layer))
              ) ;_ vlax-for
              (vl-catch-all-apply 'vla-delete (list #SS))
            ) ;_ progn
          ) ;_ if
        ) ;_ vlax-for
        (vla-purgeall #Doc)
        T
       )
 ) ;_ cond
) ;_ defun

Posted
Yeah it's possible but some of the entities you get you may not prefer (ie: exploded blocks).

 

Explode all the blocks, cross window everything and move it all to the desired layer. That will get everything there, plus if your xrefing it, it's all 'one entity' in your new drawing so that may not be too bad.

 

You 'may' have to do it in multiple stages, as in isolate a layer or layers, and cut/paste at the same coordinates or 'paste to original coordinates' into a new drawing, then move what is already there to a preferred layer, then continue again and again. You would only have to do this if your system is having performance issues or it's crashing while you move everything from the 100 layers to the single one as you are wanting.

 

The other way to do it, with retaining the blocks as 'blocks' (ie: not exploding them) would be to re-create each block so it's going to your preferred layer, then re-insert them, which is heavily time consuming.

 

ADDED NOTE: it's usually not 'preferred' to put everything on a single layer, most CAD users and most users in general prefer to be able to isolate a centerline off or shut off legal lines, turn on power poles and leave gas lines off, whatever it is. I am unaware of your reasoning for putting everything on the same layer as you may have a specific requirement for that.

 

Just so I dont have a million layers to flick between when im doing a drawing, we normally just make the building into one xref with one layer IE:

 

Building Layout and put it all on colour no.8

 

then i add layers for all the services, IE: AC, Domestic, Vent, Heating, Etc...

Posted

Yeah that's another way, it doesn't get much easier then cross windowing the whole drawing and then moving it all to the preferred layer (but the blocks won't do that as they will still retain the layer they are on in your layer manager). This may be your only choice. If the building is a 'reference' anyway, doing an explode all and moving everything to a preferred layer, then purging out the rest may work the best.

 

I did a test on laymrg (Layer Merge) and it didn't work for me (like for your issue in this post).

Posted

What i put above, just so i dont have million layers which im not going to use i just need the building on one layer really and them all my services on there own layer

Posted

Nick, did you try what I posted?

(All2Layer "LayerName")

Posted

Yeah for sure, makes complete sense. Personally if it was my drawing, I would explode all the blocks (example, cross window the entire drawing, use the quick select to select 'blocks' then run the explode command). Move everything to the preferred layer of your choice, then run the purge command to clear out all the leftover junk. Save the drawing and use it as an 'xref' into your new drawing to which you will add the services too. That's the most simple way with what you are requiring that I can think of. I've been doing CAD for 15+ years now (for the record) and nothing else is coming into my mind for another option for you.

Posted

No not yet mate, Im just installing ACAD on my PC as I normally use it at work and dont have it installed here Yet

Posted
This will not do anything for layers nested within a block:

 

(defun All2Layer (#Layer / #Doc #SS)
 (cond ((tblsearch "layer" #Layer)
        (vlax-for L (vla-get-layers (setq #Doc (vla-get-activedocument (vlax-get-acad-object))))
          (vl-catch-all-apply
            '(lambda (i) (vla-put-freeze i :vlax-false) (vla-put-lock i :vlax-false))
          ) ;_ vl-catch-all-apply
          (if (setq #SS (ssget "_X" (list (cons 8 (vla-get-name L)))))
            (progn
              (vlax-for x (setq #SS (vla-get-activeselectionset #Doc))
                (vl-catch-all-apply 'vla-put-layer (list x #Layer))
              ) ;_ vlax-for
              (vl-catch-all-apply 'vla-delete (list #SS))
            ) ;_ progn
          ) ;_ if
        ) ;_ vlax-for
        (vla-purgeall #Doc)
        T
       )
 ) ;_ cond
) ;_ defun

 

I Guess this is a Lisp

Posted
I Guess this is a Lisp

Sorry, I just assume everyone knows what do do with Lisp coding.

Yes, paste it into Notepad and save as something.lsp. Make sure you add (vl-load-com) to the top of it.

Once loaded in Autocad, you can execute with

(All2Layer "LayerName")

Posted
Sorry, I just assume everyone knows what do do with Lisp coding.

Yes, paste it into Notepad and save as something.lsp. Make sure you add (vl-load-com) to the top of it.

Once loaded in Autocad, you can execute with

(All2Layer "LayerName")

 

 

Make sure you add (vl-load-com) to the top of it.

Posted
Make sure you add (vl-load-com) to the top of it.

 

Just copy it again, I added it to the code. It loads the vlisp arx support and I don't generally add it to subroutines.

Posted

sorry If im being simple, but them what do you do once you have loaded it

Posted
sorry If im being simple, but them what do you do once you have loaded it

 

Type:

(All2Layer "LayerName")

Where "LayerName" is the name of the layer you want to move everything to (must exist).

 

It's just a subroutine.

Posted

I must be doing something wrong as its not working, and saying Unknown command when i type it in

Posted

this is what is in my lisp

 

(defun All2Layer (#Layer / #Doc #SS)

(vl-load-com)

(cond ((tblsearch "layer" #Layer)

(vlax-for L (vla-get-layers (setq #Doc (vla-get-activedocument (vlax-get-acad-object))))

(vl-catch-all-apply

'(lambda (i) (vla-put-freeze i :vlax-false) (vla-put-lock i :vlax-false))

) ;_ vl-catch-all-apply

(if (setq #SS (ssget "_X" (list (cons 8 (vla-get-name L)))))

(progn

(vlax-for x (setq #SS (vla-get-activeselectionset #Doc))

(vl-catch-all-apply 'vla-put-layer (list x #Layer))

) ;_ vlax-for

(vl-catch-all-apply 'vla-delete (list #SS))

) ;_ progn

) ;_ if

) ;_ vlax-for

(vla-purgeall #Doc)

T

)

) ;_ cond

) ;_ defun

 

 

 

then I typed all2layer"viewport"

Posted
I must be doing something wrong as its not working, and saying Unknown command when i type it in

 

It must be typed in exactly as I've posted. Since it's a subroutine, you have to include the parens.

(All2Layer "LayerName")

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...