Results 1 to 4 of 4

Thread: Moving existing data (ellipses) to new a newly created layer

  1. #1
    I could stop if I wanted to
    Join Date
    2006-07
    Posts
    233
    Login to Give a bone
    0

    Default Moving existing data (ellipses) to new a newly created layer

    I am trying to move existing ellipses in dxf drawings to a new layer so at a later time they can be distinguished and converted to polylines more easily. I do have some of the code written but can't quite figure out how to get the existing elipses moved on the new layer.

    Here is the code maybe someone can help:

    Code:
    (defun ellp2nwlyr ( / ent ename elist)
    (setq ent(ssget "X" ' ((0 . "ELLIPSE"))))
      (setq numb(sslength ent))
      (setq count 0)
      (repeat count
        (setq ename (cdr ent))
        (setq elist (entget ename))
          (if (= (cdr (assoc 0 elist)) "ELLIPSE") ;is that something a circle?
            (progn
              (if (tblsearch "layer" "ellipse")
                  (command "-layer" "s" "ellipse")
                  (command "-layer" "m" "ellipse" "c" "red" "ellipse" "")
              );;end of if
            );; end of progn
          );; end of if
      );; end of repeat
    );; end of program
    I do know this selects all ellipses in the drawing and it creates a new layer called "ellipse" but need some help getting the ellipses on this layer.

    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]
    Last edited by Opie; 2006-07-20 at 02:46 PM. Reason: [CODE] tags added, see moderator comment

  2. #2
    100 Club intergrupocr's Avatar
    Join Date
    2006-02
    Posts
    116
    Login to Give a bone
    0

    Smile Re: Moving existing data (ellipses) to new a newly created layer

    You have to change the association 8 of the selected entities, something like this:

    (setq elist (subst (cons 8 "ELLIPSE") (assoc 8 elist) elist))
    (entmod elist)

    And you don't need this line: "(if (= (cdr (assoc 0 elist)) "ELLIPSE") " because you select only ellipses.

    Let me know if this help you!!

  3. #3
    All AUGI, all the time
    Join Date
    2015-12
    Location
    Central Oregon
    Posts
    591
    Login to Give a bone
    0

    Default Re: Moving existing data (ellipses) to new a newly created layer

    Here are some thougts on this....
    Quote Originally Posted by Lions60
    Here is the code maybe someone can help:
    Code:
    (defun ellp2nwlyr ( / ent ename elist)
    (setq ent(ssget "X" ' ((0 . "ELLIPSE"))))
      (setq numb(sslength ent))
      (setq count 0)
      (repeat count  ;;;;no need to repeat, especially checking/setting/creating the layer, just use the ss in a command call
        (setq ename (cdr ent))
        (setq elist (entget ename))
          (if (= (cdr (assoc 0 elist)) "ELLIPSE") ;is that something a circle? why this? you already filtered for only ellipses....
            (progn
              (if (tblsearch "layer" "ellipse")
                  (command "-layer" "s" "ellipse")
                  (command "-layer" "m" "ellipse" "c" "red" "ellipse" "")
              );;end of if
            );; end of progn
          );; end of if
      );; end of repeat
    );; end of program
    Here's how I'd do it:
    Code:
    (defun ellp2nwlyr ( / ent ename elist)
      (if (setq ent (ssget "X" ' ((0 . "ELLIPSE"))))
        (progn
          (if (tblsearch "layer" "ellipse")
    	(command "-layer" "s" "ellipse")
    	(command "-layer" "m" "ellipse" "c" "red" "ellipse" "")
    	);;end of if
          (command "_.chprop" ent "" "la" "ellipse" "")
          )
        )
      );; end of program
    HTH,
    Jeff

  4. #4
    I could stop if I wanted to
    Join Date
    2006-07
    Posts
    233
    Login to Give a bone
    0

    Default Re: Moving existing data (ellipses) to new a newly created layer

    Thanks for the help looks like I had most of the information there jsut not in the right order. Also learned a new command in the process( _.chprop). I appreciate the help and again thanks.

Similar Threads

  1. 2014: Layer State - Need To Ignore Any Newly Created Layers
    By omorah in forum AutoCAD Customization
    Replies: 2
    Last Post: 2013-08-09, 02:32 PM
  2. Replies: 2
    Last Post: 2012-11-27, 01:21 AM
  3. Replies: 13
    Last Post: 2007-03-14, 07:35 PM
  4. moving newly created wall styles to new project
    By bdcombs in forum Revit Architecture - General
    Replies: 9
    Last Post: 2006-07-28, 09:00 PM
  5. Place newly created Hatch on a certain Layer
    By dhurtubise in forum AutoLISP
    Replies: 7
    Last Post: 2006-04-04, 03:30 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
  •