Author Topic: Changing Layer Lineweights  (Read 1843 times)

0 Members and 1 Guest are viewing this topic.

M-dub

  • Guest
Changing Layer Lineweights
« on: November 07, 2008, 10:46:11 AM »
Guy I work with has a bunch of drawings with two dozen layers or so... All the same layer names in each drawing.  He wants to change the lineweights of most of the layers in each.
What's the quickest way to do this?  I'm thinking script.

I doubted it, but I tried inserting one of the 'good' drawings into one of the 'bad' drawings in hopes that it would override the lineweights, but it didn't work.

Sounds like it should be ringing some kind of bell in my head, but it isn't.  :(

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Changing Layer Lineweights
« Reply #1 on: November 07, 2008, 10:52:00 AM »
the cad manager tool, layer translate should do the trick...

or a simple script
Be your Best


Michael Farrell
http://primeservicesglobal.com/

ronjonp

  • Needs a day job
  • Posts: 7533
Re: Changing Layer Lineweights
« Reply #2 on: November 07, 2008, 11:12:03 AM »
Try this Mike:

Code: [Select]
(defun layerweights (lst / i l)
  (foreach i lst
    (if (setq l (tblobjname "layer" (car i)))
      (vla-put-lineweight (vlax-ename->vla-object l) (cdr i))
    )
  )
)
;;use your list of layernames and lineweights
(layerweights
  '(("layer1" . 0)
    ("layer2" . 5)
    ("layer3" . 9)
    ("layer4" . 13)
    ("layer5" . 15)
    ("layer6" . 18)
    ("layer7" . 20)
   )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Changing Layer Lineweights
« Reply #3 on: November 07, 2008, 11:36:44 AM »
Thanks Ron.
Those little LISP helper routines are great aren't they. :)
« Last Edit: November 07, 2008, 11:51:34 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7533
Re: Changing Layer Lineweights
« Reply #4 on: November 07, 2008, 11:40:10 AM »
Thanks Ron.
Those little LISP helper routines are great aren't they. ")

That's no lie  :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

M-dub

  • Guest
Re: Changing Layer Lineweights
« Reply #5 on: November 07, 2008, 11:47:52 AM »
Yes, Thank-you Ron!  :)

I think I'm going to use this opportunity to show him how to write a script.

( Even if I knew lisp, he even thinks writing a button macro is too advanced )

ronjonp

  • Needs a day job
  • Posts: 7533
Re: Changing Layer Lineweights
« Reply #6 on: November 07, 2008, 12:04:15 PM »
Yes, Thank-you Ron!  :)

I think I'm going to use this opportunity to show him how to write a script.

( Even if I knew lisp, he even thinks writing a button macro is too advanced )

You're welcome  :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

sinc

  • Guest
Re: Changing Layer Lineweights
« Reply #7 on: November 07, 2008, 12:31:18 PM »
I also would go with the Layer Translator.  No scripts necessary.  Simply open the drawing you want to change, start the Layer Translator, load the layers from your "good" drawing, and hit Translate.  Done.

Luke

  • Guest
Re: Changing Layer Lineweights
« Reply #8 on: November 07, 2008, 12:37:50 PM »
Insert the bad into the good instead of the good into the bad

M-dub

  • Guest
Re: Changing Layer Lineweights
« Reply #9 on: November 07, 2008, 12:42:32 PM »
Trying out the layer translator right now...

sinc

  • Guest
Re: Changing Layer Lineweights
« Reply #10 on: November 07, 2008, 04:05:28 PM »
Oops, I left out a step.  That "Map same" button will create a mapping between layers with the same name.

So you would need to load the layers from your "good" drawing, hit "Map Same" to create all the layer mappings, then hit "Translate" to actually do the work.

Once you get used to this tool, you can do quite a bit with it.  For example, say your company changes its layer standards.  You can create a mapping between your old standard and your new standard and save it.  Then, any time you want to "convert" an old drawing, simply open the Layer Translator, reload your saved mappings, and hit "Translate".  Instantly, everything is now on your new layer standard.