API: SUEntitiesFill() return error code when export skp

Hi Expert,
When I used the function “SUEntitiesFill()” of Sketchup API to export a skp file, it returned “SU_ERROR_INVALID_INPUT” . Then I checked the data of model, it seems that it’s ok. And, if I expert two surfaces independently, no error would happen. There is a picture of the model and the data of vertexes. Can you help me to find out the reason?
vetexes_output.txt (82.6 KB)


(Thank you @dezmo for reassigning to SDK subcategory.)

Is your application’s axes have Z pointing upwards ? If, not you would need to adjust the coordinate values as SketchUp’s Z_AXIS points up, X_AXIS points to the right, and Y_AXIS points away from the viewing plane.

Bear in mind that SketchUp was designed to model buildings. It has an internal tolerance of 0.001" between vertices. Some of your edge lengths may be quite small for Sketchup. (I calculated that the difference between 2 x values in the inner circle is only 0.00269".)
In cases like this, even when manually modeling in SketchUp, it is better to create the geometry at a larger scale within a component definition’s entities collection. Then afterward, place a scaled down instance of that definition into the model’s entities collection.

Yes I would think that these 2 separate surfaces should be added to an SUGeometryInput object in separate calls. One for the inner circular face, and another for the outer cylinder ring.

The documentation is a bit confusing about the SUEntitiesFill function. A note seems to indicate that there can be existing geometry in the entities collection object, but the parameter description says that the entities collection object must be empty.

That data is not easy to use (or read.)

If it were lines of comma separated values, it would be easier to use:

# face1
  index, x, y, z
  index, x, y, z
# face 2

Otherwise, you would need to post code for your SKP export in order for a C API guru to help see where the error lies.


1 Like

Thank you very much. I find it caused by tolerance.@DanRathbun

I find the problem has not been solved. I tried another model. The model has the same circular face. And distance between each two points in a triangle is more than 0.001, but it also returned “SU_ERROR_INVALID_INPUT”. There are a picture of model, vertexes data and sequence of API functions I called. The format of data has been optimized. Thank you.@DanRathbun
vertexes_data.txt (95.0 KB)
sequence of functons.pdf (71.8 KB)

Your table shows creating an inner loop. I do not see any inner loop in the above model.

In SketchUp the conical surface would be made up of multiple flat faces arranged around 2 arccurves. SketchUp is a surface modeler and so does not have true arcs or circles. Arcs and circles are made up of many straight segments. To get the “look” of a conical surface (like shown above) the axial edges would be smoothed and softened.

You are right. I find the problem caused by an empty inner loop which is putted in geometry input. Thank you for your help.

1 Like