TBC Macros and Extensions

 View Only
Expand all | Collapse all

New TBC Macros SDK for v2023.10

  • 1.  New TBC Macros SDK for v2023.10

    Posted 11-16-2023 14:51
    There is a new TBC Macros SDK for TBC v2023.10!
     
    You can find it on the homepage for this community (link here):
     
    Expand the "Software Development Kit (SDK)" group box, and it is listed as "TBC Macros SDK for v23.10". The file name is "trimble_macros_sdk_v2023.10.msi"
     
    I don't know how long it has been there - there wasn't a community "announcement" for it, nor a "blog" post. I was poking around, curious what versions were in the SDK box, and found a pleasant surprise!

    Good luck, and have fun!


    ------------------------------
    Quan Mueller
    Revenant Solutions - TML Development
    ------------------------------


  • 2.  RE: New TBC Macros SDK for v2023.10

    Posted 11-16-2023 16:32
    Edited by Quan Mueller 12-05-2023 12:45

    [Edit: This comment originally stated that the MyFirstMacro.py file did not load in versions after v5.00.2.  This was incorrect.  I use Visual Studio 2022 and my setup instructions missed the step to manually copy the TbcMacros.zip to the appropriate folder for VS2022 and ensure that the project template cache was cleared.  The comment now reflects the behavior of the MyFirstMacro.py included in the v2023.10 SDK installation for Visual Studio 2019]

    Note, if you use the TbcMacros project template in Visual Studio (that's installed with the Macros SDK), the MyFirstMacro.py file does NOT load in the following versions:

    TBC v5.41
    TBC v2023.10

    Make the following 3 changes starting after line 53, and it should load in all versions:

    line 53: clr.AddReference("Trimble.Vce.UI.Controls")
    [add this line] clr.AddReference("Trimble.Vce.UI.UIManager")
    line 54: # later version of TBC moved these to a different assembly. If not found in new location, look at old
    line 55: try:
    [add this line]    from Trimble.Sdk.Interfaces.UI import ControlBoolean
    line 56:     from Trimble.Sdk.UI import InputMethod, MousePosition, CursorStyle, [remove "ControlBoolean,"] UIEventArgs

    Hopefully the dev team can update the MyFirstMacro.py file and re-post the SDK, or at least make the fixes for the next SDK.
    ------------------------------
    Quan Mueller
    Revenant Solutions - TML Development
    ------------------------------



  • 3.  RE: New TBC Macros SDK for v2023.10

    Posted 11-29-2023 09:04

    Hi Quan,

    The TBC Macros release for 2023.10 has the updated project templates for Visual Studio 2019. The template zip is removed and reinstalled during installation so the latest template should be available (Documents/Visual Studio 2019/Templates/ProjectTemplates/TbcMacros.zip). 

    The two major changes this last release within the project template was the addition of the "Trimble.Sdk.UI" project reference and migration of a number of lower-level controls to the "Trimble.Sdk.UI"

    Let me know where you are seeing the issue and maybe we can find a solution why the project template is not updating. 



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



  • 4.  RE: New TBC Macros SDK for v2023.10

    Posted 12-05-2023 13:23

    Hi Bryce,

    My apologies. I use Visual Studio 2022, and my instructions for testing a new TBC SDK missed an important step: copying the updated TbcMacros.zip from the VS2019 folder to the folder for VS2022 - and importantly, verifying that the project template cache used by VS has been cleared.

    In my case, even with the new .zip copied, my cache still had the old files from the original TML release (v5.00), so no matter what I "installed", it looked like the MyFirstMacro.py file had never changed.

    Having addressed that, I carefully re-tested the MyFirstMacro.py from the v5.90 SDK and the v2023.10 SDK and found:

    Both loaded in: v5.00.2, v5.52, v5.60.2, v5.70.1, v5.81, v5.90

    The file from v5.90 SDK did not load in:
    v5.41 (line 66, "ImportError: Cannot import name MousePosition")

    The file from v2023.10 SDK did not load in
    v5.41 (line 69, "ImportError: Cannot import name MousePosition")
    v2023.10 (line 69, "ImportError: Cannot import name MousePosition")

    The issue for v5.41 (in both SDKs) is that the code that adds the reference to Trimble.Vce.UI.UIManager got moved lower, and so the code for handling  v5.40 did not have access to that assembly reference.  It eventually tries to make imports (on line 66) from the original v5.00 locations - and errors one last time.

    The issue for v2023.10 is that ControlBoolean is still in Trimble.Sdk.Interfaces.UI, so the updated MyFirstMacro.py tries to load it from Trimble.Sdk.UI and fails.  A cascade of failed imports eventually results in line 69, where it tries to make imports from the original v5.00 locations - and errors one last time.

    I have edited my above message with fixes.
    If you can fix/re-post the 2023.10 SDK, I'd be happy to re-test it and re-edit my message.

    Thanks,



    ------------------------------
    Quan Mueller
    Revenant Solutions - TML Development
    ------------------------------



  • 5.  RE: New TBC Macros SDK for v2023.10

    Posted 12-05-2023 13:33

    Thanks for your insights Quan.

    The reason we haven't added the TBCMacros template to VS2022 is that IronPython support was dropped in this version. For now, the recommendation is to continue to use VS2019 as the support is a little better when it comes from a development standpoint.

    I will let you know when I make the necessary changes to get the SDK MyFirstMacro.py updated with the correct namespace for ControlBoolean. 

    Bryce



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



  • 6.  RE: New TBC Macros SDK for v2023.10

    Posted 12-05-2023 14:07

    Thanks Bryce - I appreciate your fast response!

    While you are there, can you also add the reference for Trimble.Vce.UI.UIManager for the v5.40 code? (for completeness sake)

    I am using VS2022 because I am working on a TML development process that mostly uses C#, so editing the .py is minimal.  I understand your primary audience solely uses IronPython, so I don't expect the TbcMacros installation to be updated past VS2019.  Maybe someday Microsoft will add IronPython support back into Visual Studio...



    ------------------------------
    Quan Mueller
    Revenant Solutions - TML Development
    ------------------------------