# Interactive Parametric Design and Robotic Fabrication within Mixed Reality Environment
## 3 Materials and Methods
### Communication and Simulation
#### 3.1.1 REST API Server for Grasshopper3d Parametric Modeling Software  
By default, the Grasshopper3d parametric-modeling tool is not accessible from other devices, such as a mobile device or a mixed-reality headset. The Grasshopper3d parametric-modeling tool runs only on the computer on which the program is installed. In our study, we developed an application programming interface (API), which enables users to access the Grasshopper 3d parametric-modeling tool via HTTP interface. Users can send input parameters with HTTP requests from the mixed-reality headset. The input parameters are calculated inside the Grasshopper3d parametric-modeling tool, and the results are returned with HTTP response to the program installed on the mixed-reality device, in near real-time.  
REST API Server software has been developed for the Grasshopper3d program to instantly communicate with the mixed-reality device. Under REST architecture, the client and server can only interact in one way: the client sends a request to the server, and then the server sends a response back to the client. Servers cannot make requests and clients cannot respond. All interactions are initiated by the client. Incoming requests and outgoing responses are JSON formatted. JSON data packages are easy to parse and easy to generate with programming languages. C# programming language, NET Framework, and NancyFX lightweight web framework [27] are preferred to develop the REST API Server.  
In order for Grasshopper3d to respond to incoming requests, the Rhino.Inside feature that comes with the 7 th version of the Rhino3d program has been extended. The Rhino.Inside is an open-source project that enables Rhino3d and Grasshopper3d programs to be used inside other programs running on the same computer such as Autodesk Revit, Autodesk AutoCAD, and Unity. The Rhino.Inside technology allows Rhino and Grasshopper to be embedded within other products. It may be possible starting Rhino  
Figure 4: Communication diagram between the parametric-modeling software, the mixed-reality device, and the industrial robot.  
and Grasshopper as an add-in another product, to call directly into the host's native APIs from a Grasshopper or Rhino plug-in, to access Rhino's APIs through the host application; grasshopper definitions can be opened and previewed in Rhino within the same process as the parent, and objects can be natively created by Rhino or Grasshopper within the parent product [28].  
In this study, primitive data types such as boolean, integer, double, string, and RhinoCommon SDK [29] data types including arc, box, circle, curve, line, mesh, mesh face, plane, point, rectangle, and vector were implemented and can be used as both input and output parameters for REST API Server communication requests and responses.  
REST API Server software can be accessed through different client devices including a web browser, a mobile device, or other software. Figure 5 shows a sample Grasshopper3d definition and the generated result with parameters and Figure 6 shows HTTP request input parameters and the calculated result as HTTP response output parameters. In Figure 6, while receiving the HTTP request and returning the HTTP response, Grasshopper3d program runs in headless mode in the background.