# Holes In Meshes

Hey,

Is it possible to define a mesh with a hole in it?
E.g I create cube1 and cube2, where cube2 is a hole in cube1

I was thinking it might be possible with VertexElementHole, but I could not get it right…

@Hue404

Would you please share a sample code snippet that you are already using to create cubes? We will further proceed to assist you accordingly.

I am using the code from your github:

``````    public static Mesh createMeshUsingCreatePolygons()
{
// ExStart:CreateMeshUsingCreatePolygons
List<Vector4> controlPoints = defineControlPoints();

// Initialize mesh object
Mesh mesh = new Mesh();
// Add control points to the mesh
// Create polygons to mesh
// Front face (Z+)
mesh.createPolygon(new int[] { 0, 1, 2, 3 });
// Right side (X+)
mesh.createPolygon(new int[] { 1, 5, 6, 2 });
// Back face (Z-)
mesh.createPolygon(new int[] { 5, 4, 7, 6 });
// Left side (X-)
mesh.createPolygon(new int[] { 4, 0, 3, 7 });
// Bottom face (Y-)
mesh.createPolygon(new int[] { 0, 4, 5, 1 });
// Top face (Y+)
mesh.createPolygon(new int[] { 3, 2, 6, 7 });
// ExEnd:CreateMeshUsingCreatePolygons
return mesh;
}

private static List<Vector4> defineControlPoints()
{
// ExStart:DefineControlPoints
// Initialize control points
List<Vector4> controlPoints = new ArrayList<Vector4>();

//Vector4List controlPoints = new Vector4List(8);
controlPoints.add(new Vector4( -5.0, 0.0, 5.0, 1.0));
controlPoints.add(new Vector4( 5.0, 0.0, 5.0, 1.0));
controlPoints.add(new Vector4( 5.0, 10.0, 5.0, 1.0));
controlPoints.add(new Vector4( -5.0, 10.0, 5.0, 1.0));
controlPoints.add(new Vector4( -5.0, 0.0, -5.0, 1.0));
controlPoints.add(new Vector4( 5.0, 0.0, -5.0, 1.0));
controlPoints.add(new Vector4( 5.0, 10.0, -5.0, 1.0));
controlPoints.add(new Vector4( -5.0, 10.0, -5.0, 1.0));
// ExEnd:DefineControlPoints
return controlPoints;
}
``````

@Hue404

Only the FBX import and export the hole data, the other format will ignore this. That means it is not working in other formats. We added a feature request as THREEDNET-1218 in our issue tracking system. As soon as it is resolved, all formats will have support for it and we will inform you in this forum thread as well. Please spare us some time.

thanks for the info, but I actually need it as a fbx file, but I still have no clue how to do this…

@Hue404

Your feedback has been recorded under the ticket. We will be sharing updates with you as soon as it is resolved. Please spare us little time.

You mentioned that only FBX import the hole data, so this should already be working if I understand you correctly.
Can you please show me an example?

@Hue404

The Aspose.3D now can import FBX files with VertexElementHole and export it successfully, due to lack of sample files, VertexElementHole was not tested before.

This class is actually the porting version of FbxGeometryElementHole to define the hole data, after investigation of Autodesk FBX SDK’s behavior, this does not affect the mesh triangulation and appearance in Autodesk FBX SDK, the old implementation of Aspose.3D may throw exception when import and export FBX files with hole data.

Nevertheless, we are further trying to add an example in the documentation and it would be a boolean operation. We will get back to you soon on it.