TBC Macros and Extensions

 View Only
Expand all | Collapse all

Some changes coming for macros in version 5.90

  • 1.  Some changes coming for macros in version 5.90

    Posted 03-20-2023 16:32

    TBC will be upgrading the version of IronPython used by TBC. The new version is 3.40. This version of IronPython has many enhancements and new features. This update also includes an update to the python runtime library.

    Most existing TMLs (but not all) will require small changes in order to run with the latest python version.

    TMLs compiled into pydll files will have to be compiled using version 5.90 as the python runtime libraries are not compatible with previous versions.

    Because of the two above issues, the folder name where TBC searches for macros has changed. TBC now looks in C:\ProgramData\Trimble\MacroCommands3. (Note "3" at end of folder name) This allows users to keep TMLs from previous TBC versions installed without effecting version 5.90.

    We also enhanced the security of TMLs by making the macros folder read only. That means only users with admin privileges can add macros to the folder. When TBC scans a folder for commands, we place the results of the scan into a file called <folder>.dict. This is done so TBC doesn't have to compile each TML every time TBC starts. When macros are installed by Trimble, we create the *.dict file and make it read/write.

    Some of the changes required to run using latest IronPython. (green background is the new version)

    Integer division. IronPython will use a float if result is not a whole number.


    Enums with "True, False, or None" have issues as they are reserved words. Just replace with ['enum'] format.


    Exceptions. Slightly different format.

    xrange no longer needed. Replace with "range"

    The GlobalSelection class has moved to a different namespace.

    When TBC starts, a hidden command (named "MacroManager") is executed on startup. The command will find all the .py (and .pydll) files in the C:\ProgramData\Trimble\MacroCommands3 folder. If the file is newer than the time stamp on the *.dict file, then the py file is compiled and added to the list of valid commands.

    If something prevents the "MacroManager" command from running (like forgot license key or offline), then there will be no macro commands defined. The user can manually run this command by entering "macromanager update" as a command. The "update" argument tells TBC to retry adding macro commands.

    When developing a new macro, the new macro command is normally added as a command when TBC starts. If there is a compile error, this may prevent the command from being added. To prevent the need to restart TBC, you can use the "MacroManager" command to compile the new file (and add the command). To add a new macro command, enter "macromanager <macro-name>" as a command. TBC will search all macro folders for the py file. If the command has already been added, then just run the command. If the source *.py is newer, it will be compiled automatically. 

    TBC does support macro folder redirection. If you define an environment variable named "TBC_Macro3Path", the value of the variable should be the folder where TBC should search for macros (instead of C:\ProgramData\Trimble\MacroCommands3). Environment variable "TBC_Macro3Path2" can be used to define a folder that TBC searches in addition to the normal folder.



    ------------------------------
    Gary Lantaff
    ------------------------------


  • 2.  RE: Some changes coming for macros in version 5.90

    Posted 03-20-2023 21:27

    Hello Gary,

    thanks for the information.

    The enhanced security though is a deal breaker and no-go. I was already wondering what was going on when I installed the Beta version on my private laptop and couldn't properly access the folder although I'm the admin on my private machine.

    At my workplace do only our IT guys have admin rights and need to login to our machines to install TBC. And for each update/program/settings change we want we need to call them and they have to login again, if they are available that is. We can't even change the desktop background, or delete icons from it when they were placed there during an admin session.

    For some things I actually have to use my private laptop, i.e. running the ASCII file generator from a batch file. 

    With that "enhanced" security everybody in our company who is using my macros would have to call IT each and every time I update something. I couldn't even create a new one without calling them.

    Please reconsider that move, that's going to cause troubles for a lot of users.

    Cheers

    Ronny



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



  • 3.  RE: Some changes coming for macros in version 5.90

    Posted 03-21-2023 13:25

    The "enhanced security" is just the default you get when you install TBC. We added this at the request of several companies so their IT has some control over adding TMLs. There is nothing to prevent you from changing the default permissions.

    The easiest solution is to create a folder inside the "MacroCommands" folder where you place all your macros. Just make this folder read/write and you should have the same behavior as previous versions of TBC. Just create the folder on your desktop (so it picks up read/write attributes by default) and then move the folder to C:\ProgramFiles\Trimble\MacroCommands3. You will need admin permission to move the folder to MacroCommands but once moved, you should not need admin permissions to add or modify macros.



    ------------------------------
    Gary Lantaff
    ------------------------------



  • 4.  RE: Some changes coming for macros in version 5.90

    Posted 03-21-2023 14:08

    @Ronny Schneider

    I had the some thoughts yesterday. Those IT people, they're the same everywhere :) How about:

    TBC does support macro folder redirection. If you define an environment variable named "TBC_Macro3Path", the value of the variable should be the folder where TBC should search for macros (instead of C:\ProgramData\Trimble\MacroCommands3). Environment variable "TBC_Macro3Path2" can be used to define a folder that TBC searches in addition to the normal folder.

    Can we have our own macro folder? c:\scr_macros ?



    ------------------------------
    Marian
    ------------------------------



  • 5.  RE: Some changes coming for macros in version 5.90

    Posted 03-21-2023 16:38

    Also needs to be done by IT during installation. That would mean they'd have to have a procedure what to do, which they'll probably never "remember/follow". So, the user who gets TBC installed needs to be aware of it and make sure they do. Either way it means the user needs to kick IT's butt to either create that environment variable or to unlock the macro folder. Third party TBC macros won't work out of the box anymore since some companies force their IT regulations on all of us. Instead of locking the folder themselves, if they really need this, they force the rest of us to unlock it.

    Trimble should add a tickbox into the setup.exe GUI, default unlocked of course. The handful of IT departments out there that really need this can tick that one during installation and have it their way but leave the rest of us unmolested.



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



  • 6.  RE: Some changes coming for macros in version 5.90

    Posted 03-21-2023 19:53

    Amen @Ronny Schneider , amen!



    ------------------------------
    Marian
    ------------------------------



  • 7.  RE: Some changes coming for macros in version 5.90

    Posted 06-07-2023 21:27

    Found another class that has been moved around:

    until 5.81 -  Trimble.Vce.UI.ScanningCommands.CreateBestFitLine

    from 5.90 - Trimble.Vce.Alignment.Linestring.CreateBestFitLine

    usage has changed slightly as well

    V5.81

    V5.90



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



  • 8.  RE: Some changes coming for macros in version 5.90

    Posted 06-14-2023 03:13

    Hi Ronny,

    thanks for the additional info. I also found some issues regarding the License class:

    clr.AddReference("Trimble.Vce.License")
    from Trimble.Vce.License import HardenedManager as License

    I used until v5.81 the unique id to license my macros:

    strUniqueId = License.GetActiveTrimbleID().UniqueID

     

    However it does not seem to work any longer and if I rather use:

    clr.AddReference("Trimble.Vce.License")
    from Trimble.Vce.License import TrimbleIDAuthInfo as License

    and then:

    strSelectedUserID = str(License.SelectedUserID)

    I get indeed again a numeric Id, however a different one than the one before with the old function, and it should give back the unique id of the current Trimble Id.

    In case anyone from the Trimble team is reading this (or anyone else if he/she knows it, of course ;-) ), could you please let me know if this id can be used as unique id of the current Trimble Id? 

    Furthermore does a network license have a single Trimble Id or rather each seat a different one ?

    Thanks.

    Regards,

    Fernando



    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------