Hey Patrick-I tried the syntax above to add Utility Line(Pipe here) to my "desiredNework" and unfortunately it doesn't add the Utility Line to the network. It draws a
utility line but two attributes are
(Network and Utility Run) are empty. The current project includes a
UtilityNetwork and a
Utility Run but none of these data has been reflected(screenshot below). Even Start and Stop Nodes are not being populated correctly. I believe I'm not initializing the utility line correctly. Any clue that how it can be fixed? Thank you!

below script defines two simple utility nodes ,
newnode1 and
newnode2 and a simple utilityline that connects them.
selectednetwork = self.utilitynetworkslist.SelectedEntity()
# First Nodenewnode1 = selectednetwork.Add(clr.GetClrType(UtilityNode))
newnode1.Name = "Node#_1"
newnode1.Point0 = Point3D(-6085.240,5575,45)
newnode1.Orientation=0
newnode1.RimElevation = 50
newnode1.MaterialProperties = Inlet_Serial
# Second Nodenewnode2 = selectednetwork.Add(clr.GetClrType(UtilityNode))
newnode2.Name = "Node#_2"
newnode2.Point0 = Point3D(-6025.240,5575,45)
newnode2.Orientation=0
newnode2.RimElevation = 50
newnode2.MaterialProperties = Inlet_Serial
#Defining the UtilityLine that connects two nodesnewlink=selectednetwork.Add(UtilityLine)
newlink.StartNodeSerialNo=newnode1.SerialNumber
newlink.EndNodeSerialNo=newnode2.SerialNumber
newlink.StartElevationType=Utility.EndElevationType.Invert
newlink.StartEndType=Utility.PipeEndType.Calculated
newlink.SetName="TesPipe1"
------------------------------
Morteza Kiani
------------------------------
Original Message:
Sent: 11-19-2022 03:02
From: Patrick L'heureux
Subject: Re: Calling TBC Command from custom Macro
That is correct: "desirednetwork".Add(UtilityLine)
------------------------------
Patrick L'heureux
Original Message:
Sent: 11-18-2022 17:01
From: Morteza Kiani
Subject: Re: Calling TBC Command from custom Macro
One more question, What library do we use to create pipes? Do we use (Trimble.Vce.Utility.UtilityLine )? That will really help me! Thanks
------------------------------
Morteza Kiani
Original Message:
Sent: 11-16-2022 22:01
From: Ronny Schneider
Subject: Re: Calling TBC Command from custom Macro
Hello Morteza,
I did investigate and create a sample macro for @PATRICK L'HEUREUX a short while ago.
For Utility networks you need to use the class Trimble.Vce.Utility.
Attached the sample macro, the import block is my standard that I keep adding to, that's why it is rather long and imports a lot of things that are unnecessary for this macro.
the important stuff isfrom Trimble.Vce.Utility import UtilityNode, UtilityNetworkfrom Trimble.Vce.Gem import SiteImprovementMaterialCollection
not sure if there is better way to find the SiteImprovementMaterialCollection as object, than this
# find the the SiteImprovementMaterialCollection as object for o in self.currentProject: if isinstance(o, SiteImprovementMaterialCollection): self.simc = o
selectednetwork = self.utilitynetworkslist.SelectedEntity() newnode = selectednetwork.Add(clr.GetClrType(UtilityNode)) newnode.Name = "0000_TestNode" newnode.Point0 = Point3D(366660, 8117420,20) newnode.RimElevation = 22 newnode.MaterialProperties = pitserial # set the pit type
------------------------------
Ronny Schneider
Original Message:
Sent: 11-16-2022 14:49
From: Morteza Kiani
Subject: Re: Calling TBC Command from custom Macro
Hi Quan,
Let's say if we want to create a utility network, I found "C:\Program Files (x86)\Trimble\Macros SDK\Trimble.Vce.UI.ConstructionCommands.dll" and under namespace : Trimble.Vce.UI.ConstructionCommands I found a class Trimble.Vce.UI.ConstructionCommands.CreateUtilityNodeCmd and under this class I found a constructor method CreateUtilityNodeCmd() which doesn't take any argument and also it cannot be reference. I'm really fraustrated with creating a Network and put some Nodes and Link into it.
Any Clue that where should I start?
Thank you very much for the help.
------------------------------
Morteza Kiani
Original Message:
Sent: 07-31-2020 11:24
From: Quan Mueller
Subject: Re: Calling TBC Command from custom Macro
Hi Grzegorz,
Yes, within the code of a TML, you can run/launch other TBC commands (including TMLs) and you can optionally pass parameter values to them.
However, (as of 2018 at least) most commands (especially those that have UI like a dialog box or a Command Pane UI), don't have much (or any) support for passing parameters.
And there is no formal documentation for how each command handles parameters. They are mostly used when a command is ran from other code, and needs to set up the UI based on that code (like pre-populating fields).
If you have questions about a specific command's parameters, you would need someone from the TBC dev team to investigate it.
In general, you'll need to call the same code that the TBC command calls.
In some (rare) cases, a command will provide a helper function for other UI to use. Sometimes, there's helper code in the TBC API that clumps functionality together.
You might also ask for a dev to post sample code on how to do something - like modify the Survey Point coordinates for example.
Someone like @Gary Lantaff may be able to help with a short question like that (though with Survey Points, it might get complicated...).
Hope that helps a little,
Quan
Revenant Solutions | Trimble Community
Independent TML Development - Build. Share. Grow.