@doshi.jay.tcs
By navigating to the http://localhost:4200/3d/viewer
, we able to successfully open the page. However, there is also limitation of uploading 100MB of file to view in 3D viewer. We increase that limit from the code and try again to upload it however large file never loaded to the viewer.
It would be great if you can provide us sample code where we can just upload STL file upto 1GB of size and it extract the height, weight, depth and volumn of the object. If you have any documentation which shows how to get model details you can share it with us.
There is a maximumSize
in Demos/aspose3dweb/src/app/pages/threed/repairing/repairing.component.ts to limit its maximum upload size in front-end. And MaximumInputSize
in Demos/aspose3d/Aspose.App.Api/Controllers/AsposeAppControllerBase.cs to limit maximum upload size in back-end.
Please also check the below code snippet. This sample code calculates the size and volume of mesh.
public static double SignedVolumeOfTriangle(Vector4 p1, Vector4 p2, Vector4 p3) {
var v321 = p3.x*p2.y*p1.z;
var v231 = p2.x*p3.y*p1.z;
var v312 = p3.x*p1.y*p2.z;
var v132 = p1.x*p3.y*p2.z;
var v213 = p2.x*p1.y*p3.z;
var v123 = p1.x*p2.y*p3.z;
return (1.0/6.0)*(-v321 + v231 + v312 - v132 - v213 + v123);
}
public static double VolumeOfMesh(Mesh mesh)
{
double volume = 0;
//here assume the mesh is a triangle mesh, which means mesh.TriMesh = true
//Algorithm details: http://chenlab.ece.cornell.edu/Publication/Cha/icip01_Cha.pdf
foreach(var triangle in mesh.Polygons)
{
var p1 = mesh.ControlPoints[triangle[0]];
var p2 = mesh.ControlPoints[triangle[1]];
var p3 = mesh.ControlPoints[triangle[2]];
volume += SignedVolumeOfTriangle(p1, p2, p3);
}
return Math.Abs(volume);
}
static void SizeVolume()
{
var fileName = @"test.stl";
var scene = new Scene(fileName);
var bbox = scene.RootNode.GetBoundingBox();
var size = bbox.Maximum - bbox.Minimum;
var mesh = (Mesh)scene.RootNode.ChildNodes[0].Entity;
Console.WriteLine("The size of the STL model is: {0}x{1}x{2}", size.x, size.y, size.z);
Console.WriteLine("The volume of the mesh is {0}", VolumeOfMesh(mesh));
}