setting Layer Filters

Discussion in 'AutoCAD' started by Nate Hunter, Jan 19, 2004.

  1. Nate Hunter

    Nate Hunter Guest

    Does anyone know why my code below does not work. I am trying to set a
    layerfilter without actually going into the layer manager. I must be
    missing something simple any ideas??


    Dim oDict As AcadDictionary
    Dim LayFlt As Object
    Dim oXrec As AcadXRecord
    Dim xType As Variant, xValue As Variant

    Set oDict = ThisDrawing.Layers.GetExtensionDictionary
    Set LayFlt = oDict.Item("ACAD_LAYERFILTERS")
    Set oXrec = LayFlt("WATER")

    oXrec.GetXRecordData xType, xValue
    MsgBox "Layer Filter name: " & xValue(0)
     
    Nate Hunter, Jan 19, 2004
    #1
  2. Nate Hunter

    HJohn Guest

    I don't know much about layer filters, but based on your code what you have done is to retrieve the info contained on the "Water" filter. If it doesn't exist you probably are getting an error msg "Key not found". In order to create the filter you have to create the arrays xType and xValue, add the "Water" xrecord to the "Acad_Layerfilters" dic, and finally setxrecorddata xtype xvalue. Hope it helps
     
    HJohn, Jan 20, 2004
    #2
  3. From what I have read, I do not believe you can set layer filter with vba or lisp. You can create a layer filter, but no way to make it current
     
    MarcelGosselin, Jan 21, 2004
    #3
  4. Nate Hunter

    u97pani Guest

    Try this:
    Dim NewLayer as AcadLayer

    Set NewLayer = ThisDrawing.Layers.Add("LayerName")

    ThisDrawing.ActiveLayer = NewLayer

    VBA creates a new layer and it sets it to the current layer.

    /Ola
     
    u97pani, Jan 22, 2004
    #4
  5. Yeah, but what has this got to do with layer filters?

    Marcel is correct, you cannot set or make layer filters from vb/a.
    ___________________________
    Mike Tuersley
    CADalyst's AutoCAD Clinic
    Rand IMAGINiT Technologies
     
    Mike Tuersley, Jan 22, 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.