Automatic Variable Name in AutoLISP?

Discussion in 'AutoCAD' started by TEAC, Aug 5, 2003.

  1. TEAC

    TEAC Guest

    Is there a way to have AutoLISP name variables automatically?

    ex: If a user is selecting lines, but you do not know how many lines they will select, is there a way to start with (setq line_1 (entsel)) , and continue to line_2, line_3, etc.?

    Can anybody think of a better way to do this???
    Thanks,
    Michelle
     
    TEAC, Aug 5, 2003
    #1
  2. TEAC

    Paul Turvill Guest

    Yes, it can be done; but doing so can be quite cumbersome. If I were dealing
    with an unknown number of objects, I'd be more likely to deal with them as a
    selection set or a list, rather than individual variables.

    (setq ss (ssget "\nSelect objects: ")
    n (sslength ss)
    );;setq
    (alert (strcat "You have selected " (itoa n) " objects."))
    (while (> n 0)
    (setq n (1- n)
    obj (ssname ss n)
    );;setq
    (<<process 'obj' here>>)
    );;while

    ___

    will select, is there a way to start with (setq line_1 (entsel)) , and
    continue to line_2, line_3, etc.?
     
    Paul Turvill, Aug 5, 2003
    #2
  3. TEAC

    rdi Guest

    Michelle,

    I would have to agree with Paul. Depending on what you're trying to do,
    lists would likely be a much better way to go.

    What is it that you're trying to accomplish?
     
    rdi, Aug 5, 2003
    #3
  4. TEAC

    Mark Propst Guest

    without questioning whether or not you *should* do it (as the previous two
    answers) for *how* to do it see like named post above from nagesh

    will select, is there a way to start with (setq line_1 (entsel)) , and
    continue to line_2, line_3, etc.?
     
    Mark Propst, Aug 5, 2003
    #4
  5. TEAC

    Paul Turvill Guest

    She also asked
     
    Paul Turvill, Aug 5, 2003
    #5
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.