Skip to main content
                     
As-Built As-Built - Revit As-Built - AutoCAD VirtuSurv - VirtuSurv 2018 As-Built - Modeler VirtuSurv - VirtuSurv 2019          
BuildIT BuildIT - Projector BuildIT - Construction BuildIT - Metrology              
CAM2 CAM2 - SmartInspect CAM2 - 2018 CAM2 - Measure 10 CAM2 - Measure Q CAM2 - Measure X CAM2 - Measure 3/4 CAM2 - AnthroCAM CAM2 - 2019 CAM2 - 2020  
Cobalt 3D Imager 3D Imager - Cobalt                  
Cobalt Design Cobalt Design - M Cobalt Design - S Cobalt Design - Dual              
Computers Computers - All Computers                  
FARO Aras 360 & CAD Zone FARO CAD Zone - Fire & Insurance FARO CAD Zone - Crime & Crash FARO CAD Zone - CZ Point Cloud FARO CAD Zone - First Look Pro FARO 360 - Reality FARO 360 - HD FARO 360 - Blitz FARO 360 - Genius    
FARO Zone present4D - present4D                  
FARO Zone 2D FARO Zone 2D - 2018 FARO Zone 2D - 2019 FARO Zone 2D - 2020 FARO Zone 2D - 2021            
FARO Zone 3D FARO Zone 3D - 2018 FARO Zone 3D - 2019 FARO Zone 3D - 2020 FARO Zone 3D - 2021            
FARO Zone 3D Advanced FARO Zone 3D Advanced - 2018 FARO Zone 3D Advanced - 2019 FARO Zone 3D Advanced - 2020 FARO Zone 3D Advanced - 2021            
FaroArm/ScanArm FaroArm/ScanArm - Quantum S FaroArm/ScanArm - Quantum M FaroArm/ScanArm - Quantum E FaroArm/ScanArm - Edge FaroArm/ScanArm - Fusion FaroArm/ScanArm - Prime FaroArm/ScanArm - Platinum FaroArm/ScanArm - Legacy Quantum FaroArm/ScanArm - Titanium FaroArm/ScanArm - Advantage
FaroArm/ScanArm FaroArm/ScanArm - Digital Template FaroArm/ScanArm - Gage                
Hand Held Scanner 2D Hand Held Scanner - ScanPlan 3D Hand Held Scanner - Freestyle3D 3D Hand Held Scanner - Freestyle3D X 3D Hand Held Scanner - Freestyle3D Objects 3D Hand Held Scanner - Freestyle 2          
Language Quality HT MT AT NT INT - Internal Sales - Internal Resources Sales - Order and Quote Sales - Product Info Sales - Sales Readiness Sales - Training
Language Quality CS - Procedures and Product Sales - Product Launch Sales - Promotions              
Languages Language - English Language - Japanese Language - German Language - Chinese Language - Spanish Language - Italian Language - Portuguese Language - French    
Laser Projector RayTracer - RayTracer Laser Projector - Tracer M Laser Projector - Tracer SI              
Laser Radar Imaging Laser Radar - VectorRI                  
Laser Scanner 3D Laser Scanner - Focus S 3D Laser Scanner - Focus M 3D Laser Scanner - Focus3D 3D Laser Scanner - Focus3D X 3D Laser Scanner - Focus3D X HDR 3D Laser Scanner - Focus3D S 3D Laser Scanner - Photon 3D Laser Scanner - Focus S Plus 3D Laser Scanner - Swift  
Laser Tracker Laser Tracker - Vantage Laser Tracker - ION Laser Tracker - Vantage S Laser Tracker - Si Laser Tracker - X Laser Tracker - Xi Laser Tracker - Vantage E Laser Tracker - Vantage S6 Laser Tracker - Vantage E6  
Legacy Gage Legacy Gage - Bluetooth Legacy Gage - Plus Legacy Gage - Standard Legacy Gage - Power            
Legacy Software Legacy Software - CAM2 Gage Legacy Software - Gage Software Legacy Software - Insight              
PointSense PointSense - Basic PointSense - Pro PointSense - Building PointSense - Plant PointSense - Heritage PointSense - Revit CAD Plugin - TachyCAD Building CAD Plugin - TachyCAD Archeology CAD Plugin - TachyCAD Interior CAD Plugin - PhoToPlan Basic
PointSense CAD Plugin - PhoToPlan CAD Plugin - PhoToPlan Pro CAD Plugin - PhoToPlan Ultimate CAD Plugin - DisToPlan CAD Plugin - MonuMap CAD Plugin - hylasFM CAD Plugin - VirtuSurv      
RevEng RevEng - RevEng                  
ScanArm ScanArm - Design ScanArm 2.0 ScanArm - Design ScanArm ScanArm - Forensic ScanArm ScanArm - Design ScanArm 2.5C            
SCENE SCENE - Capture and Process SCENE - WebShare Server and 2Go SCENE - WebShare 2Go App SCENE - 2018 SCENE - 7.x SCENE - 6.x SCENE - 5.x SCENE - 4.x SCENE - LT SCENE - 2019
SCENE SCENE - 2go App SCENE - 2020                
Serial FaroArm Serial FaroArm - Silver Serial FaroArm - Gold Serial FaroArm - Bronze              
Visual Inspect Visual Inspect - App Visual Inspect - CAD Translator                
WebShare WebShare - Enterprise WebShare - WebShare Cloud                

BuildIT

Metrology

FARO® Knowledge Base

Setting Up and Using the RPC Server with BuildIT Metrology

BuildIT-bty-temp.png

Overview

This article presents a high-level overview of the RPC server capabilities. It also details how to enable the functionality, and provides typical use cases as well as an example client using WebSocket. A Python API is available for developing client applications in Python. This API is documented under the Python API Overview section in the internal documentation.

Accessing Internal Documentation

This article and additional information is available within BuildIT under Help > Python Interface.
BuildIT-HelpPythonMenu.png

RPC Server

The RPC (Remote Procedure Call) server allows client systems and applications to drive BuildIT and coordinate the execution of automated processes and measurements commands.
Capabilities include:

  • Exchanging serializable data with BuildIT (strings, floats, integers, etc.)
  • Retrieving real-time device information such as probe coordinates, 3D deviations, device status, etc.
  • Launching automated processes and triggering measurements
  • Displaying instructions and feedback in the BuildIT viewport
  • Activating projection layers, and navigating the projection plan

It also enables using the BuildIT remote control, a browser-based application that offers an interface for conducting inspection and projection workflows. More information on the remote control can be found here.

Client applications can communicate with the RPC server over WebSocket directly, or use an API. Both a Python API and a JavaScript API are available. The RPC server setup and usage overview is documented below.

Communicating with External Systems via the RPC Server

Clients can communicate with the RPC server using various methods:

  • Using WebSocket: The most direct communication channel with the RPC server. If the client can communicate over WebSocket, it can communicate directly with the RPC server. For more information, refer to the WebSocket Interface section in the internal documentation.
  • Using the Python API: A Python API is available for writing client applications. For more information, refer to the Python API Overview page in the internal documentation.
  • Using the JavaScript API. A JavaScript API is available for writing client applications. Reach out to support@builditsoftware.com for additional information
  • If the client cannot communicate over WebSocket or use the APIs, we suggest setting up a “broker” or “proxy” application that would translate the inputs from the client, and send back the responses from the RPC server

Enabling the RPC server

By default, the RPC server functionality is deactivated. It needs to be activated manually once, and will remain activated whenever launching BuildIT afterwards. To activate the RPC server:

  1. Open “File: Setting
  2. Go to the “Interface” category
  3. In the “HTTP Server” section, tick the “External Access” option
  4. Click “OK
    RPCServer-Settings.png
  5. Set the appropriate permissions for the network on which you will communicate with the RPC server.
    RPCServer-Firewall.png

The RPC service

Once the RPC server has been enabled, a lightweight service will automatically be launched when opening BuildIT. The service will keep running after closing BuildIT. It can also be launched as a standalone application. When the service is running, an icon will be displayed in the system tray:
rpc_service_system_tray.png

The service keeps track of the active instances of BuildIT and can return the list of active instances as well as launch new instances. The port number of the service is always the lowest number in the range defined in the settings.

This documentation assumes that the service is running.

Accessing the RPC Server Documentation

For the list of WebSocket calls:

  1. In a web browser, go to http://localhost:34203/rpc_test.html (if needed, replace the digits with the port number defined in the settings).
  2. Hit the “Connect” button to connect to the WebSocket server.
  3. All commands are available from this page and can be tested through this interface.
  4. The full list of commands can be printed using the “rpc.dir()” command.
    RPCServer-Documentation.png

Typical usage

In general, the RPC server’s available functions and mechanisms encourage designs where the external system controls BuildIT, and BuildIT performs the requested actions and commands, and provides handshakes and feedback.

Example: Robot Path Validation with the Laser Tracker

In this application, the external controller (robot controller) and BuildIT need to coordinate and go through a robot path validation workflow. The robot starts at an arbitrary position, and BuildIT acquires data while the robot is moving. BuildIT then performs an analysis. The two systems need to exchange some information before and after the robot movement, and coordinate when to start and stop the acquisition.

During the execution of the process, the controller coordinates the necessary steps with BuildIT through calls to the RPC server.

RPCServer-Workflow-metrology.png

In this example, the robot controller performs essentially 5 calls to the RPC server:

  1. Set global BuildIT variables to be retrieved and used by the process
    • Available in BuildIT 2021 - In older versions, the exchange needs to be done via other means
  2. Launch the process corresponding to the job to be performed
  3. Launch the measurement when both the robot and BuildIT are ready
  4. Stop and accept the measurement when the robot has completed its path
  5. Retrieve the global BuildIT variables set by the process
    • Available in BuildIT 2021

For ensuring that BuildIT is ready to be issued those 5 calls (i.e. validating there is no process already running, knowing when the measurement command is ready, or confirm it has started, validating the process has finished, etc.) the robot controller can poll the BuildIT RPC server for getting the relevant measurement and process status.

Example: Projection Workflow

In this application, the external controller activates the projection layers pre-defined in the projection plan. Before starting the projection, the controller and BuildIT need to coordinate on a few preliminary steps.

The whole workflow consists of essentially 4 separate calls to the RPC server:

  1. Opening the model.
    • This model contains the layers to be projected.
  2. Connecting to the projectors in plan.
  3. Aligning the projectors to retro-targets.
    • Those retro-targets are listed in the projection plan and their nominal positions are defined in the BuildIT model.
  4. Activating the projection layers. This step would generally consist of a loop on the controller’s side. The BuildIT application does not require running any automated process for receiving those calls.

    RPCServer-workflow-projector.png

In cases where the projector or the part would be moving using an actuator, performing a dynamic relocation would require calling an automated BuildIT process for moving the projectors to the desired position in the BuildIT model. This step could be called via the RPC server at any point, just like the other steps in the workflow.

WebSocket Interface

Client applications can interface with the RPC server via a WebSocket connection.

Expected Syntax when using WebSocket Interface

The RPC server expects a json string over WebSocket. This string should be comprised of the following properties:

  • method: Name of the method to run - this name can be obtained via the documentation
  • params: Arguments passed to the method * The definition of arguments can be obtained via the documentation * Methods that do not expect an argument should be passed the “null” parameter
  • id: the id sent along with the request will be sent back with the response

That page lists the methods available in the API. Those RPC calls can be tested independently of Python in a web browser, via http://localhost:34203/rpc_test.html.

Example WebSocket Client (written in Python)

Note: If writing the client application using Python, we strongly recommend using the Python API. The example below is meant to illustrate a typical WebSocket communication with the RPC server, and not for providing an example on writing a client application in Python.

Information on the Python API can be found in the internal documentation.

import json
import asyncio
import websockets

uri = "ws://localhost:34203/ws/buildit"

commands = [
    {

        'method' : 'buildit.getProfileName',
        'params' : None,
        'id'     :  1
        },
    {

        'method' : 'buildit.messageBarOutput',
        'params'
: ['Sending a message via RPC server', 'normal'],
        'id'     :  2
        },
    {

        'method' : 'buildit.getProcessInfo',
        'params' :
None,
        'id'     : 
3
        }
    ]

async def send_messages():
    try:
        async with websockets.connect(uri) as websocket:
            for command in commands:
                message = json.dumps(command)
               
await websocket.send(message)
               
print(f"> {message}")
                response =
await websocket.recv()
               
print(f"< {response}")
   
except OSError:
       
print(f'Make sure BuildIT is connected and RPC server is running and listening at address {uri}')

asyncio.get_event_loop().run_until_complete(send_messages())

"""
Output:
> {"method": "buildit.getProfileName", "params": null, "id": 1}
< {"id":1,"result":"Metrology"}
> {"method": "buildit.messageBarOutput", "params": ["Sending a message via RPC server", "normal"], "id": 2}
< {"id":2,"result":null}
> {"method": "buildit.getProcessInfo", "params": null, "id": 3}
< {"id":3,"result":{"name":"","path":"","status":"STOP"}}
"""