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

Thread: Point from entsel

  1. #1
    Active Member
    Join Date
    2006-02
    Posts
    74
    Login to Give a bone
    0

    Default Point from entsel

    If (setq wall1 (entsel "\nPick a line: ")) returns: (<Entity name: 7efd1a58> (-25.5192 -16.7811 0.0))

    Then (setq PT2 (cdr wall1)) returns: ((-25.5192 -16.7811 0.0))

    I want PT2 to be this point, but it’s got an extra set of parentheses around it. How do I get rid of the outside parentheses?

  2. #2
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Point from entsel

    Quote Originally Posted by wommack
    If (setq wall1 (entsel "\nPick a line: ")) returns: (<Entity name: 7efd1a58> (-25.5192 -16.7811 0.0))

    Then (setq PT2 (cdr wall1)) returns: ((-25.5192 -16.7811 0.0))

    I want PT2 to be this point, but it’s got an extra set of parentheses around it. How do I get rid of the outside parentheses?
    Give
    Code:
     (setq PT2 (cadr wall1))
    a shot.

  3. #3
    Active Member
    Join Date
    2006-02
    Posts
    74
    Login to Give a bone
    0

    Default Re: Point from entsel

    That gives me the same result. I can't find a way to remove the parentheses, which is not a value in the list, so car cdr and cadr don't have any effect.

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Point from entsel

    Quote Originally Posted by wommack
    That gives me the same result. I can't find a way to remove the parentheses, which is not a value in the list, so car cdr and cadr don't have any effect.
    Which parenthesis are you trying to remove?

    Code:
    (setq wall1 (entsel "\nPick a line: "))
    (setq PT2 (cadr wall1))
    This would provide a list of two items for the variable wall1. This would also set the value of PT2 to a list of three items, the coordinates of the pick point. If you are trying to remove the parenthesis from the coordinates, you would have to use car, cadr, caddr for each of three portions of the coordinate.

    What is your ulimate goal or value you are seeking? What do you plan on doing with the value?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    Active Member
    Join Date
    2006-02
    Posts
    74
    Login to Give a bone
    0

    Default Re: Point from entsel

    I want to remove the extra parentheses from the value stored in PT2, which is ((-25.5192 -16.7811 0.0)). I need it to read: (-25.5192 -16.7811 0.0)

  6. #6
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Point from entsel

    Quote Originally Posted by wommack
    I want to remove the extra parentheses from the value stored in PT2, which is ((-25.5192 -16.7811 0.0)). I need it to read: (-25.5192 -16.7811 0.0)
    cadr seems to do what you are trying to do here (see attached). Or am I missing something?
    Attached Images Attached Images

  7. #7
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Point from entsel

    Quote Originally Posted by wommack
    I want to remove the extra parentheses from the value stored in PT2, which is ((-25.5192 -16.7811 0.0)). I need it to read: (-25.5192 -16.7811 0.0)
    Where are you getting this value, ((-25.5192 -16.7811 0.0))? You would need to use CAR to get the first element of a list. The second one would be CADR, and the third would use CADDR. There are some other ones as well.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  8. #8
    Active Member
    Join Date
    2006-02
    Posts
    74
    Login to Give a bone
    0

    Default Re: Point from entsel

    cadr works. I must have done something wrong yesterday. I don't know what as I cut and pasted the values for !pt2 from the command prompt, and yesterdat it had the second set of parentheses in it. This stuff hurts my brain.

  9. #9
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Point from entsel

    Quote Originally Posted by wommack
    cadr works. I must have done something wrong yesterday. I don't know what as I cut and pasted the values for !pt2 from the command prompt, and yesterdat it had the second set of parentheses in it. This stuff hurts my brain.
    I'm glad you worked it out.

    It does get easier with experience; hang in there...

  10. #10
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    277
    Login to Give a bone
    0

    Default Re: Point from entsel

    Hi wommack,
    Do you mean like this
    Code:
    (setq wall1 (entsel "\nPick a line: ")) ; (<Entity name: 7ef60ea0> (18.171 20.8006 0.0))
    (setq PT2 (cdr wall1))                  ; ((18.171 20.8006 0.0))
    (setq PT2 (car PT2))                    ; (18.171 20.8006 0.0)
    Quote Originally Posted by wommack
    cadr works. I must have done something wrong yesterday. I don't know what as I cut and pasted the values for !pt2 from the command prompt, and yesterdat it had the second set of parentheses in it. This stuff hurts my brain.

Page 1 of 2 12 LastLast

Similar Threads

  1. Entsel & SSGet combined
    By JaCAD in forum AutoLISP
    Replies: 10
    Last Post: 2012-10-24, 06:19 PM
  2. help with entsel/getpoint
    By fclao in forum AutoLISP
    Replies: 2
    Last Post: 2010-03-08, 10:58 AM
  3. Entsel - Multiple objects?
    By Mr Cory in forum AutoLISP
    Replies: 8
    Last Post: 2007-08-27, 07:31 PM
  4. Help with using entsel or nentselp
    By MWKINCAID1 in forum AutoLISP
    Replies: 3
    Last Post: 2007-03-10, 12:10 AM
  5. Entsel
    By fletch97 in forum AutoLISP
    Replies: 3
    Last Post: 2005-07-07, 04:37 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
  •