Issue when creating a SKP model from tesselated representation


I would like to create a SKP file from a tesselated representation (list of triangles). Here is the methodology I use :

  • Initialize the API
  • Create a SUModelRef
  • Get SUEntitiesRef from the model created
  • Create a SUGeometryInputRef
  • Add all SUPoint3D to SUGeometryInputRef
  • Create faces from SUPoint3D and add them to the SUGeometryInputRef
  • Create entities from SUGeometryInputRef using SUEntitiesFill
  • Clean coedges to have smoth faces
  • Save the model to output file
  • Release the model.

The code compiles and works but the model I am getting in SKP make is a surface whereas I would like to have a solid group

Below is an illustration, left is what I expect, right is what I get.

What I is wrong in my methodology ? Thanks for your help.

Here is the code sample to create the grey cube.

code example.txt (7.7 KB)

You are creating a model and adding entities directly to the model root and saving it. You then open it and that is what you see on your right there.

Model > Faces

On my example which you have on your left - I created a group in that model.

Model > Group > Faces

This is why you only see faces when you open the SKP - because that’s how you created it.

Note that if you imported your SKP it would be inserted as a component into your currently open model - then it’d look like this:

Model > ComponentInstance > Faces

In the other thread you mentioned you wanted a locked group - but in the snippet you posted you create no group.

Entity Info will only say “solid” when you have a group or component which is manifold selected. If you open the instance and select it’s faces it will not say that. However - not that it’s still a manifold and still a “solid”. As long as your mesh has edges connected to exactly two faces you have a solid.

Thanks for your answer.

So I have tried to create a group and assigned it to the entities object :

//Create group name
SUGroupRef mGroup = SU_INVALID;
SUGroupCreate( &mGroup );
SUGroupSetName( mGroup, “TEST GROUP NAME” );
SUEntitiesAddGroup(entities, mGroup);

The model created was then open in SKP using File -> Open --> SUCubeCreation.skp. However I still get Entity as a surface when I select the cube.

Is it the right way to create the Model > Group > Faces structure?

code sample.txt (7.9 KB)

Ok I have undersood my mistake, I am not using the right entities in my code.

I have used the ‘root’ entities of the model not the one of the group name I have created.

I have made the changes in my code and it works better now.

1 Like