HOOPS Visualize Shell geometry accept not only triangle faces but also any planner faces specified by a PointArray. The following example shows you how to create H beam with a hole, that may be useful for AEC application.
Step 1 : Create a PointArray of H beam profile, and a Hole
float H = 100;
float B = 50;
float t1 = 5;
float t2 = 7;
float L = 500;
// Create H Profile with 12 Points x 2, 2 Holes with 32 Points x 2
PointArray pts(88);
pts[0] = Point(t1 / 2, H / 2 - t2, 0);
pts[1] = Point(B / 2, H / 2 - t2, 0);
pts[2] = Point(B / 2, H / 2, 0);
for (int i = 0; i < 3; i++)
{
pts[3 + i] = pts[2 - i]; pts[3 + i].x = -pts[2 - i].x;
pts[6 + i] = -pts[i];
pts[9 + i] = pts[2 - i]; pts[9 + i].y = -pts[2 - i].y;
}
for (int i = 0; i < 12; i++)
{
pts[i+12] = pts[i]; pts[i+12].z = L;
}
// Hole
Point Center = Point(t1/2, 0, 20);
Vector UDir = Vector(0, 1, 0);
Vector VDir = Vector(0, 0, 1);
float dRadius = 5;
double dCoordU;
double dCoordV;
double M_PI = 3.141592;
for (int i = 0; i < 32; i++)
{
dCoordU = dRadius * cos(M_PI / 2 * i / 8);
dCoordV = dRadius * sin(M_PI / 2 * i / 8);
pts[55-i] = Center + dCoordU * UDir + dCoordV * VDir;
pts[56+i] = pts[55-i]; pts[56+i].x = -pts[55-i].x;
}
Step 2 : Create a Facelist of H beam profile, a Hole, and side faces
// Create Face List : H Profile with 13 x 2, Holes with 33 x 2, Side Faces with 5 x 12
IntArray flist(152);
flist[0] = 12; flist[13] = 12;
for (int i = 0; i < 12; i++)
{
flist[i + 1] = i; flist[i + 14] = 23-i;
}
// Face1 with a Hole
flist[26] = 4;
flist[27] = 0;
flist[28] = 11;
flist[29] = 23;
flist[30] = 12;
// Hole1
flist[31] = -32;
int j = 24;
for (int i = 32; i < 64; i++)
{
flist[i] = j++;
}
// Face2 with a Hole
flist[64] = 4;
flist[65] = 6;
flist[66] = 5;
flist[67] = 17;
flist[68] = 18;
flist[69] = -32;
// Hole2
j = 56;
for (int i = 70; i < 102; i++)
{
flist[i] = j++;
}
// Side Faces without a Hole
j = 102;
for (int k = 0; k < 11; k++)
{
if (k == 5) continue;
flist[j++] = 4;
flist[j++] = k + 1;
flist[j++] = k;
flist[j++] = k + 12;
flist[j++] = k + 13;
}
Step 3 : Insert Shell. You can test the code in Sandbox
SegmentKey indicated_key = GetDocument()->GetModel().GetSegmentKey();
indicated_key.GetVisibilityControl().SetEdges(true);
indicated_key.InsertShell(pts, flist);
GetCanvas().GetFrontView().FitWorld();
GetCanvas().Update();