# Assertion failed: SUEntitiesFill(entities, geom\_input, 1)==SU\_ERROR\_NONE

**URL:** <https://forums.sketchup.com/t/assertion-failed-suentitiesfill-entities-geom-input-1-su-error-none/244890>\
**Category:** SketchUp SDK\
**Tags:** c\
**Created:** [October 15, 2023, 6:20pm UTC](https://forums.sketchup.com/t/assertion-failed-suentitiesfill-entities-geom-input-1-su-error-none/244890 "2023-10-15T18:20:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sasho648](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@sasho648](https://forums.sketchup.com/u/sasho648)\
**Post date:** [October 15, 2023, 6:20pm UTC](https://forums.sketchup.com/t/assertion-failed-suentitiesfill-entities-geom-input-1-su-error-none/244890/1 "2023-10-15T18:20:21Z")

</div>

I love the descriptive error of:

SU\_ERROR\_INVALID\_INPUT

It helps very much. (This is assertion but nonetheless I checked the return value separately.)

Irony aside it’s a general trend I don’t like of having errors information being error. Unless I’m missing something and I can get actual description of why can’t I add my face.

I’m adding my indices and checking all return value - why it would crash when faces are added (pardon the obfuscated syntax):

```
       b(SULoopInputCreate, &loop_input);
       for (signed long z = i[groupData(*currentMesh)].StartIndex, count = 0;
           amountfaces < i[groupData(*currentMesh)].NumFaces;) {
           unsigned long currentindex = getindex(z);
           assert(currentindex < currentMesh->AmountVertices),
           printf("%d\n", currentindex),
           (count)[mat_input.vertex_indices] = currentindex,
           (count)[mat_input.uv_coords].x = currentindex[currentMesh->vertexData].U,
           (count)[mat_input.uv_coords].y = currentindex[currentMesh->vertexData].V;
           count += 1;
           z += 1;
           if (count >= 3) {
               size_t face_index;

               b(SUGeometryInputAddFace, geom_input, &loop_input, &face_index);

               b(SUMaterialSetOpacity, mat_input.material, 1.0);

               b(SUGeometryInputFaceSetFrontMaterial, geom_input, face_index, &mat_input);

               b(SUMaterialSetOpacity, mat_input.material, 0.1);

               b(SUGeometryInputFaceSetBackMaterial, geom_input, face_index, &mat_input);

               b(SULoopInputCreate, &loop_input);
               count = 0;
               amountfaces += 1;
               //amountfaces = face_index;
           }
           if (getindex(z - 1) == getindex(z) && getindex(z + 1) == getindex(z + 2)) {
               loop_input = (SULoopInputRef){ SU_INVALID };
               b(SULoopInputCreate, &loop_input);
               count = 0;
               amountfaces += 1;
               z += 3;
           }
           
       }
   }

   //++amountfaces;
   b(SUEntitiesFill, entities, geom_input, true);

```

It’s a triangle strip I’m adding the same as [Triangle Strips - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/direct3d9/triangle-strips)

And also thanks for your time because it’s not your entitlement to help and also I think there is improvement in the SDK since last time I used it. However I do remember having the same issue.

---

<div class="post-metadata">

**Author:** ![sasho648](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@sasho648](https://forums.sketchup.com/u/sasho648)\
**Post date:** [October 19, 2023, 5:33pm UTC](https://forums.sketchup.com/t/assertion-failed-suentitiesfill-entities-geom-input-1-su-error-none/244890/2 "2023-10-19T17:33:05Z")

</div>

Point is that SUGeometryInputAddFace and the previous calls to SULoopInputAddVertexIndex succee

but at the end when filling with the SUGeometryInputRef entities it fails with that cryptic nonsensical error.

---

<div class="post-metadata">

**Author:** ![sasho648](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@sasho648](https://forums.sketchup.com/u/sasho648)\
**Post date:** [October 19, 2023, 5:36pm UTC](https://forums.sketchup.com/t/assertion-failed-suentitiesfill-entities-geom-input-1-su-error-none/244890/3 "2023-10-19T17:36:10Z")

</div>

It might be duplicate indices but then why SULoopInputAddVertexIndex allow like 2 duplicates and after that it fails - why not fail at the first duplicate.
