Odd FBX issue causing Mesh to disappear - FBX ID associated with 2 objects

I am having a really difficult time trying to isolate this particular bug, where replacing a mesh results in the Mesh disappear from the node in the final output fbx file. The node will still exist, but have have no entities when viewed in Blender.

The pipeline I have sends each input fbx though a series of steps with parallelism, but each file goes through the same series of steps. I can isolate the step involved where the mesh goes missing, and this step replaces meshes when it detects a mesh with duplicates faces. The main part of the code looks like this:

foreach( Node node in originalMesh.ParentNodes.ToList() )
{
	node.Entities.Remove( originalMesh );
	node.Entities.Add( newMesh );
}

What it does: it creates a new mesh (before that snippet) where overlapping faces have been removed, and then replaces the original mesh with the new mesh. The result should be a reduction in face count and no observable changes in node hierarchy.

The input file and geometry look like this:
image.jpg (55.8 KB)

And the output looks like so:
image.jpg (156.4 KB)

Note in the above image the “Cell.018” has no mesh entity anymore. When you inspect the attached output ascii fbx you can find the associated node (Search for: de80c24a-12a9-131a-7cfe-9199589a61b9). You can see it still has the mesh attached:

Node is defined:

Model: 79000, "Model::Cell", "Mesh" {
	Version: 232
	Properties70:  {
		P: "ScalingMax", "Vector3D", "Vector", "",0,0,0
		P: "DefaultAttributeIndex", "int", "Integer", "",0
		P: "HierarchyIndex", "int", "Integer", "U",2352130
		P: "CadID", "KString", "", "U", "de80c24a-12a9-131a-7cfe-9199589a61b9"
	}
	Culling: "CullingOff"
}

Node has geometry associated:

;Geometry::, Model::Cell
	C: "OO",81300,79000

Geometry definitely exists:

Geometry: 81300, "Geometry::", "Mesh" {
		Vertices: *1365 {
			a: <removed for post>
		}
		PolygonVertexIndex: *1824 {
			a: <removed for post>
		}
		GeometryVersion: 100
		LayerElementNormal: 0 {
			Version: 100
			Name: ""
			MappingInformationType: "ByPolygonVertex"
			ReferenceInformationType: "Direct"
			Normals: *5472 {
				a: <removed for post>
			}
			NormalsW: *1824 {
				a: <removed for post>
			}
		}
		LayerElementUV: 0 {
			Version: 100
			Name: ""
			MappingInformationType: "ByPolygonVertex"
			ReferenceInformationType: "IndexToDirect"
			UV: *1244 {
				a: <removed for post>
			}
			UVIndex: *1824 {
				a: <removed for post>
			}
		}
		LayerElementMaterial: 0 {
			Version: 100
			Name: ""
			MappingInformationType: "ByPolygon"
			ReferenceInformationType: "IndexToDirect"
			Materials: *608 {
				a: <removed for post>
			}
		}
		Layer: 0 {
			Version: 100
			LayerElement:  {
				Type: "LayerElementNormal"
				TypedIndex: 0
			}
			LayerElement:  {
				Type: "LayerElementMaterial"
				TypedIndex: 0
			}
			LayerElement:  {
				Type: "LayerElementUV"
				TypedIndex: 0
			}
		}
	}

The result after running the pipeline is this mesh disappears when loaded in various viewers (autodesk fbx viewer, blender, windows 3d viewer).

The most confusing behaviour is later on when I run a separate pipeline that uses the above as input. When this file is encountered it is saved temporarily, and loaded later on (during a second pass) and the hierarchy has changed.

This bug does not happen when cutting down the number of input files.

Now that I have typed this and jotted down the ascii contents of the file I’ve noticed the FBX id 81300 is used for 2 different objects: our missing geometry, and a completely different node:

Model: 81300, "Model::Cell", "Mesh" {
		Version: 232
		Properties70:  {
			P: "ScalingMax", "Vector3D", "Vector", "",0,0,0
			P: "DefaultAttributeIndex", "int", "Integer", "",0
			P: "HierarchyIndex", "int", "Integer", "U",2353123
			P: "CadID", "KString", "", "U", "4960fc8b-ebc6-da7f-63f1-f026477271a4"
		}
		Culling: "CullingOff"
	}

As you can see above, we have 2 objects associated with 81300 which is causing the problems:

Geometry: 81300, “Geometry::”, “Mesh” {

Model: 81300, “Model::Cell”, “Mesh” {

See attached input and output:
FBX files.zip (1.9 MB)

As I mentioned, my scenario is repeatable but I cannot for the life of my isolate it. If i cut it down to running the same pipeline in a smaller set of files, or even the file in question, it does not occur. This issue is causing failures in other pipelines.

@bortos

In order to further investigate the issue, we have logged a ticket as THREEDNET-1018 in our issue tracking system. We will further analyze it and let you know as soon as we have some information regarding its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

@bortos

Please try the attached hotfix and let us know in case you face any other issues:

Aspose.3D-21.12.2.zip (8.2 MB)

The issues you have found earlier (filed as THREEDNET-1018) have been fixed in Aspose.3D for .NET 22.1.