AutoCAD Map 3D Developer

AutoCAD Map 3D Developer

Posts: 21
Registered: ‎05-16-2006
Message 1 of 4 (416 Views)

Set FDO layer filter

416 Views, 3 Replies
07-13-2012 07:51 AM

Hi all,

   I need to set a fillter for all fdo layer in a map (as Query to filter data command).

To do this I wrote this code but the filter is not set. If I manualy run the "Query to filter data" command
If you launch the "Query to filter data" command manually  on a layer i find the filter set, and is applied only if I press the Ok or Apply button.I think that in my code is missing an instruction to apply the filter set.
Can you help me?

Dim objLayers As MgLayerCollection = objMap.GetLayers()
        For Each objLayer As MgLayerBase In objLayers
            Dim objLayerDefId As MgResourceIdentifier = objLayer.GetLayerDefinition()
            Dim objByteReader As MgByteReader = objResourceServ.GetResourceContent(objLayerDefId)
            Dim objXML As XmlDocument = New XmlDocument()
            Dim objSerializer As New XmlSerializer(GetType(LayerDefinition))
            Dim objLayerV As LayerDefinition = TryCast(objSerializer.Deserialize(New StringReader(objByteReader.ToString)), LayerDefinition)
            Dim objVectorLayerDef As VectorLayerDefinitionType = TryCast(objLayerV.Item, VectorLayerDefinitionType)
            objVectorLayerDef.Filter = strFilter
            Dim objXs As New XmlSerializer(objLayerV.[GetType]())
            Dim objWriter As New StringWriter()