Results 1 to 5 of 5

Thread: turn last pickpoint into current layer?

  1. #1
    Member
    Join Date
    2008-11
    Posts
    7
    Login to Give a bone
    0

    Default turn last pickpoint into current layer?

    I'm looking for a quick lisp routine that will turn the layer of my last pick point into the current layer. basically the same thing as the 'laycur' command, but instead of a pickbox, it uses the 'lastpoint' or something similar. I just don't know enough about lisp to do this myself.

  2. #2
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: turn last pickpoint into current layer?

    lastpoint is a coordinate, and a coordinat do not have any layer information
    but you can use lastpoint to select an object and use the layer information from it.
    Code:
    (defun c:test ( / )
      (if (nentselp (getvar "LASTPOINT" ))
        (setvar "CLAYER" (cdr (assoc 8 (entget (car (nentselp (getvar "LASTPOINT" )))))))
        (princ "no object at point " )
      )
      (princ)
    )
    try
    Command: id
    and then run test

    : ) Happy Computing !

    kennet

  3. #3
    100 Club
    Join Date
    2008-11
    Location
    Fort Lewis, WA.
    Posts
    119
    Login to Give a bone
    0

    Default Re: turn last pickpoint into current layer?

    try the command laycur

  4. #4
    Member
    Join Date
    2008-11
    Posts
    7
    Login to Give a bone
    0

    Default Re: turn last pickpoint into current layer?

    Thanks for the lisp. It works, but not in the way I was hoping....

    Ultimately, I am trying to insert one block onto multiple lines on different layers, and have this block take the layer of the line that I am inserting the block onto in one click.
    My original thought was to:
    1. insert block as normal and snap to line.
    2. run lisp that takes the layer of my 'insertion point' and makes this the current layer. ( the lisp I just got)
    3. run laycur command making my 'last' block to the current layer.
    4. layerp

    Command String so far: ^C^C-I;MYBLOCK;\;;\LISP;LAYCUR;L;;LAYERP

    Unfortunately, the AutoCAD considers the 'lastpoint' the layer of my block and ignores the line layer that I am wanting to make current.

    Any suggestions?

  5. #5
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: turn last pickpoint into current layer?

    Ok, so I suggest this

    1. A reactor switch to the layer, when and before you inserting the block with the insert command, to the layer that the line lays on that you pick.
    You can find a similar reactor that I created in this thread that does it for an Xref.

    2. An other way is to insert the block normally at the line at current layer, and next command in the lisp would flip the block (entlast) to the layer of the line.

    In both ways you do not need laycur


    : ) Happy Computing !

    kennet

Similar Threads

  1. Changing Current Layer Should Reset Layer Overrides
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2010-09-21, 01:13 PM
  2. Turn Off All Layers But Current - Lisp
    By omorah in forum AutoCAD Customization
    Replies: 3
    Last Post: 2009-10-01, 07:33 PM
  3. Keep current Layer Filter current while opening and closing
    By kathy71046 in forum AutoCAD General
    Replies: 8
    Last Post: 2007-05-24, 02:35 AM
  4. Replies: 7
    Last Post: 2006-03-15, 08:30 AM
  5. Replies: 5
    Last Post: 2006-02-07, 02:14 AM

Posting Permissions

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