Easy SSGET question. (I hope).

Discussion in 'AutoCAD' started by sbubendorf, Jun 10, 2004.

  1. sbubendorf

    sbubendorf Guest

    I believe the commented line works (returns a selection set to the variable a1) when "sometext" (without the quotes) exists in my pick set. Why doesn't the "cons" statement which follows work? Can someone help me to make the required corrections? (I apologize if my nomenclature is incorrect, and for my inability to get something this basic to work.) THANK YOU IN ADVANCE FOR ANY HELP THAT CAN BE PROVIDED !!!!

    (setq tsg1 "sometext")
    (setq a1 (ssget '((0 . "TEXT")
    ;(1 . "sometext")
    (cons 1 tsg1))
    )
    )
    )
     
    sbubendorf, Jun 10, 2004
    #1
  2. sbubendorf

    Jeff Mishler Guest

    It's the quote that keeps it from working. Try this instead:
    (ssget (list '(0 . "TEXT")'(1 . "sometext")(cons 1 tsg1)))
     
    Jeff Mishler, Jun 10, 2004
    #2
  3. Because you have quoted the list.

    use
    (list (0 . "TEXT") (cons 1 tsg1))


    instead of
    '((0 . "TEXT") (cons 1 tsg1))

    --
    Autodesk Discussion Group Facilitator


    variable a1) when "sometext" (without the quotes) exists in my pick set.
    Why doesn't the "cons" statement which follows work? Can someone help me to
    make the required corrections? (I apologize if my nomenclature is
    incorrect, and for my inability to get something this basic to work.) THANK
    YOU IN ADVANCE FOR ANY HELP THAT CAN BE PROVIDED !!!!
     
    Jason Piercey, Jun 10, 2004
    #3
  4. sbubendorf

    andywatson Guest

    Those quotes threw me for loops too.
    Just remember, if you would like to use the value of variables to create a list, you should not use the quote symbol.
    e.g.
    (setq item1 "no")
    (setq item2 "quote")
    (setq mylist '(item1 item2))

    (princ mylist)
    (ITEM1 ITEM2)

    Lisp literally takes your variable names and uses them to create the list. You would instead use...
    (setq mylist (list item1 item2))
    (princ mylist)
    ("no" "quote")

    or...
    (setq mylist (cons item1 item2))
    (princ mylist)
    ("no" . "quote")
     
    andywatson, Jun 11, 2004
    #4
  5. sbubendorf

    sbubendorf Guest

    Thank you to all of you. With your help, I have it working!! I thought I'd tried every variation conceivable, but it sure helps to see what somebody else has done!!!!
     
    sbubendorf, Jun 11, 2004
    #5
  6. sbubendorf

    Don Butler Guest

    If the main SSGET filter is quoted (static) you can't evaluate (cons 1 tsg1)
    within it.

    This would work however...

    (setq a1 (ssget '((0 . "TEXT")(1 . "sometext"))))
    (setq a1 (ssget (list (cons 0 "TEXT") '(1 . "sometext"))))
    (setq a1 (ssget (list '(0 . "TEXT") '(1 . "sometext"))))
    (setq a1 (ssget (list '(0 . "TEXT") (cons 1 tsg1))))
    (setq a1 (ssget (list (cons 0 "TEXT") (cons 1 tsg1))))

    Don


    variable a1) when "sometext" (without the quotes) exists in my pick set.
    Why doesn't the "cons" statement which follows work? Can someone help me to
    make the required corrections? (I apologize if my nomenclature is
    incorrect, and for my inability to get something this basic to work.) THANK
    YOU IN ADVANCE FOR ANY HELP THAT CAN BE PROVIDED !!!!
     
    Don Butler, Jun 11, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.