Trimble Connect User Forum

 View Only

How to SetColor to modelObject with API

  • 1.  How to SetColor to modelObject with API

    Posted 12-07-2017 02:16

    Hi,

     

    I'm making a real time construction status monitoring solution. Idea is to change model objects colors by status from our database. I made a test app with Trimble Connect Desktop API to set model object colors. And it's working:

    var allModelObjects = activeProject.ModelObjectManager.GetModelObjects().ToList();
    {foreach (ModelObject modelObject in allModelObjects)
    {Color color = Color.FromName("Green"); modelObject.SetColor(color);}}

     

    But the only way to save newly colored objects is to create new View:

    activeProject.ViewManager.CreateView("Live");

    There is no "UpdateView" method. I need some sort of "Live" always up to date View.

     

    I'm trying to do the same thing with Web API (Trimble.Connect.Client) way:

    var views = await projectClient.Views.GetAllAsync();
    Trimble.Connect.Client.Models.View liveView = new Trimble.Connect.Client.Models.View();
    foreach (Trimble.Connect.Client.Models.View view in views)
    {if (view.Name == "Live")
    {liveView = view;}}

    I can see my View and it's properties in the debugger, but can't figure out how to get model objects and to set colors.

    Is it possible with Trimble.Connect.Client or do I need to use REST commands? How to set colors to model objects like beams and columns?