Hello Everyone,
I would be grateful if anyone could help me to
insert a Trench Template along a
utility run. By debugging and looking into the
VS Object Browser I was able to spot a function that adds a trench template object into the UtilityRun's collection method (please see below)
The UtilityRun class has a {get:} property that is called
TemplateLocations which was not useful for adding a new trench station since it's read-only! so I decided to use the
AddNodeTemplateLocations function which takes an object type
Trimble.Vce.Alignment.Utility.TemplateLocation. Then, I decided to instantiate an object from
TemplateLocations.
The
TemplateLocations class has a class constructor that takes one argument(uint) which I guess is the serial number (please see below)

and here's the script that I wrote:
#Reference
from Trimble.Vce.Alignment.Utility import TemplateLocation
selectednetwork = self.utilitynetworkslist.SelectedEntity()
for o in selectednetwork:
if type(o)==UtilityRun:
ListOfPoints=List[TemplateLocations]
temp=TemplateLocation(5500)
temp.Name="60.00 VerticalXX2"
temp.Station=60
temp.Template=2042
ListOfPoints.Add(temp)
After running and getting to the first Utility Run, I getting this error (please see below)

Any idea why it says that the defined object is disposed? Is there any better way to insatiate the object and add it to the collection method? Am I understating the procedure correct as we write the value using the method and get the value by the property?
Thank you
------------------------------
Morteza Kiani
------------------------------