Skip to main content
Introduction Created Edited

Connect API

Download File

 

0.Introduction

Learn how to connect CIVIL NX and MIDAS GH via API to use MIDAS GH effectively.

 

a. Contents

1. API Connection

1-1 Grasshopper Midas Setting Component Execution

1-2 CIVIL NX API Setting Execution

1-3 Input Base URL & MAPI-Key

2. Component Execution

2-1 Create Beam Component

2-2 Input Data

2-3 Run Component

 

b. Result Preview

 

c. Component Flow

Fig 1. Result Preview

 

1. API Connection

To use MIDAS GH, you must first establish a connection with CIVIL NX.

1-1 Execute the Grasshopper API Connection Component

1. In Grasshopper, navigate to:
① [Midas] > ② [Tools] > ③ "Midas Setting" component, and execute it.

2. Double-click the ④ icon in the "Midas Setting" component to open the "Midas Setting" window.

Fig 1. Grasshopper Setting Component

 

1-2 CIVIL NX API Setting

1. In CIVIL NX, navigate to:
[Apps] tab > [API] group > Midas Settings, and execute it.

Fig 2. CIVIL NX API Setting

 

1-3 API Connection

1. In CIVIL NX, click the "Copy" button for ⓐ Base URL.

2. Paste the copied value into ① Base URL in Grasshopper.

3. In CIVIL NX, click the "Copy" button for ⓐ MAPI-Key.

4. Paste the copied value into ① MAPI-Key in Grasshopper.

5. In CIVIL NX, click the ⓒ "Connect" button.

6. In Grasshopper, click the ③ "OK" button.

Fig 3. API Connection
Tips

Once connected, the Midas Setting in Grasshopper retains the settings information. It only needs to be updated if the MAPI-Key changes.

 

2. Component Execution

Once the connection is complete, let's verify the connection by creating an element in CIVIL NX.

MIDAS GH, like CIVIL NX, supports one-dimensional elements such as "Beam", two-dimensional elements such as "Plate", and three-dimensional elements such as "Solid". Among these, we will start by creating the simplest element, the "Beam".

 

2-1 Create Component

1. In Grasshopper, navigate to:
① [Midas] > ② [Node/Element] > ③ "Beam", and execute the component.

Fig 4. Create Beam Component

 

2-2 Input Data

1. Create a ① "Line" component in Grasshopper.

2. Right-click on the icon of the "Line" component and select ② "Set One Line".

3. In Rhino, specify the ③ "Start Point" and ④ "End Point" to create the line.

4. Connect the ① "Line" component to the ⑤ "Line" input slot of the "Beam" component.

Fig 5. Create Line Object in Rhino

 

2-3 Run Component

1. Execute the ① "Run" button on the "Beam" component.

2. Verify that ② "Node" and ③ "Element" are created in CIVIL NX.

Fig 6. Run Component
Note

The component functions even with the minimum required input values. However, data must be provided for the API to function if there are no default values specified in the manual.

0
Was this article helpful?