Announcements

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

Copying layers to another drawing

philippe_heon
Explorer

Copying layers to another drawing

philippe_heon
Explorer
Explorer

Hello, Autocad Newbie here. Pretty good with inventor though!! 😉

 

I am trying to copy some layers from one drawing to another drawing as there is so much items on those layers that copy/paste would be insane.

 

I tried using DC and dragging the layers i wanted into the currently open drawing that needs them. When i do, i see: "layers added". I then go into DC again on the current drawing and i don't see them nor do they appear in the drop down menu of the layers. 

 

I did manage one time to see the layers in DC but they would not appear in the drop down menu so i didn't save the file. 

 

Why is the DC method not working? Any other way i could do this as i have multiple layers from different drawing that i need to copy to our main drawing. 

 

Any help would be greatly appreciated. 

 

Thanks, 

0 Likes
Reply
1,450 Views
32 Replies
Replies (32)

JBerns
Advisor
Advisor

@philippe_heon,

 

You just want the layer definitions copied, not the content of the layers, correct?

 

If so, I would expect DesignCenter (DC) to be the correct tool.

 

Try the COPYCLIP command to copy gemoetry from the first drawing to the clipboard. Then switch to second drawing and type PASTECLIP to paste the geometry. Did it bring the layer info with it?

 

Try using DC in a smaller drawing to ensure the tool does work. Perhaps DC is having problems with a drawing having so many layers, but I am not aware of any limitations.

 

Let us know.

 

Regards,

Jerry

 

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes

philippe_heon
Explorer
Explorer

Sorry for not being clear enough in my first post.

 

Basically, i would want all the contents of each layers to be copied. what you see and unsee when you click on the lightbulb in the layers drop down menu.  Is that doable?

0 Likes

timothy_crouse
Collaborator
Collaborator

You can use design center or the steal from drawing lisp created by Mac Lee.

 

There are a few more ways to do this too but not knowing exactly and only working in general terms the DC and Lisp would be the easiest to get the job done.  If you have problems reach out again 

 

When copying large amounts of data it is beneficial / good practice to paste the objects into a temp working drawing, purge and save the file Ctrl + S twice in a row to help clear out garbage before you paste it into the desired drawing.

 

Best Regards

-Tim C. 

0 Likes

paullimapa
Mentor
Mentor

Check out Lay2Dwg lisp

https://www.cadforum.cz/en/qaID.asp?tip=3682


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

JBerns
Advisor
Advisor

@philippe_heon

 

Is this a one-time task you need to complete? If so, select geometry in drawing 1, use COPYCLIP command, switch to second drawing, and then use PASTECLIP command.

 

When using DesignCenter to copy layers, it only copies layer names and properties (color, linetype, etc.). Layers can be copied whether Frozen or Off.

 

If you are trying to automate a copy process from one drawing to another with code, then the suggestions above are advised.

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes

philippe_heon
Explorer
Explorer

Thanks for all the replies guys! Awesome community here! 

 

I will have about 20 drawings that i need to take stuff from and put it on the main drawing. I guess I'll look into the LISP thing suggested here and report back tomorrow. Kids stuff to attend to for now! 

0 Likes

timothy_crouse
Collaborator
Collaborator
If you find yourself dealing with migrating or changing multiple drawings as part of your daily workflow I would suggest you look into to using scripts as well.



Very useful to perform repetitive tasks on multiple drawings, could easily turn hours or days or work into minutes once the kinks are worked out. Scripts and Lisps are useful to keep things standardized between drawings as well as reducing man hours.



Autodesk provided a free script to that is still available around the web or something like hurricane at 74mph com is really handy:

Autodesk Customization Conversion Tools<>



Also Dotsoft offers Super Script

AutoCAD Script Generator - SuperScript 2.0 (dotsoft.com)<>

Another group offers batch script processor

CADfx, Inc. Custom Programming and CAD Utilities<>



Lee Mac Script tutorial:

An Introduction to Script Writing | Lee Mac Programming (lee-mac.com)<>

Lee Mac Script Utility

Script Writer | Lee Mac Programming (lee-mac.com)<>







Best Regards

-Tim C.


Kent1Cooper
Consultant
Consultant

@philippe_heon wrote:

....

I tried using DC and dragging the layers i wanted into the currently open drawing that needs them. When i do, i see: "layers added". I then go into DC again on the current drawing and i don't see them nor do they appear in the drop down menu of the layers. 

.... 


For that issue, make sure that in the full Layer Manager, you have it filtered to show All Layers:

Kent1Cooper_0-1705258931223.png

If you have it set to All Used Layers, that would explain your not seeing the ones you just brought in with the Design Center.  The same filtering applies in both the Layer Manager and the pull-down in the Layer area of the ribbon.

 

[But that's about only the Layers themselves, not things drawn on them, which is why Layers brought in that way are not yet "Used."  So if you're transferring drawn content, that's another matter.]

Kent Cooper, AIA

timothy_crouse
Collaborator
Collaborator

see atttached

0 Likes

timothy_crouse
Collaborator
Collaborator

I think DC is only transferring the layers, not the layer objects.

 

Another technique would be to group all the objects into a block then use DC to bring the block over.

 

Turn everything off but the layers you want.

Right click select all or Ctrl A may work

Copy with base point

Ctrl + Shift + V to paste as block

Rename the block

Use DC to bring the block across.

 

Many other way to do this as well.  Autocad generally does a good job of copying large amounts of data across the clippboard.  There's no reason that shouldn't work either.

 

But again, I would recommend pasting into a clean drawing and purging stuff then re-copying and paste into final drawing.

 

Best Regards

-Tim C.

 

 

 

0 Likes

ennujozlagam
Mentor
Mentor

try LMAN command?





Remember : without the difficult times in your LIFE, you wouldn't be who you are today. Be grateful for the good and the bad. ANGER doesn't solve anything. It builds nothing, but it can destroy everything...
Please mark this response as "Accept as Solution" if it answers your question. Kudos gladly accepted.
0 Likes

philippe_heon
Explorer
Explorer

Ok so me again. Tried the Lisp thing. So now i can see the layers in my main drawing. I want the "Panneau PLC, Panneau PU and Panneau PR. Sorry it's in french as i'm in Montréal Quebec!

 Layers_001.jpg

 

I did go and put All layers and not Used layers but still. 

 

Layers_004.jpg

 

So this is the layer that i want with all the little stop signs inside the shop. They basically tell you where all the

electric panels are. There are a ton of them in the shop:

 

Layers_002.jpg

And even after the LISP thingy, layers said to be on, i don't see anything in the main drawing:

 

Layers_003.jpg

 

So i really don't know what else to try or something i'm missing? 

 

Again you guys are awesome. Thanks to all really! 

0 Likes

paullimapa
Mentor
Mentor

It's possible that those red stop signs are blocks with their own layers which means you'll have to somehow select those layers also.

If you can share a sample of the drawing with those red stop signs then we can take a look.

 


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

philippe_heon
Explorer
Explorer

Well i did get the 3 layers i wanted and all the blocks in that drawing. Still nothing shows up on the main drawing.

 

Attached is the file where i want to take the 3 layers and all that's in it. 

 

Panneau PLC

Panneau PU

Panneau PR

 

Flick them on and off and you'll see what i want to transfer to my main drawing. 

 

Hoping this will help. 

0 Likes

paullimapa
Mentor
Mentor

so I created this quick wbly.lsp function to select all objects found on those layers and place them in a new drawing attached which does show those red stop signs:

; wbly wblock given layer names to separate New Block drawing name in current drawing folder
; OP:
; https://forums.autodesk.com/t5/autocad-forum/copying-layers-to-another-drawing/m-p/12498239#M1122747
(defun c:wbly (/ dwg lyrlst ss wblnam)
  (setq 
        lyrlst "Panneau PLC,Panneau PU,Panneau PR" ; layer names separated by comma
        dwg "New Drawing"                          ; name of new drawing
        wblnam (strcat (getvar"dwgprefix") dwg)    ; wblock location
  )
  (vl-load-com)
  (if(setq ss(ssget "_X" (list (cons 8 lyrlst))))  ; select all objects found in given layer names
    (progn
     (vl-cmdf "_.Undo" "_M")                       ; set undo mark
     (vl-cmdf "_.Layer" "_Unlock" "*" "_T" "0" "_On" "0" "_Set" "0" "") ; unlock all layers, thaw/on/set layer 0
     (vl-file-delete (strcat wblnam ".dwg"))       ; delete if existing new drawing name found
     (vl-cmdf "_.Wblock" wblnam "" (getvar"insbase") ss "") ; wblock found objects to new drawing
     (princ (strcat "\nLayers [" lyrlst "] Written To Dwg [" wblnam "]")) 
     (vl-cmdf "_.Undo" "_B")                       ; undo back to original settings
    )
    (princ (strcat"\nNo Objects Found in Folowing Layers: [" lyrlst "]"))
  ) ; if
  (princ)
) ; defun wbly

paullimapa_0-1705356036053.png

 

 


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

philippe_heon
Explorer
Explorer

Ok this is great honestly, but how do I add it to my main drawing as a layer so i can flick it on and off?

0 Likes

paullimapa
Mentor
Mentor

If you don’t have any other objects on those layers in your main drawing then just drag & drop the new drawing directly into the main drawing then it’ll become part of it. You could even use the Explode command so all the objects are now back as separate and not as one. If you do Explode it I would follow up with the Purge command and select under Blocks to purge new drawing from the main dwg


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

paullimapa
Mentor
Mentor

Now if you want to have control of all three of these layers as if it’s on a single layer then after dragging & dropping new drawing into the main drawing don’t explode it but instead create a whole new layer and change the new drawing block onto that new layer. Now you can freeze just that new layer and the entire new drawing will be gone until you thaw that new layer to bring it back. 


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

JBerns
Advisor
Advisor

@philippe_heon,

 

Going back to your original post, I understand you want to copy objects from one drawing to another by selecting objects based on their layer.

 

You said that copy/paste would be insane, but perhaps you meant selecting objects on multiple layers would be insane (tedious).

 

I found this routine that allows you to select objects on various layers. After selecting objects, press ENTER twice and the objects are now on the clipboard. Use COPYCLIP, switch drawings, and then PASTECLIP.

 

I don't think it can get much simpler until someone figures how to automatically switch to a destination drawing which is complicated if you have more than two drawings open at a time.

 

Here is the page:

https://www.cadtutor.net/forum/topic/483-need-lisp-program-to-select-all-objects-in-layer/ 

 

Look for the code posted by CAB.

 

If you need to copy the same layers every time, then Paul's code above should work well.

 

Hope this is helpful.

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes