Free Support Forum - aspose.com

Is your solution support rendering of the STL, STEP and OBJ file on web browser

We would like to render STL, STEP and OBJ file on web browser, if all file format does not supported, we are ok to render STEP file.

As per our requirement, we would like to render max 1 GB of file on the browser in 3D view. Also, the demo site does not have smooth rotation, can increase the rotation of object smoothly?

@doshi.jay.tcs

Sorry for the delayed response.

There is no limitation in terms of file size while loading it via Aspose.3D. However, you can use a free 30-days temporary license in order to evaluate the API in its full capacity and without any restriction. Please feel free to let us know in case you face any issue.

Thank you for your reply Asad Ali.

Could you please share the sample code to load the STL file into the browser? I already download the sample code available on the GItHub however it is console based application without any proper guide about how to render the STL file on the page. It will be really helpful.

I tried this code sample however I don’t see STL file loaded on the page.

Thanks & Regards,
Jay

@doshi.jay.tcs

Could you please check the Demo provided over GitHub and let us know if it does not fulfil your requirements? We will further proceed to assist you accordingly.

Hi Asad,
Unfortunately, we are unable to run the project successfully. Below are the steps we did to run the project.

  1. Downloaded GitHub Project file from given link
  2. Register on ASPOSE site and got the Aspose.Total.Product.Family.lic file.
  3. Placed the license file to the\Demos\aspose3d\Aspose.App.Api\ location
  4. Renamed license file name in WebAPI project (aspose3d) at line number 128. (lic.SetLicense(“Aspose.Total.Product.Family.lic”))
  5. Run the WEB API project and it is running fine without any error.
  6. Then I run the Angular Frontend project (aspose3dweb).
  7. Frontend project also run successfully
  8. I am able to access the home page at http://localhost:4200/3d URL.
  9. Now the issue come into the picture. When I click on Aspos.3D viewer, I’m getting 404 Page not found at URL http://localhost/3d/viewer
    Capture.PNG (78.6 KB)

Please suggest how we can proceed further. It would be great if you can provide us running solution as we running out of time.

@doshi.jay.tcs

We are investigating the issue at our end and will get back to you soon.

@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));

        }