## 4 Parametric Design Automation
### Automating Minimum Protruding Connector Arm
To minimize the time required for Boolean operations, the profile is assumed as a minimum bounding box of the profile with respect to the profile plane. The larger of the height values obtained from the bounding boxes for each of the left and right profiles is taken and designated as the minimum arm length. Listing 2 shows Rhino C# script to replicate the process of Figure 16 to figure out the minimum arm length. Each profile's center line offsets from the panel edge in a different direction and distance, which causes them to fall apart from the common node point. However, the displacement distance of the center axes is mostly influenced by the dihedral angle; therefore, as long as the dihedral angle is maintained close to 180 degrees, the deviation due to the dihedral angle is kept minimal. Utilizing this characteristic, the approximated minimum arm length can be determined, assuming that the two center axes are on the same plane. The value obtained here approaches the actual optimum as the displacement distance between the two center axes approaches zero and increases as they move farther apart. The neighboring two profile center lines do not have matching ends. Therefore, calibration of the starting point is needed to align the starting points as closely as possible. Let each of the profile center lines, \(L_{1}\) and \(L_{2}\), be defined as follows:  
Figure 16: Minimum arm length using volumetric Boolean shape. \[L_{1}(d_{1})=P_{1}+d_{1}V_{1},\quad L_{2}(d_{2})=P_{2}+d_{2}V_{2}\quad(\|V_{1}\|= \|V_{2}\|=1) \tag{13}\]  
where \(d_{1}\) and \(d_{2}\) are the distance from \(P_{1}\) and \(P_{2}\); \(V_{1}\) and \(V_{2}\) are the trajectories of \(L_{1}\) and \(L_{2}\); \(P_{1}\) and \(P_{2}\) are the position vectors of the starting point of \(L_{1}\) and \(L_{2}\). The directional vector \(V_{s}\) of the line \(L_{s}\) connecting points on \(L_{1}\) and \(L_{2}\) is given by:  
\[V_{s}=L_{2}(d_{2})-L_{1}(d_{1}) \tag{14}\]  
Since the shortest length between \(L_{1}\) and \(L_{2}\) is simultaneously perpendicular to both \(L_{1}\) and \(L_{2}\), it follows that:  
\[(L_{2}(d_{2})-L_{1}(d_{1}))\cdot V_{1}=0 \tag{15}\]  
\[(L_{2}(d_{2})-L_{1}(d_{1}))\cdot V_{2}=0 \tag{16}\]  
Using linear Equations (15) and (16), we can calculate \(d_{1}\) and \(d_{2}\). The closest points calculated here are the minimum distance between the profile center lines, and profiles with cross-sectional shapes require a greater clearance distance to avoid interference. From the above, the new straight lines \(L_{a}(d_{\text{ext}})\) and \(L_{b}(d_{\text{ext}})\) whose starting points are \(L_{1}(d_{1})\) and \(L_{2}(d_{2})\), respectively, are defined as follows:  
\[L_{a}(d_{\text{ext}})=L_{1}(d_{1})+d_{\text{ext}}V_{1} \tag{17}\]  
\[L_{b}(d_{\text{ext}})=L_{2}(d_{2})+d_{\text{ext}}V_{2} \tag{18}\]  
The angle \(\theta\) formed by the two straight lines is calculated as follows:  
\[\theta=\arccos(V_{1}\cdot V_{2})\quad(\|V_{1}\|=\|V_{2}\|=1) \tag{19}\]  
The extension distance \(d_{\text{ext}}\) has the following relationship with the clearance radius \(r\) of the profile:  
\[d_{\text{ext}}=\frac{r}{\tan\Bigl{(}\frac{\theta}{2}\Bigr{)}}=\frac{r}{\tan \Bigl{(}\frac{\arccos(V_{1}\cdot V_{2})}{2}\Bigr{)}} \tag{20}\]  
Therefore, the optimal arm lengths \(D_{1}\) and \(D_{2}\) are defined as follows:  
Figure 16:0  
Listing 3 calculates the closest points between two lines, lineA (\(L_{1}\)) and lineB (\(L_{2}\)), which are not necessarily coplanar. The function takes two lines, lineA (\(L_{1}\)) and lineB (\(L_{2}\)), a clearance radius \(r\), and outputs the points \(A\) and \(B\) located on each line, respectively, adjusted for a specified arm extension. This method has the advantage of fast computation, but it has two flaws. First, as the proximity between the two profile center lines increases, the extension length calculated here starts to exceed the optimal length.