nested XREF Layer

Discussion in 'AutoCAD' started by Jorge Jimenez, Aug 4, 2004.

  1. Hi Jorge,

    Looks like you resolved your issue yourself. If it still seems slower, I'd
    create an ACAD.DVB with an ACADSTARTUP sub and have everything load/run all
    thru vb/a instead of mixing languages. Since vlisp is nothing more than a
    wrapper around vba to get lispers access to vba's functionality [IMHO], its
    a waste of time - but I do know plenty that swear by it =) Outside of
    creating command line access, there's no reason to mix-n-match the
    languages.

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Aug 9, 2004
    #21
  2. Hi Mike,
    Well the dll is running at the same speed as the VBA macro so I see no need
    to use VBA.
    I've always avoided using for each to read acads entity collection thinking
    that it was very slow.
    But I was wrong. I just tested the xref routine with a pretty heavy drawing
    with some 27 xrefs, and one of those xrefs has more than 16,000 entities,
    and it is a nested xref. It takes about 5 to 6 seconds to fill a list of all
    xrefs and their layers.
     
    Jorge Jimenez, Aug 9, 2004
    #22
  3. Jorge Jimenez

    bwnichols Guest

    Hello Jorge

    I used the content of this thread plus some other resources to whip up this simple nested entity listing function...it may have been what you were looking for (but I did not read this thread 'till today!).

    The function identifies the essential entity selected and its associated layer, and all block/XREF levels with associated layer within which the entity is nested:

    (DEFUN C:XS ( / NLVL )
    (SETQ NENT (NENTSEL))
    (SETQ EN (CAR NENT))
    (SETQ ENT (ENTGET EN))
    (PROMPT (STRCAT "\nEntity type " (CDR (ASSOC 0 ENT)) " layer " (CDR (ASSOC 8 ENT))))
    (SETQ NLVL (1- (LENGTH (CADDDR NENT))))
    (FOREACH EN (CADDDR NENT)
    (PROGN
    (SETQ ENT (ENTGET EN))
    (PROMPT (STRCAT "\nBlock " (CDR (ASSOC 2 ENT))
    " layer " (CDR (ASSOC 8 ENT)) " nesting level "
    (ITOA NLVL)))
    (SETQ NLVL (1- NLVL))))
    (PRINC))

    It leaves global variables NENT, ENT, & EN for inspection; just append to local arg list to clean them up.

    Simple, but answers our need where the XLIST tool failed.

    Thanks to all

    Brandon Nichols
    Hargis Engineers
    Seattle WA
     
    bwnichols, Jan 31, 2005
    #23
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.