I'm pretty new to TBC and the SDK to talk about these things! But back to Ronny's point, yes you can compile a Visual C++.NET or C#.NET and call it into your macro; however, after talking with @Gary Lantaff he recommended to stick with Python as much as possible since transferring the macros from one user to another will be super easy with python.
Writing C# works most of the time for me and I usually try new things using that since the intellisense works better and also data structures are C# friendly.
System.Collection.Generics were extensively used in the SDK code then it's really tempting to use C# with Entity FrameWork to iterate thought the collections (personal preference). Most of the collections in the SDK are implementing the IEnumarable<T> so it's really convenient to use LINQ or Extension Methods.
I found python 2.7.1 also supports Iterable and Iterators which are comparable to enumerates in C# but a bit weaker and difficult to use (again, user preference). At the moment I compile the C codes using .NET FrameWork 4.6.1 and it works pretty smooth with IronPython 2.7.1.
If there was a way to completely write in C# I would say it's worth to write the entire code in C#. I'm not sure if there is a way to directly run a non-executable code (.dll here) with the TBC launcher and bypass the IronPython, so please let me know if you figured that out!
Original Message:
Sent: 02-18-2023 22:17
From: Ronny Schneider
Subject: Visual Studio 2022 (Missing TbcMacros.zip)
You should be able to use any programming language that can access/handle TBC's .NET assemblies. When it comes to Python we need to use IronPython since only that one can import those and normal Python can't.
From my understanding you'll still need a basic python script in order for your macro to be registered by TBC (see section How TBC Macros Work here https://community.trimble.com/viewdocument/01-welcome-to-trimble-business-cent?CommunityKey=8a262af4-a35e-4e9a-9dd3-191cc785899a&tab=librarydocuments&LibraryFolderKey=639c1ad6-7791-419b-96b3-2330a7eadb72&DefaultView=folder
But that one just needs to call your compiled DLL.
I never went down that road. I try to use as many built in methods as possible, compromising performance for me on a marginal level by sticking with pure python script. Occasionally, i.e. with macros that potentially need to loop millions of times (surface manipulating), I do compile the Python script into a .pydll, gaining quite a bit of performance that way as well.
@Morteza Kiani can probably help you more with C# or C++, since he seems to be doing it that way.
There must be another way but I don't know how it works. The ANZToolbox is not installed in the folder we are supposed to use but in "C:\Program Files\Sitech Construction Systems". But that one is developed and distributed with the official TBC installation package. So, I assume that the Trimble developers have added some dedicated code to check for content in that folder.
------------------------------
Ronny Schneider
Original Message:
Sent: 02-18-2023 20:21
From: Landon Blake
Subject: Visual Studio 2022 (Missing TbcMacros.zip)
Thanks for the help Ronny! No wonder I was struggling?
I can run VS 2019 if needed. I wasn't aware Trimble Macros could be developed in C#. I already know how to code in that language. Are there examples in C# or a place where I can learn more?
Thanks again!
Landon
------------------------------
Landon Blake
Original Message:
Sent: 02-17-2023 19:19
From: Ronny Schneider
Subject: Visual Studio 2022 (Missing TbcMacros.zip)
See post 8 here
https://community.trimble.com/communities/community-homepage/digestviewer/viewthread?MessageKey=9c60ca94-15bb-449e-b74e-531d659c9590&CommunityKey=8a262af4-a35e-4e9a-9dd3-191cc785899a#bm9c60ca94-15bb-449e-b74e-531d659c9590
regards Visual Studio 2022 and IronPython.
If you're going to develop in C++ or C# it probably won't be an issue.
------------------------------
Ronny Schneider
Original Message:
Sent: 02-17-2023 12:07
From: Landon Blake
Subject: Visual Studio 2022 (Missing TbcMacros.zip)
I'm posting this for other folks that have struggled to set-up the TBC Template for Visual Studio. I wanted to install it for Visual Studio 2022. Please note: The Version 5.70 Trimble Macro SDK Installer doesn't currently install the macro template for Visual Studio!
Here is the work-around I used:
1) Install Visual Studio Community 2019.
2) Run the Trimble Macro Language SDK.
3) Go to the "Visual Studio 2019" folder in your user's "Documents" folder. Copy the "TbcMacros.zip" file from here into the "Visual Studio 2022" folder in your user's "Documents" folder.
4) For a shortcut, I've put the "TbcMacros.zip" file here: TbcMacros.zip
| Google Docs | remove preview |
|
Once this is done, when you run Visual Studio 2022 and you go to start a new project, the template for TBC macros should show up.
Please note: For some reason the template creates a blank file in the new Visual Studio solution. I just deleted it. The template also doesn't contain the example Python macros. You can download these here:
Sample TMLs
I've put a back-up of those samples you can download here, in case the first link doesn't work: MacroCommands.zip
| Google Docs | remove preview |
|
In addition: When I try to add the TBC controls using the instructions, I get an error message telling me the "Timble.Vce.UI.Controls.dll" is not valid. I'm still trying to determine the cause of that error.
I hope this post helps other folks getting started with TBC Macros. Trimble needs to update the SDK installer to support Visual Studio 2022.
Thanks.
Landon
------------------------------
Landon Blake
------------------------------