Results 1 to 4 of 4

Thread: Create a Layer, make it active, then place all selected objects on that Layer

  1. #1
    Active Member
    Join Date
    2005-01
    Posts
    78
    Login to Give a bone
    0

    Default Create a Layer, make it active, then place all selected objects on that Layer

    This should be pretty simple for many of you, but it's got me scratching my head. here is what I want to do:

    Create a layer, set this layers properties, make the layer active, and until this command ends, I want every line I poke to be placed on this newly created layer and it's properties changed to the default layer properties.

    I can get through the layer creation part, that's easy enough, and I can of course get through changing the layer of the lines I select, but Im fuzzy on changing the objects properties to default to the layers properties.

    I want to make a series of these for the different layers that I use, and I want to add them to a new drop down menu.

    Can anyone offer some guidance?


    Thanks in advance.

    John

  2. #2
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,523
    Login to Give a bone
    0

    Default Re: Create a Layer, make it active, then place all selected objects on that Layer

    Quote Originally Posted by methost
    This should be pretty simple for many of you, but it's got me scratching my head. here is what I want to do:

    Create a layer, set this layers properties, make the layer active, and until this command ends, I want every line I poke to be placed on this newly created layer and it's properties changed to the default layer properties.

    I can get through the layer creation part, that's easy enough, and I can of course get through changing the layer of the lines I select, but Im fuzzy on changing the objects properties to default to the layers properties.

    I want to make a series of these for the different layers that I use, and I want to add them to a new drop down menu.

    Can anyone offer some guidance?


    Thanks in advance.

    John
    Try this:
    Code:
    ;;CHANGES PICKED ENTITIES TO "YOUR_LAYER" LAYER
    (defun c:lyr (/ ce ln ss)
    	(setq ce (getvar "cmdecho"))
    	(setvar "cmdecho" 0)
    	(setq ln (getvar "clayer"))
    	(setq ss (ssget))
    	(if (= (tblsearch "layer" "YOURLAYER") nil)
    	(command "layer" "make" "YOURLAYER" "color" "5" "" "lt" "hidden" """"))
    	(command "chprop" ss "" "la" "YOURLAYER" "ltype" "bylayer" "color" "bylayer""")
    	(setvar "clayer" ln)
    	(setvar "cmdecho" ce)
    	(princ)
    )
    You will want to put in your layer name ("YOURLAYER"), linetype and layer color as you need.

  3. #3
    Active Member
    Join Date
    2005-01
    Posts
    78
    Login to Give a bone
    0

    Default Re: Create a Layer, make it active, then place all selected objects on that Layer

    ahh ... thanks very much!

  4. #4
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,523
    Login to Give a bone
    0

    Talking Re: Create a Layer, make it active, then place all selected objects on that Layer

    Quote Originally Posted by methost
    ahh ... thanks very much!
    Your welcome.
    The "tblsearch" funtion looks to see if that layer exists in the drawing, if not it creates it, if it does, it moves on to putting your selection on it and changing everything to "ByLayer".

    Glad I could help.

Similar Threads

  1. Make isolated layer active
    By Wish List System in forum AutoCAD Wish List
    Replies: 4
    Last Post: 2014-10-23, 06:55 AM
  2. 2012: layer control drop down does not show the layer of selected objects
    By dleversen360181 in forum AutoCAD General
    Replies: 1
    Last Post: 2013-02-18, 08:46 PM
  3. Change selected objects to different layer?
    By todd.80290 in forum AutoLISP
    Replies: 2
    Last Post: 2011-01-19, 10:18 AM
  4. Layer filter for currently selected objects in layer properties palette
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2010-06-09, 01:16 PM
  5. Place Each Member of MLINE object on Selected Layer
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2007-06-22, 02:46 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
  •