Author Topic: All Layers to ByLayer  (Read 3484 times)

0 Members and 1 Guest are viewing this topic.

Jeff_M

  • King Gator
  • Posts: 3946
  • C3D user & customizer
Re: All Layers to ByLayer
« Reply #15 on: August 16, 2007, 03:03:47 PM »
I did a similar thing in lisp a few years ago, except it goes beyond what you can do with the Properties Palette. Such as unlocking any unlocked layers first, includes all objects in all layouts and in all blocks, then resets any locked layers.

Guest

  • Guest
Re: All Layers to ByLayer
« Reply #16 on: August 16, 2007, 03:07:09 PM »
I did a similar thing in lisp a few years ago, except it goes beyond what you can do with the Properties Palette. Such as unlocking any unlocked layers first, includes all objects in all layouts and in all blocks, then resets any locked layers.

Wasn't that "All2ByLayer"?  I think I used/modified something like that of yours, but alas, now that 2008 has SETBYLAYER, well..... I just don't need it anymore.  I hope you understand.  It's not you; it's me.   :lol:

deegeecees

  • Guest
Re: All Layers to ByLayer
« Reply #17 on: August 16, 2007, 03:07:16 PM »

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: All Layers to ByLayer
« Reply #18 on: August 16, 2007, 03:08:31 PM »
Here is what I use, modify to suit
Code: [Select]
Public Sub Everythingbylayer()

      Dim objSelected As Object
      Dim OBJSELSET As AcadSelectionSet
      Dim N As Integer

      On Error GoTo ERR_HAND
      ThisDrawing.SetVariable "CECOLOR", "BYLAYER"
      ThisDrawing.SetVariable "CELTYPE", "BYLAYER"
      Set OBJSELSET = ThisDrawing.SelectionSets.Add("EBL")
      OBJSELSET.Select acSelectionSetAll

      For Each objSelected In OBJSELSET
            objSelected.color = acByLayer
            objSelected.Linetype = "ByLayer"
            objSelected.Lineweight = acLnWtByLayer
            objSelected.Update
      Next

      ThisDrawing.SelectionSets.Item("EBL").Delete
      ZoomExtents
      ThisDrawing.Application.Update
Exit_Here:
      Exit Sub
ERR_HAND:
      Select Case Err.Number
            Case -2145320851
                  ThisDrawing.SelectionSets("EBL").Delete
                  Resume
            Case -2145386413
                  Resume Next
            Case Else
                  MsgBox Err.Number & " " & Err.Description
      End Select
End Sub
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: All Layers to ByLayer
« Reply #19 on: August 16, 2007, 03:10:02 PM »
This is worth a look
Wow, I forgot all about that!  Cool blast from the past, thanks DGCs
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: All Layers to ByLayer
« Reply #20 on: August 16, 2007, 03:12:35 PM »
I just looked at SETBYLAYER, and I had everything but the material and plot style options.  It also processes blocks, FYI, just in case you miss the prompt.  Some of my blocks are hard coded to layers on purpose
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

Guest

  • Guest
Re: All Layers to ByLayer
« Reply #21 on: August 16, 2007, 03:13:35 PM »
I just looked at SETBYLAYER, and I had everything but the material and plot style options.  It also processes blocks, FYI, just in case you miss the prompt.  Some of my blocks are hard coded to layers on purpose

Nested blocks, too!

ML

  • Guest
Re: All Layers to ByLayer
« Reply #22 on: August 16, 2007, 03:18:41 PM »


Yes

Matts code did work fine
I had forgotten to put some objects in my drawing to test it  DUH  LOL

I will certainly keep it for future use

And yes, of course you could do a Ctrl A to select all objects, then choose Bylayer from the pulldown

Dam intellect  LOL

Thanks Matt

ronjonp

  • Needs a day job
  • Posts: 7060
Re: All Layers to ByLayer
« Reply #23 on: August 16, 2007, 03:20:27 PM »

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

Guest

  • Guest
Re: All Layers to ByLayer
« Reply #24 on: August 16, 2007, 03:25:21 PM »
Thanks Matt

You're welcome.


You got plenty of good solutions here, so use whatever works best for you.

ML

  • Guest
Re: All Layers to ByLayer
« Reply #25 on: August 16, 2007, 03:32:54 PM »

Yes

Matt yours worked well, I was making the silly mistake of trying to change a lyer's property to bylayer.
Well, that won't work because Bylayer is the object's property and you got it.

Yes, your code worked fine

I saved the above code as well because I like how he applied the selection set to achieve the same result with a bit more functionality

Mark

Bryco

  • Water Moccasin
  • Posts: 1850
Re: All Layers to ByLayer
« Reply #26 on: August 16, 2007, 11:30:26 PM »
To be complete you need to add an Mtext to bylayer function (As in make the text inside the mtext bylayer). I've found some client drawings have all their mtext forced to another color.
Yuk.