Howdy
I’m having issues when exporting a very large file, but I’ve managed to isolate the issue down to meshes with high polygon counts.
The exception:
2018-08-17 21:30:49.6381|ERROR|Test|Failed to save node 'Geometry': Aspose.ThreeD.ExportException: Number was less than the array's lower bound in the first dimension.
Parameter name: srcIndex
at #=zhSGb18RrQi0xBUWZTQScRxQ=.#=zJH0K46k=(Scene #=z7C$euX4=, Stream #=zFtPfj8M=, SaveOptions #=zFvX3Vas=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z3jJCwj$o3dYnxQH4WMV24SA$aqVtVuflSQ==(Object #=z58CnMio=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z1t_Wlk$y6FZFfDifzFvMP5Y=(MethodBase #=z58CnMio=, Boolean #=zqi56DD0=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z9hDHDoTYkn9YxgqBr5RMnr4=(#=qKREEL8hVRdNFOstkkWXSNiaEDE88GJfsrQaqLRMMdig= #=z58CnMio=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zwjaK41qsHOraDJEDggZ2DjS_BnxyyvfthQo5Or4=()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zlKOxbD7DVrgmBTj51IYNN03H9aYo()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z3jJCwj$o3dYnxQH4WMV24SA$aqVtVuflSQ==(Object #=z58CnMio=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z65hgMb7OLIG2DxMK1B3lrDvc8wkS()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zUtV_O5QJ61arRhNw6Q==(Object #=z58CnMio=, UInt32 #=zqi56DD0=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zlKOxbD7DVrgmBTj51IYNN03H9aYo()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zyYQhX4kTPVfCJFWcaPk5BGA=()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zODWvBKCQd6aUeRIahsgiXlw0Au$dV1kCWg==()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z3jJCwj$o3dYnxQH4WMV24SA$aqVtVuflSQ==(Object #=z58CnMio=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z65hgMb7OLIG2DxMK1B3lrDvc8wkS()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zUtV_O5QJ61arRhNw6Q==(Object #=z58CnMio=, UInt32 #=zqi56DD0=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zODWvBKCQd6aUeRIahsgiXlw0Au$dV1kCWg==()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zCecNVzmq8c$TuGrM_bKr8rE=(Object[] #=z58CnMio=, Type[] #=zqi56DD0=, Type[] #=zFksfYX4=, Object[] #=zBI8c404=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zdc_mSNdKxsUBIfmcC11z9owYmOyUCO4XSrVjGp8kv$qr(Stream #=z58CnMio=, Int32 #=zqi56DD0=, Object[] #=zFksfYX4=, Type[] #=zBI8c404=, Type[] #=zewOm2zI=, Object[] #=zHf_JWLM=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zP583$I41WyBgDun24nPq8rDXxFzxIjg_Hw==(Int32 #=z58CnMio=, Type[] #=zqi56DD0=, Type[] #=zFksfYX4=, Boolean #=zBI8c404=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zVPlt1MveK1DYg8aRCkrIfqOVnRO2(#=qKREEL8hVRdNFOstkkWXSNiaEDE88GJfsrQaqLRMMdig= #=z58CnMio=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zwjaK41qsHOraDJEDggZ2DjS_BnxyyvfthQo5Or4=()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zlKOxbD7DVrgmBTj51IYNN03H9aYo()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z3jJCwj$o3dYnxQH4WMV24SA$aqVtVuflSQ==(Object #=z58CnMio=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z65hgMb7OLIG2DxMK1B3lrDvc8wkS()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zUtV_O5QJ61arRhNw6Q==(Object #=z58CnMio=, UInt32 #=zqi56DD0=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zlKOxbD7DVrgmBTj51IYNN03H9aYo()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zyYQhX4kTPVfCJFWcaPk5BGA=()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zODWvBKCQd6aUeRIahsgiXlw0Au$dV1kCWg==()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z3jJCwj$o3dYnxQH4WMV24SA$aqVtVuflSQ==(Object #=z58CnMio=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z65hgMb7OLIG2DxMK1B3lrDvc8wkS()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zUtV_O5QJ61arRhNw6Q==(Object #=z58CnMio=, UInt32 #=zqi56DD0=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zODWvBKCQd6aUeRIahsgiXlw0Au$dV1kCWg==()
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zCecNVzmq8c$TuGrM_bKr8rE=(Object[] #=z58CnMio=, Type[] #=zqi56DD0=, Type[] #=zFksfYX4=, Object[] #=zBI8c404=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=z_fCIO$UX1XaylXf1FQ==(Stream #=z58CnMio=, String #=zqi56DD0=, Object[] #=zFksfYX4=, Type[] #=zBI8c404=, Type[] #=zewOm2zI=, Object[] #=zHf_JWLM=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zrvLnd0_z7BTp8O7nSAHcOahYuYawlusIS_UsEEY=(Stream #=z58CnMio=, String #=zqi56DD0=, Object[] #=zFksfYX4=)
at #=q1PMX6nTN9sp5luKCbsZbQs5chh0EZOKxgVf6xpXr$h8=.#=zjrcMc0$LyfHsMdVcUKH$Z3u8fzyFbNeHNlnv$Uw=(Stream #=z58CnMio=, String #=zqi56DD0=, Object[] #=zFksfYX4=)
at Aspose.ThreeD.Scene.Save(Stream stream, FileFormat format)
Code to reproduce:
private void ExportExceptionChecker()
{
void TestExport( int targetPolyCount)
{
Scene scene = new Scene();
scene.Name = "Freddy";
Mesh mesh = new Mesh();
for( int i = 0; i < targetPolyCount; i++ )
{
Vector3[] points = new Vector3[3];
int[] tri = new int[3];
double angle1 = (double) i / targetPolyCount * 360;
double angle2 = (double) ( i + 1 ) / targetPolyCount * 360;
points[0] = Vector3.Origin;
points[1] = Quaternion.FromEulerAngle( 0, angle1, 0 ) * Vector3.ZAxis * 100;
points[2] = Quaternion.FromEulerAngle( 0, angle2, 0 ) * Vector3.ZAxis * 100;
mesh.ControlPoints.Add( new Vector4( points[0] ) );
mesh.ControlPoints.Add( new Vector4( points[1] ) );
mesh.ControlPoints.Add( new Vector4( points[2] ) );
tri[0] = mesh.ControlPoints.Count - 3;
tri[1] = mesh.ControlPoints.Count - 2;
tri[2] = mesh.ControlPoints.Count - 1;
mesh.CreatePolygon( tri );
}
var testNode = scene.RootNode.CreateChildNode( "Test" );
testNode.AddEntity( mesh );
try
{
using ( var ms = new MemoryStream() )
scene.Save( ms, FileFormat.FBX7500Binary );
Debug.WriteLine("Success with " + mesh.PolygonCount + " polygons");
}
catch ( Exception exception )
{
Debug.WriteLine( "Failed to save " + testNode.Name + ". Poly size: " + mesh.PolygonCount + ": " + exception.Message );
}
}
for( int i = 600_000; i < 1_000_000; i += 10_000 )
{
TestExport( i );
}
}
Code output:
Success with 600000 polygons
Success with 610000 polygons
Success with 620000 polygons
Success with 630000 polygons
Success with 640000 polygons
Success with 650000 polygons
Success with 660000 polygons
Success with 670000 polygons
Success with 680000 polygons
Success with 690000 polygons
Exception thrown: 'Aspose.ThreeD.ExportException' in Aspose.3D.dll
Failed to save Test. Poly size: 700000: Number was less than the array's lower bound in the first dimension.
Parameter name: srcIndex
Exception thrown: 'Aspose.ThreeD.ExportException' in Aspose.3D.dll
Failed to save Test. Poly size: 710000: Number was less than the array's lower bound in the first dimension.
Parameter name: srcIndex
Exception thrown: 'Aspose.ThreeD.ExportException' in Aspose.3D.dll
Failed to save Test. Poly size: 720000: Number was less than the array's lower bound in the first dimension.
Parameter name: srcIndex
Exception thrown: 'Aspose.ThreeD.ExportException' in Aspose.3D.dll
Failed to save Test. Poly size: 730000: Number was less than the array's lower bound in the first dimension.
ect…