NoXref filter in the TB Layer Control

Discussion in 'AutoCAD' started by James Buzbee, Feb 20, 2004.

  1. James Buzbee

    James Buzbee Guest

    Ok, this is as close as I can get with lisp (or VBA for that matter). The
    setting isn't saved anywhere I can find - not Activex property, registry,
    extended data - nada. I would really like to be able to type in a command
    and have the layer control exclude xref'ed layers. If anyone can expand
    this little routine - please do. This at least gets me closer . . .

    When you enter jbNoXrefFilter a layer filter is created "_NoXREF", sets the
    registry key for the Layer Properties NOMOptFilter to 1 and pulls up the
    dialog so you can select that filter . . . should be at the top. I wish I
    didn't have to manually pick it . . . but there is no "Active Layer Filter"
    property or reg key to set.

    WFWW (watch for word wrap)

    jb


    (defun c:jbNoXrefFilter( / doc profile dict lfent cur datalist xname)
    (vl-load-com)
    (setq doc(vla-get-activedocument(vlax-get-acad-object))
    profile(vla-get-ActiveProfile
    (vla-get-Profiles (vla-get-preferences(vlax-get-acad-object))))
    dict(vlax-vla-object->ename(vla-GetExtensionDictionary(vla-get-layers
    doc)))
    lfent (cdar(dictsearch dict "ACAD_LAYERFILTERS")))

    ; check to see if "ACAD_LAYERFILTERS" exists. if not, make it
    (if (not lfent)
    (progn
    (setq cur '((0 . "DICTIONARY") (100 . "AcDbDictionary")))
    (setq lfent(dictadd dict "ACAD_LAYERFILTERS" (entmakex cur)))))

    ; check to see if "NoXREF" exists, if so delete it.
    (if (dictsearch lfent "_NoXREF")(dictremove lfent"_NoXREF"))

    (setq datalist(list '(0 . "XRECORD") '(100 . "AcDbXrecord")'(280 . 1)
    '(1 . "_NoXref") '(1 . "~*|*") '(1 . "*") '(1 . "*")
    '(70 . 0) '(1 . "*") '(1 . "*"))
    xname(entmakex dataList))
    (if (dictadd lfent "_NoXREF" xname)
    (progn
    (vl-registry-write(strcat
    "HKEY_CURRENT_USER\\"
    (vlax-product-key)
    "\\Profiles\\"profile
    "\\Dialogs\\LayerDialog")"NOMOptFilter" 1)
    (initdia)
    (command "_.layer")
    (princ "\n_NoXREF layer filter created!"))
    (princ "\nThere was a problem creating the layer filter _NoXREF!"))
    (princ)
    )
     
    James Buzbee, Feb 20, 2004
    #1
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.