TBC Macros and Extensions

 View Only
Expand all | Collapse all

Layer.DefaultColor throws an error in 2024.10 but works in 2024.00

  • 1.  Layer.DefaultColor throws an error in 2024.10 but works in 2024.00

    Posted 02-12-2025 19:31

    Just tried to run my rename/copy layer macro in 2024.10.

    It fails when I try to set the color of the new layer to the value of the old one, or any Color.

    outputlayer.DefaultColor = o.DefaultColor
    outputlayer.DefaultColor = Color.Blue

    I get a "class Exception"

    It still works without problems in 2024.00

    According to the 2024.10 SDK that value should still be accessible.

    A heads up on that kind of changes would be good.



    ------------------------------
    Ronny Schneider
    ------------------------------


  • 2.  RE: Layer.DefaultColor throws an error in 2024.10 but works in 2024.00

    Posted 02-13-2025 08:34

    Hey Ronny,
    Could you pass along the full exception? I tried doing this myself and couldn't see any issues, both using the LayerManager in TBC and a macro ("CopyLayerGroupMembers") that edit the DefaultColor field. Something else may be afoot. 



    ------------------------------
    Bryce Haire
    ------------------------------



  • 3.  RE: Layer.DefaultColor throws an error in 2024.10 but works in 2024.00
    Best Answer

    Posted 02-16-2025 15:29
    Edited by Ronny Schneider 02-16-2025 22:29

    Not sure what had happened, the whole project was shot. Was able to create Layers in the Layer manager, but once I tried to change the Color there, I also get an error.

    Managed to track it down to a leftover Surfaceimitation/Viewfilter/QualityMarkingFlag combination. Don't ask me how it happened.

    I had another look. It seems to be project dependent. So far, I found one, of course it was the first the one I opened and worked in after updating to 2024.10. The same project doesn't produce an exception in 2024.00.

    And what is even weirder is that it finishes properly although throwing the exception.

    I tried that specific project in one of my test macros outside the try/except and "with TransactMethodCall(self.currentProject.TransactionCollector) as failGuard", same problem there.

    In my "SNR_Layername" macro it hits the exception

    but finishes properly anyway.

    What does DefaultColor do after setting the color that could cause the exception but still finish properly.



    ------------------------------
    Ronny Schneider
    ------------------------------



  • 4.  RE: Layer.DefaultColor throws an error in 2024.10 but works in 2024.00

    Posted 02-18-2025 09:30

    Lol, glad you were able to root cause it to a specific location. 

    Let me know if you see the "transaction issue" again, as this area was recently worked on during the v2024.10 release. 

    It may be helpful to pass along steps to reproduce to address in upcoming TBC releases. 



    ------------------------------
    Bryce Haire
    ------------------------------