Skip to content

Layout (TFLX)

karthikeyanthangaraju edited this page Sep 26, 2023 · 10 revisions
  • A job for FieldLink's TFLX layout will be created and edited through the Trimble.FieldLink.Job library.
  • JobService is the class used to either open an existing job or create a new one. The following code describes how to open or create a TFLX job, and the OpenJob method returns an IJob interface object.

Job - Open

If you want to access a project that already exists, you can utilize the JobService class "OpenJob" method.

var jobPath = @“C:\Projects\Sample1-Open.tflx”

var jobservice = new JobService();

return jobservice.OpenJob(jobPath);

Job - Create

The JobService class will utilize the OpenJob method to create a project, specifying the project path as a parameter.

var jobPath = @“C:\Projects\Sample-2-Create.tflx”

var jobservice = new JobService();

return jobservice.OpenJob(jobPath);

The TLFX job file can have DesignPoint, Arc, and Line added using the Add method of the IJob interface. See the sample code below.

IJob - Add Methods Sample Code
Add(DesignPoint point) `var jobPath = @“C:\Projects\Sample1-Open.tflx”var jobservice = new JobService();
using var job = jobservice.OpenJob(jobPath);
var designPoint = DesignPoint.Create("100", 0, 0, 0, job.DefaultLayer);
job.Add(designPoint);job.Save();`
Add(Line line) var jobPath = @“C:\Projects\Sample1-Open.tflx”var jobservice = new JobService();using var job = jobservice.OpenJob(jobPath);var startPoint = DesignPoint.Create("100", 0, 0, 0, job.DefaultLayer);var endPoint = DesignPoint.Create("101", 0, 0, 0, job.DefaultLayer);var line = Line.Create(startPoint, endPoint);job.Add(startPoint);job.Add(endPoint);job.Add(line);job.Save();
Add(Arc arc) var jobPath = @“C:\Projects\Sample1-Open.tflx”var jobservice = new JobService();using var job = jobservice.OpenJob(jobPath);var startPoint = DesignPoint.Create("100", 0, 0, 0, job.DefaultLayer);var endPoint = DesignPoint.Create("101", 0, 0, 0, job.DefaultLayer);var arcPoint = DesignPoint.Create("102", 0, 0, 0, job.DefaultLayer);var arc = Arc.Create(startPoint, endPoint, arcPoint);job.Add(startPoint);job.Add(endPoint);job.Add(arcPoint);
Add(Layer layer) var jobPath = @“C:\Projects\Sample1-Open.tflx”var jobservice = new JobService();using var job = jobservice.OpenJob(jobPath);var layer = Layer.Create("test");job.Add(layer);job.Save();

The TLFX job file can be updated using the Update method of the IJob interface. Here's a sample code:

IJob - Add Methods Sample Code
Update(DesignPoint point) var jobPath = @“C:\Projects\Sample1-Open.tflx”var jobservice = new JobService();using var job = jobservice.OpenJob(jobPath);var dbDesignPoint = job.DesignPoints[designPoint.Id];dbDesignPoint.Description = "Test Description";job.Update(dbDesignPoint);job.Save();
Update(Line line) var jobPath = @“C:\Projects\Sample1-Open.tflx”var jobservice = new JobService();using var job = jobservice.OpenJob(jobPath);var id=”97b09e8d-5c3e-46a2-91ae-811aa1807c64”;var line = job.Lines[Id];var newStartPoint = DesignPoint.Create("200", 270, 0, 0, job.DefaultLayer);var newEndPoint = DesignPoint.Create("300", 300, 0, 0, job.DefaultLayer);job.Add(newStartPoint );job.Add(newEndPoint );line.StartPointId = newStartPoint.Id ;line.EndPointId = newEndPoint.Id;job.Update(line );job.Save();
Update(Arc arc) var jobPath = @“C:\Projects\Sample1-Open.tflx”var jobservice = new JobService();using var job = jobservice.OpenJob(jobPath);var id=”97b09e8d-5c3e-46a2-91ae-811aa1807c64”;var arc = job.Arcs[id];var newStartPoint = DesignPoint.Create("200", 270, 0, 0, job.DefaultLayer);var newEndPoint = DesignPoint.Create("300", 300, 0, 0, job.DefaultLayer);var newArcPoint = DesignPoint.Create("102", 0, 0, 0, job.DefaultLayer);job.Add(newStartPoint );job.Add(newEndPoint );job.Add(newArcPoint );arc.StartPointId = newStartPoint.Id ;arc.EndPointId = newEndPoint.Id;arc.ArcPointId = newArcPoint.Id;job.Update(arc );job.Save();
Update(Layer layer) var jobPath = @“C:\Projects\Sample1-Open.tflx”var jobservice = new JobService();using var job = jobservice.OpenJob(jobPath);var layer = Layer.Create("test");job.Add(layer);var updateLayer = job.Layers[layer.Id];updateLayer.IsVisible = false;job.Update(updateLayer);job.Save();
Clone this wiki locally