Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Converting Layers without changing color,line Types etc..

  1. #1
    100 Club Binu Mathew's Avatar
    Join Date
    2005-11
    Location
    Kuwait
    Posts
    187
    Login to Give a bone
    0

    Default Converting Layers without changing color,line Types etc..

    Hi

    Does any one know any tricks to convert the unnecessary layers to one new layer
    but i want all the old unnecessary layers Line Types, colours etc.. as before,

    again i would say i wanted to convert all the old layers in to one layer WITHOUT CHANGING ITS COLOUR AND LINE TYPE …

    There is any lisp for this ?

    Thanks in advance

    BM

  2. #2
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Converting Layers without changing color,line Types etc..

    If I understand you correctly you want to change all entities on selected layers from color, linetype, etc. = ByLayer to the layer's setting. Then use LayMrg to place them all on a new layer. Is so try this:
    Code:
    ;; Layer Merge but keep color & linetype settings
    (defun c:LayMrg2 (/ en ed ln llst ld)
      (while (progn
               (initget "Name")
               (setq en (entsel "\nSelect object on layer to merge or [Name]: "))
             ) ;_ end of progn
        (if (and (= en "Name") (setq en (getstring t "Enter Layer Name: ")))
          (if (setq ln (tblobjname "LAYER" en))
            (if (not (member en llst))
              (setq llst (cons en llst))
            ) ;_ end of if
            (princ "Layer does not exist.")
          ) ;_ end of if
          (progn
            (princ "\n")
            (if (setq ed (entget (car en)))
              (if (not (member (cdr (assoc 8 ed)) llst))
                (setq llst (cons (cdr (assoc 8 ed)) llst))
              ) ;_ end of if
            ) ;_ end of if
          ) ;_ end of progn
        ) ;_ end of if
        (princ (strcat "Selected layers: " (car llst)))
        (foreach ln (cdr llst)
          (princ (strcat "," ln))
        ) ;_ end of foreach
      ) ;_ end of while
    
      (setq en (entnext)) ;Get 1st entity
      (while (and en (setq ed (entget en)))
        (if (setq ln (member (cdr (assoc 8 ed)) llst))
          (progn
            (setq ld (tblsearch "LAYER" (car ln)))
            ;; Color
            (if (not (assoc 62 ed)) (setq ed (append ed (list (assoc 62 ld)))))
            ;; Linetype
            (if (not (assoc 6 ed)) (setq ed (append ed (list (assoc 6 ld)))))
            (entmod ed)
          )
        )
        (setq en (entnext en))
      )
    
      (command "._LAYMRG")
      (foreach ln llst
        (command "_Name" ln)
      ) ;_ end of foreach
      (command "")
      (while (> (getvar "CMDACTIVE") 0)
        (command pause)
      ) ;_ end of while
      (princ)
    ) ;_ end of defun

  3. #3
    Certified AUGI Addict jaberwok's Avatar
    Join Date
    2000-12
    Location
    0,0,0 The Origin
    Posts
    8,570
    Login to Give a bone
    0

    Default Re: Converting Layers without changing color,line Types etc..

    Quote Originally Posted by Binu Mathew View Post
    Hi

    Does any one know any tricks to convert the unnecessary layers to one new layer
    but i want all the old unnecessary layers Line Types, colours etc.. as before,

    again i would say i wanted to convert all the old layers in to one layer WITHOUT CHANGING ITS COLOUR AND LINE TYPE …

    There is any lisp for this ?

    Thanks in advance

    BM
    What if the unnecessary layers have different colours and linetypes?

  4. #4
    100 Club Binu Mathew's Avatar
    Join Date
    2005-11
    Location
    Kuwait
    Posts
    187
    Login to Give a bone
    0

    Default Re: Converting Layers without changing color,line Types etc..

    Quote Originally Posted by jaberwok View Post
    What if the unnecessary layers have different colours and linetypes?
    John,

    Yes, I want to delete all those layers but i dont want to change the entities like as you stated the LineTypes and colours of the enity just need to merge the layers only

    Thanks
    BM

  5. #5
    100 Club Binu Mathew's Avatar
    Join Date
    2005-11
    Location
    Kuwait
    Posts
    187
    Login to Give a bone
    0

    Default Re: Converting Layers without changing color,line Types etc..

    Hi Thanks a lots for your time,

    Could you pls tell me how the above code will work and where u want me to copy this code and what is the command to write after load this code at command prompt

    again the code i dont want to change the Line types or object colour by layer to another layer i just wanted to change all those layers to another one new layer,

    Actually i have got a vendor drgs having morethan 200 layers with no meaning, this all layers needs to move to one layer and i dont want to change those layers objects colours and Line type to the new layer, is the above code will work for me this way if so kindly advise me where to copy the code

    Thanks again
    BM

  6. #6
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Converting Layers without changing color,line Types etc..

    Actually, as you've explained it the second time ... I think you don't need my lisp. Just run the LayMrg command: It'll ask you to select entities on the layers you don't want (or type in the name of those layers), then ask you to which layer you want them to be "moved".

    My lisp does the same, but changes entities which were by-layer to the colour as you see them on screen before performing the LayMrg. If you do want to run my lisp, save it into a LSP file (using Notepad or any other text editor). In ACad type APPLOAD and load that lisp file, you should now have a command called LayMrg2. There are other ways of automatically loading the LSP file, see this thread: http://forums.augi.com/showthread.php?t=105700

    Just an after thought, if you do want to use my lisp ... be aware that it doesn't handle entities inside blocks, while the LayMrg does.

  7. #7
    100 Club Binu Mathew's Avatar
    Join Date
    2005-11
    Location
    Kuwait
    Posts
    187
    Login to Give a bone
    0

    Default Re: Converting Layers without changing color,line Types etc..

    Dear Irneb,

    Really appreciated for your quick reply thank you, i will use your lisp but could you pls. arrange your lisp in the following:

    - 1st action is that the all the old layers colour and LineType to be changed as per the object layer, in that vendors drgs. some of the linetypes and colours are bylayer some are not, i dont want to loose this Linetypes and colours in the new layer.

    - 2nd action can be as layer merged so i will not loose any of the old line types or colours.

    really appreciated ur help to the CAD community
    BM
    Last edited by Binu Mathew; 2010-02-25 at 11:16 AM.

  8. #8
    ACA/AMEP Community Chair stelthorst's Avatar
    Join Date
    2003-10
    Location
    San Francisco CA
    Posts
    1,190
    Login to Give a bone
    0

    Default Re: Converting Layers without changing color,line Types etc..

    Please note I have *merged* this post with a duplicate post from the AutoCAD General forum since both contained responses. In the future please do not post the same question in multiple forums.
    Scott Telthorst
    Quality Control Manager
    Helix Electric, Inc.
    www.helixelectric.com

    Some see the glass as half full, others as half empty. As an engineer I see the glass as twice as big as it needs to be. ~Unknown~

  9. #9
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Converting Layers without changing color,line Types etc..

    Quote Originally Posted by Binu Mathew View Post
    Dear Irneb,

    Really appreciated for your quick reply thank you, i will use your lisp but could you pls. arrange your lisp in the following:

    - 1st action is that the all the old layers colour and LineType to be changed as per the object layer, in that vendors drgs. some of the linetypes and colours are bylayer some are not, i dont want to loose this Linetypes and colours in the new layer.

    - 2nd action can be as layer merged so i will not loose any of the old line types or colours.

    really appreciated ur help to the CAD community
    BM
    I think that's where my lisp comes in. Here's an example. You have the following layers already:
    Code:
    Name             Color     LineType
    ----------------+---------+--------
    L1              |Red      |Dashed
    L2              |Yellow   |Hidden
    These are the layers you want merged into a new layer which you should create:
    Code:
    MyLayer         |White    |Continuous
    But, there are entities on the existing layers which are assigned Color ByLayer, some are also set to Line Type ByLayer. There's also some with specific colours / linetypes, e.g. a line on L1 set to Cyan and a Circle on L2 set to Continuous.

    Draw a line on the new layer MyLayer. This so it's easier to select - otherwise you'll have to type in the name.

    Now you run my LSP by loading it (as described before), then type the command LAYMRG2 at the command prompt. Notice it'll ask you to pick objects on the layers to be merged. Pick one (or more) lines/circle/arcs/polylines/etc. for each of the layers you want to merge into the new one.

    What happens now is the lisp steps through each layer's entities. If it finds an entity on layer L1 with colour ByLayer it sets that entity's colour to Red. If it finds something with Linetype ByLayer on L1 it gets set to Dashed. Same applies for L2 9if you've selected it). Next you're asked to pick the layer to merge into, so select the line you've drawn before. You're asked if you also want to purge the old layers out.

    The result will be that all entities which were on L1 & L2 are now on MyLayer. Those on L1 with colour ByLayer will be Red, those on L1 with linetype ByLayer will be Dashed, those on L2 with colour ByLayer will be Yellow, those on L2 with linetype ByLayer will be Hidden. The rest will keep their colours and linetypes as is.

    If this is not what you wanted, then I cannot figure out from existing info. Maybe post a sample DWG of before & after.

  10. #10
    100 Club Binu Mathew's Avatar
    Join Date
    2005-11
    Location
    Kuwait
    Posts
    187
    Login to Give a bone
    0

    Default Re: Converting Layers without changing color,line Types etc..

    Dear Irneb,

    Thanks a lots it is working well, again thanks for your time excelent lisp

    best regards
    Binu

Page 1 of 2 12 LastLast

Similar Threads

  1. Changing color of Xref layers based on color and layer name
    By tuerlinckx_peter862162 in forum AutoLISP
    Replies: 7
    Last Post: 2013-02-14, 06:46 PM
  2. Changing Line Types
    By mccurdyks in forum Revit Architecture - Families
    Replies: 1
    Last Post: 2006-10-03, 05:29 PM
  3. Changing cut line color
    By mbalsom in forum Revit Architecture - General
    Replies: 5
    Last Post: 2006-08-07, 03:41 PM
  4. Converting Line Types
    By studio3p in forum Revit Architecture - General
    Replies: 3
    Last Post: 2004-01-29, 02:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •