Skip navigation
All Places > TBC Macros and Extensions > Blog
Gary Lantaff

TML - AssignNameFromLayer

Posted by Gary Lantaff Nov 29, 2018

This TML can be used to name line objects using the name of the objects layer. You just select the line to name and enter a name "mask". 

You specify the new name using a name mask. If "{L}" is included in the new name, the layer name will replace that. Using "{N}" will insert previous name. So if you enter something like " L={L} old={N}" you will get something like "L=MyLayer old=OldName"

If you just want the name of the object to be the layers name, use "{L}" for name mask. (don't add quote characters)

 

By default, lines with an existing name will be skipped but you can "uncheck" the "Ignore lines with a name" option and all lines will have their name assigned.

 

An option to add a text label at the mid-point of the line has been added. The text will be the line's new name.

 

Gary Lantaff

TML - OffsetSurface

Posted by Gary Lantaff Nov 27, 2018

The OffsetSurface TML is included in the TBC 5.0 install but I have updated it to include support for adding a clipping boundary while it copies the surface. The clipping boundary is optional. If you download this zip file, make sure you unzip it in the same folder as the macro installed with TBC (C:\ProgramData\Trimble\MacroCommands\Trimble)

Gary Lantaff

TML - FindSurfaceArea

Posted by Gary Lantaff Nov 4, 2018

Macro to find triangles inside area bounded by any surface breakline. The triangle planimetric and slope area are computed. The button "Create Text.." will bring up a dialog box allowing user to create a text label containing the computed areas. If you hold the "shift" key down, the areas are totaled.

 

Gary Lantaff

TML - VPI at Elevation

Posted by Gary Lantaff Oct 22, 2018

This simple TML will add a vertical PI at the specified elevation. If the linestring has more than one segment that intersects with the defined elevation, a VPI will be created at each intersection.

 

Gary Lantaff

TML - View Project Data

Posted by Gary Lantaff Oct 22, 2018

This TML is helpful for macro developers to explorer the object model of a TBC project file. The tree view displays every object found (starting at the top level "Project" object). When an object is selected, the bottom area of the window will report every interface defined for that object. You can also see the full "namespace" of each object. In the example shown, you can tell that the arc is defined in the Trimble.Vce.ForeignCad namespace. This is helpful when using the "Object Browser" view in Visual Studio.

 

Gary Lantaff

TML - 3D points to arc

Posted by Gary Lantaff Oct 22, 2018

This TML will create an arc in the plane defined by three 3D points. Coordinates 1 and 3 define the beginning and end of the arc. This command is useful when used with building scans and you want to create an arc from the scanned locations.

 

Gary Lantaff

TMLs - Start Here

Posted by Gary Lantaff Oct 17, 2018

TBC now supports command extensions using the python language. The python scripts are scanned when TBC starts and valid macro commands are added to the command list in TBC.

 

TBC scans for macros (the *.py files) in the folder C:\ProgramData\Trimble\MacroCommands or any folder below that. This makes it convenient to place all the macros from one source (user developed, 3rd parties, Trimble) in separate folders.

 

Note, the folder C:\ProgramData is typically a hidden folder. You can either turn on the display of hidden items in File Explorer or just enter the folder path in File Explorer. 

 

Any macros downloaded from the community (or created by the user) can be placed anywhere under the macro folder. You may find it convenient to create a folder named "Community" to store the macros downloaded from here. Another option is to store the macros in a folder named after the macro author. 3rd party developers of macros are likely to store their macros in a named folder location. If you download a compiled macro (extension of *.pydll), you may need to unblock the file (see last field in file properties)

 

 

When TBC is installed, a small set of macros is placed in a folder named Trimble in the macro folder. Feel free to open these files with a text editor to see how macro commands are added to TBC. It's best not to add any macros obtained from other sources to this folder.

 

Whichever method you use, just unzip the downloaded macro into a location under the macro folder and the next time TBC is started, it will find the new macro commands and add them to the command list.

 

Warning: If you install the same macro in multiple folders (under the macro folder) then you will get an error when TBC starts (see image). Just delete the duplicate macro file to stop this error from occurring again.

 

Gary Lantaff

TML - ConvertToDll

Posted by Gary Lantaff Oct 17, 2018

This macro can be used to compile a TML macro into a DLL. A compiled macro will have an extension of *.pydll.

 

A compiled DLL still needs access to the xaml file (if used) so include that if sending your TML to other users. See sample macro "QuickLine.py" for sample of how to embed the xaml source into the python source (so you would only need to send the pydll file)

 

TBC will find macros (the *.py files) if the file is located in the folder C:\ProgramData\Trimble\MacroCommands or any folder below that. This makes it convenient to place all the macros from one source (user developed, 3rd parties, Trimble) in separate locations. This macro is best placed in the top level folder (C:\ProgramData\Trimble\MacroCommands) as it searches for macros to convert from its location and sub-folders from there.

 

Just check the name of the macro you want converted into a DLL. This macro should be run before any other macro is executed. (If you have run a DLL macro, you can't use this command to update the DLL untill TBC is restarted)

 

Gary Lantaff

TML - InsertLineSegment

Posted by Gary Lantaff Oct 17, 2018

 

This TML simply lets you select a linestring (for now it only works with linestrings) and then pick a coordinate to insert into the line. The coordinate is inserted at the nearest segment of the line.

 

You can set the "AutoTab" feature (the blue icon) to control if command lops back to pick another linestring or lets the user pick additional coordinates for same linestring.

 

Now updated to allow elevations to be defined.

 

To try out the TML (assuming you have TBC version 5.0 or later), download the attached zip file and place the TML files in the macro folder (C:\ProgramData\Trimble\MacroCommands). Note, on some computers the C:\ProgramData folder is hidden. Just enter the path in File Explorer.