TBC Macros and Extensions

 View Only

Layer.Visible Flag and access to Advanced View Filter settings?

  • 1.  Layer.Visible Flag and access to Advanced View Filter settings?

    Posted 07-29-2022 00:04
    Hi all,
    I've got three questions:

    1 - What is the Visible Flag of a Layer referring to?
    I've got a "search and replace in layernames"  macro with an option to create a copy of the layers instead of renaming.
    I create a new Layer with the new name and then go through the attributes and set them to match the source layer's. Variable o is the original layer.
    outputlayer = Layer.FindOrCreateLayer(self.currentProject, o.Name.replace(self.searchtext.Text, self.replacetext.Text))
    outputlayer.LayerGroupSerial = o.LayerGroupSerial
    outputlayer.DefaultColor = o.DefaultColor
    outputlayer.FilterCategory = o.FilterCategory
    outputlayer.LineStyle = o.LineStyle
    outputlayer.LineWeight = o.LineWeight
    outputlayer.Print = o.Print
    outputlayer.Priority = o.Priority
    #outputlayer.Visible = o.Visible # for some reason that would set the layer enabled/ticked in all View Filters
    outputlayer.Protected = o.Protected​
    UIEvents.RaiseAfterDataProcessing(self, UIEventArgs())
    That all works, BUT I figured out now, that copying the Visible flag will enable/tick the new layer in all Viewfilters, even in protected ones. Why would that be?

    2 - if i run the above code and have the Layer manager open AND filtered then TBC throws an exception on executing

    the exeception does not occur when the Layermanager is unfiltered

    the layers do get created properly in both cases

    3 - how can I access the advanced view filter settings, lets say protect/unprotect all viewfilters, via macro


    Ronny Schneider