Create Coplanar Faces by Vertex and Index Data from a .dae File using C API?

Hi, I’m trying to process dae file for creating mesh faces,
I’ve used SUFaceCreateSimple() to successfully create multiple faces into SketchUp,
but the SUModelMergeCoplanarFaces() dosen’t work on it,

so I was trying to use SUGeoemtryInputRef for creating faces
but I can’t figure out how to use InputAddVertex(), InputSetVertices() and SULoopInputAddVertexIndex().

can anyone help me correct my code, or help me with an example how it works

SUGeometryInputRef input1 = SU_INVALID;
SUGeometryInputCreate(&input1);

SULoopInputRef faceLoop1 = SU_INVALID;
SULoopInputCreate(&faceLoop1);


std::vector<int> arrIndex1 = { 0,5,6, 5,0,1, 3,6,2, 6,3,0, 4,1,7, 1,4,5, 7,2,6, 2,7,1 };

SUPoint3D arrVertex1[] =
{
    {-112.7238, -142.5420, 15.7480},
    {- 34.9911, -180.4548, 15.7480},
    {- 34.9911, -180.4548, 68.7336},
    {- 112.7238, -142.5420, 68.7336},
    {- 71.2711, -162.7598, 35.3998},
    {- 73.9692, -161.4438, 35.3998},
    {- 73.9692, -161.4438, 39.4024},
    {- 71.2711, -162.7598, 39.4024},
};


SUGeometryInputAddVertex(input1, arrVertex1);
SUGeometryInputSetVertices(input1, 8, arrVertex1);
    
for each(int index in arrIndex1) {
    SULoopInputAddVertexIndex(faceLoop1, index);
}

size_t index1 = 0;
SUGeometryInputAddFace(input1, &faceLoop1, &index1);
SUEntitiesFill(ent1, input1, true);


SUModelMergeCoplanarFaces(model1);

the final result should looks like below image:

and the .dae file is in the attachment,
wall_temp3.dae (5.8 KB)

thanks in advance :]

Finally figure it out with GPT’s help…
here is the code that works for creating coplanar mesh faces from vertex and index data:

// 1. Create GeometryInputRef & Add Vertex into It
SUGeometryInputRef input1 = SU_INVALID;
SUGeometryInputCreate(&input1);


std::vector<SUPoint3D> arrVertex1 =
{
    {-112.7238, -142.5420, 15.7480},
    {-34.9911, -180.4548, 15.7480},
    {-34.9911, -180.4548, 68.7336},
    {-112.7238, -142.5420, 68.7336},
    {-71.2711, -162.7598, 35.3998},
    {-73.9692, -161.4438, 35.3998},
    {-73.9692, -161.4438, 39.4024},
    {-71.2711, -162.7598, 39.4024},
};


for each (SUPoint3D vertex in arrVertex1) {
    SUGeometryInputAddVertex(input1, &vertex);
}


// 2. Create Array of Index of each Triangles & Iterate to Create LoopInput
std::vector<std::vector<int>> arrIndex1 = 
{ {0,5,6}, {5,0,1}, {3,6,2}, {6,3,0}, {4,1,7}, {1,4,5}, {7,2,6}, {2,7,1} };

for (const auto& triangle : arrIndex1)
{
    SULoopInputRef faceLoop1 = SU_INVALID;
    SULoopInputCreate(&faceLoop1);


    for (const auto& index : triangle)
    {
        SULoopInputAddVertexIndex(faceLoop1, index);
    }

    size_t index1 = 0;
    result1 = SUGeometryInputAddFace(input1, &faceLoop1, &index1);

}

// 3. Create Entities from Geometry Input
SUEntitiesRef ent1 = SU_INVALID;
SUModelGetEntities(model1, &ent1);

SUEntitiesFill(ent1, input1, true);
SUModelMergeCoplanarFaces(model1);