Suggestions / insight?

Discussion in 'AutoCAD' started by Casey Roberts, Oct 28, 2004.

  1. I have the following routine that puts all xrefs onto a specific layer and I
    just wanted some input from everyone to see if there's a way to improve on
    it or if anyone can find problems with it.

    Thanks,

    Casey

    (defun c:xlay ()
    (IF (NOT (TBLSEARCH "LAYER" "S-XREF"))
    (COMMAND "LAYER" "NEW" "S-XREF" "")
    )
    (setq fullist (DOS_XREFLIST))
    (foreach a fullist
    (setq name (last (DOS_STRTOKENS a "\\"))
    dwg (car(dos_strtokens name ".")))
    (setq ss (ssget "x" (list (cons 0 "insert")(cons 2 dwg))))
    (command "chprop" ss "" "layer" "s-xref" "")


    )
    )
     
    Casey Roberts, Oct 28, 2004
    #1
  2. Casey Roberts

    David Kozina Guest

    Casey,
    Does it do what you need? If it ain't broke, why fix it?

    But, since you asked...
    Put each xref on it's own layer? (more control that way)
    Make sure they're aliased decently? (layer pulldown hell prevention) <-
    this has nothing to do really with the task at hand, just a peeve.
    Has much to do with how standardized/consistent your xref system is.
    What happens if the xref is nested? (just wonderin)
    Looks like a very opinionated IF statement, IYKWIM. (just an aside)
    Apply VLISP/ActiveX methods to the function? (pretty cool, those)
    Localize yer variables? (/ fullist dwg ss)
    Better variable names? (a? <eyes glazing>)

    JMOs, FWTW,
    David Kozina
     
    David Kozina, Oct 28, 2004
    #2
  3. Thanks David,

    Didn't think about nested xrefs..... will have to ponder that.

    Also, I have changed it to locally declare the varibles as well as change
    the variable names to make more sense.

    For what we use xref's for, it doesn't much matter if they are on there own
    layer or all on one layer.... easier just to put them all on one layer.

    Xref aliases... we don't typically use them, just let it default to the
    filename and attempt to have the filenames be relatively descriptive anyway.
     
    Casey Roberts, Oct 28, 2004
    #3
  4. i use a routine that automatically changes the layer to the xref layer when
    the xref command is invoked and back when its finished, just saves having to
    manually run a routine that moves all the xrefs to another layer, and also
    helps in the nested xref scenario, ie any xref in any drawing is inserted on
    the xref layer...

    just my 2 cents

    cheers

    mark
     
    Mark Dubbelaar, Oct 29, 2004
    #4
  5. Would you be willing to share?

     
    Casey Roberts, Oct 29, 2004
    #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.