Entities

Discussion in 'AutoCAD' started by bobbyjoe, May 11, 2004.

  1. bobbyjoe

    bobbyjoe Guest

    Is syntax for Vlisp entities written significantly different than Alisp entities? In the command line I enter the following:

    (ssget "x" '((0 . "TEXT")))

    The response should be: <SELECTION SET: 1>

    I am getting "nil".

    What is the difference here? Thank you!
     
    bobbyjoe, May 11, 2004
    #1
  2. bobbyjoe

    Jeff Mishler Guest

    This indicats no text entities were found.....

    Jeff

    entities? In the command line I enter the following:
     
    Jeff Mishler, May 11, 2004
    #2
  3. bobbyjoe

    Tom Smith Guest

    Is syntax for Vlisp entities written significantly different than Alisp
    entities?

    Lisp is lisp, entities are entities. Vlisp brought a shiny new IDE and
    additional ways to do more things, but it didn't change entity data or
    render previous lisps inoperable. If the return from the ssget is nil, it
    means there wasn't any text found.

    Note that there are other text-like things (mtext, attributes, etc.) which
    won't be found by this filter.
     
    Tom Smith, May 11, 2004
    #3
  4. bobbyjoe

    ECCAD Guest

    In R2002, with some 'text' out there, I get:

    Command: (ssget "x" '((0 . "TEXT")))
    <Selection set: 2>

    What ver Acad ? Any 'text' out there ?

    Bob
     
    ECCAD, May 11, 2004
    #4
  5. bobbyjoe

    ECCAD Guest

    Found this in Discussion Group, search for 'ssget'..
    By Tony Tanzillo.

    ;; Active Document:
    (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))

    (if (ssget "x" <your filter list>)

    (progn

    (setq ss (vla-get-ActiveSelectionSet doc))

    ;; Now ss contains the same objects found
    ;; by the call to (ssget)

    ;; after you're done, you can release it:

    (vlax-release-object ss)
    )
    )
     
    ECCAD, May 11, 2004
    #5
  6. bobbyjoe

    Tom Smith Guest

    (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
    I understand that VLA objects offer some advantages over the traditional
    data type, and that ActiveX programming can be faster (if the program is
    massive enough for speed to matter), and that accessing certain properties
    can be "easier" once you've swallowed all the code overhead of
    vla-get-this-and-get-that.

    But for routine purposes, doesn't all of the above pretty much distill down
    to (setq ss (ssget "x" <your filter list>))? I'm wondering, in what kinds of
    operations or what kinds of situations would the vla approach be clearly
    superior to the older approach?

    Conversely, are there situations where doing the vla thing only results in
    excess gobbledygook? For instance, I might simply want a count of all blocks
    named "foo" and I could get that from (sslength (ssget "x" '((2 . "foo")))).
    Is there any benefit in doing the same thing in a more long-winded form?
     
    Tom Smith, May 11, 2004
    #6
  7. bobbyjoe

    Joe Burke Guest

    Tom,

    Here's an example of vlisp ActiveX which I think is easier than using vanilla LISP
    when dealing with selection sets. Of course it assumes someone is equally comfortable
    dealing with vla-objects or enames while processing the objects in question.

    (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
    (if (ssget "x" <your filter list>)
    (vlax-for item (vlax-get doc 'ActiveSelectionSet)
    ;;do whatever here like foreach processing a list
    )
    )

    Notice two things. The selection set isn't assigned to a symbol. No (setq ss
    (ssget...)). The ActiveSelectionSet property of doc serves that purpose. And there's
    no need to step through the selection set with a traditional structure like this:

    (setq index 0)
    (repeat (sslength ss)
    ;;do whatever
    (setq index (1+ index))
    )

    If the number of symbols required reflects which method is easier, I think ActiveX
    wins.

    And if (vlax-get vla-object 'Layer) makes more sense than trying to remember DXF code
    8 will return an object's layer name given proper code, well ActiveX wins again.

    Regards
    Joe Burke
     
    Joe Burke, May 14, 2004
    #7
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.