SUFaceCreateSimple failed with SU_ERROR_GENERIC (6)

Hi Experts,
I met face create failed with following data when using SUFaceCreateSimple:

{x=-0.15751288694035770 y=0.30000000000000049 z=0.0044427990697236000 }
{x=-0.16751288694035774 y=0.29732050807568927 z=0.0044427990697234005 }
{x=-0.16268926784240811 y=0.29931851652578190 z=0.0044427990697234005 }

res = SUFaceCreateSimple(&face, &vertices[0], vertices.size());

And I checked the description it tell that SU_ERROR_GENERIC means the vertices didn’t within the face’s tolerance 1.0e-3, while I am using only three points to create a triangle face and suppose every vertex should be on the face,
can you help take a check?


1 Like

That’s not the only source. The error says “generic” for a reason. It also return that error if the area of the face is not valid (too small).

Do you have a small standalone snippet that include how you create the vertices and face ref?

I have created a small app using my data.
Basing on my observation the data used for face creating when assert happen can create face successfully when only create the only face. while if given the whole dataset this specific data will fail. (1.9 MB)

Exported sketchup file, some faces are missing due to the creation failure:

Original model:

So the function fails when computing least square fit for the vertices. Looking at the data for the face that fails it appear some very small faces, the faces are nearly on top of each other. So it looks like the face is too small for the tolerance of SketchUp.

At least I think that’s why it’s failing.

If you scale up the data, does it work then?

scale up the data works. so I will leave this issue as it is.

Thank you,

If the face missing is caused by the tolerance of SketchUp, Can I know how much is the tolerance of the SketchUp?

Points closer than 1/1000th of an inch is considered to have equal position.

1 Like

Thank you. We will try to set the proper tolerance when write data into the SketchUp.

Hi tt_su, I want to know whether there is any C API to set the SketchUp model tolerance. It is better if there is such API.

I assume that 1/1000th of an inch is absolute tolerance in SketchUp, am I right?

Currently that is an absolute tolerance - SketchUp doesn’t have facilities to adjust the tolerances in models. (Which is a big issue for us as it makes it difficult to make small models with small details - as is often the case in 3d printing.)

There is no guaranty that this will stay like this forever though.

Hi tt_su, I run into the same problem of small faces lost in SketchUp. According to your explanation,

  1. SketchUp uses Inch as the modeling unit which is unchangeable.
  2. SketchUp uses 0.001 Inch as modeling tolerance which is unchangeable.
    The mesh data I have may contain small faces which edges are shorter than 0.001 inch, so when we create the SketchUp model based on the mesh data, the small faces will be lost when opening in SketchUp.
    But I am confused by the “fix” dialog popped up, the model seems worse with more faces lost when I click “fix” than “fix later”.

    So I have below questions:
  3. I wonder how SketchUp “fix” the model and why the “fix” introduce more holes?
  4. Do you have any suggestions on how to deal with the “small face” issue besides scale the mesh data?
  5. Is there a schedule for SketchUp to support the tighter tolerance e.g. 1e-6 inch for handling the design data for 3D Printing?


@syfmore - I take it you are using SUFaceCreateSimple? Recently we discovered that this function and SUFaceCreate doesn’t merge the face with the entities already in the model. This result in models where you have duplicate vertices and edges. Until we can address this I’d strongly urge you to use SUGeometryInput.

As for the faces being lost - if you managed to create small faces with the API and the Fix Model is run it might consider some of your faces to be degenerate (zero area for instance) and therefore remove it.

I’m afraid not.

I cannot provide a timeline for this. All I can say it’s that it’s a well known limitation that frustrates us as well.


What’s the tolerance value for the area?

Not sure, I’d have to dig into the source. (Not at my work computer right now.)
But I’d avoid SUFaceCreateSimple since it doesn’t merge entities as a proper SketchUp model should.

Sure, but I guess SUEntitiesFill has the same area tolerance?

I would think so, but in that cause I think it silently skip those faces… No way to report errors on individual polygon via that function.

So, same question: what’s the value for the area tolerance?
We can check before calling SUEntitiesFill, but we need to know the value.

I dug into the source. There is a check that gets the signed area of the face loop - it then checks this against 0 with a tolerance of the square of our point tolerance.

double EqualTol = 1.0e-3; // Used for Point3d/Vector3d tolerance etc
double EqualTolSq = EqualTol * EqualTol; // Used for checking the tolerance of the face area.
1 Like

Thank you!