1. Products
  2.   3D
  3.   Java
  4.   Aspose.3D for Java

Aspose.3D for Java

 
 

Java API to Generate & Convert 3D Diagrams

A useful Computer-Aided-Designing (CAD) API that enables software developers to create, manipulate, and export 3D files in a variety of formats.

What is iGeo Aspose.3D for Java?

A robust and user-friendly library for processing 3D file formats, Aspose.3D for Java enables programmers to create, edit, load, manipulate, and save 3D files without the need to install any 3D modeling or rendering tools. Software programmers may generate, edit, and convert 3D models in a number of different formats, such as STL, OBJ, FBX, DAE, glTF, DRC, AMF, PLY, 3DS, and many more, with ease thanks to this library. Additionally, the library allows the import of 3D models from many sources, including CAD applications, and then makes the necessary modifications.

Software developers can construct scenes from scratch with Aspose.3D for Java without relying on any third-party modeling tools. Creating 3D documents from scratch, reading 3D documents, detecting 3D file formats, converting 3D scenes to HTML, exporting scenes to compressed AMF format, converting Non-PBR to PBR materials, sharing mesh geometry data among multiple nodes, adding animation properties to the scene file, splitting meshes by material, working with geometry and scene hierarchy, and many other features are all part of the library for handling 3D documents.

In addition to tools for dealing with big or complex 3D models, Aspose.3D for Java provides highly helpful capabilities for working with 3D models, including 3D mesh optimization, file reduction, and file conversion. Along with full support for 3D graphics rendering, the library contains several strong rendering features, including as lighting effects, texture mapping, and shading, that let developers produce 3D graphics of superior quality. It assists developers in producing lifelike 3D models that may be utilized in a wide range of applications, including engineering simulations, video games, and architectural design.

Previous Next

Getting Started with Aspose.3D for Java

The recommend way to install Aspose.3D for Java is using NuGet. Please use the following command for a smooth installation.

 //First, you need to specify the Aspose Maven Repository configuration/location in your Maven pom.xml as follows:

<repositories>
	<repository>
	<id>AsposeJavaAPI</id>
	<name>Aspose Java API</name>
	<url>https://releases.aspose.com/java/repo/</url>
	</repository>
</repositories>

//Define Aspose.PDF for Java API Dependency

<dependencies>
	<dependency>
	<groupId>com.aspose</groupId>
	<artifactId>aspose-3d;/artifactId>
	<version>21.4</version>
    </dependency>
</dependencies>
You can also download it directly from Aspose product page.

3D File Format Conversion via Java API

Aspose.3D for Java gives software developers the power to inter-convert 3D file formats inside their own Java applications without any external dependencies or installing any 3rd party 3D modeling or rendering software. The library has included support for saving documents to various 3D file formats, such as 3DS, 3MF, DAE, DFX, gITF, Collada, glTF, GLB, Draco, RVM, U3D and many more. The library also supports 3D scene conversion to PDF, HTML and more.

How to Save a 3D Scene as HTML via Java API?

Scene scene = new Scene();
// Initialize a node
Node node = scene.getRootNode().createChildNode(new Cylinder());
// Set child node properites
LambertMaterial mat = new LambertMaterial();
mat.setDiffuseColor(new Vector3(0.34,0.59, 0.41));
node.setMaterial(mat);
Light light = new Light();
light.setLightType(LightType.POINT);
scene.getRootNode().createChildNode(light).getTransform().setTranslation(10, 0, 10);
// Initialize HTML5SaveOptions
HTML5SaveOptions opt = new HTML5SaveOptions();
// Turn off the grid
opt.setShowGrid(false);
//Turn off the user interface
opt.setShowUI(false);
scene.save(RunExamples.getDataDir() + "html5SaveOption.html", FileFormat.HTML5);

Create 3D Scene via Java API

Aspose.3D for Java has included functionality for creating and handling 3D Scene inside their own Java applications. The library allows saving 3D Scenes in numerous supported file formats such as STL, FBX, Discreet3DS, WavefrontOBJ, Collada, Universal3D, and many more. The library supports several important features for working with 3D scene, such as create empty 3D Scene, load existing 3D Scene, export 3D scenes to other support file format, save 3D scene as HTML, load existing properties, modify existing properties, and many more.

How to Create an Empty 3D Scene via Java API?

// The path to the documents directory.
String MyDir = RunExamples.getDataDir();
MyDir = MyDir + "document.fbx";
// Create an object of the Scene class
Scene scene = new Scene();
// Save 3D scene document
scene.save(MyDir, FileFormat.FBX7500ASCII);

Working with 3D Mesh in Java Apps

Aspose.3D is a Java API that allows software developers to work with 3D models in a variety of formats, including OBJ, STL, and FBX. The library allows the creation of cylinders with just a couple of lines of Java code. Users can add a material to the cylinder; you can use the setMaterial method, which is part of the Mesh class. The library allows developers to export the cylinder to a different file formats such as OBJ, STL, FBX and many more. The following example shows how to export the cylinder to an OBJ file with ease.

How to Triangulate Mesh via Java API?

// The path to the documents directory.
String MyDir = RunExamples.getDataDir();
// Initialize scene object
Scene scene = new Scene();
scene.open(MyDir + "document.fbx");
scene.getRootNode().accept(new NodeVisitor() {
@Override
public boolean call(Node node) {
Mesh mesh = (Mesh)node.getEntity();
if (mesh != null)
{
// Triangulate the mesh
Mesh newMesh = PolygonModifier.triangulate(mesh);
// Replace the old mesh
node.setEntity(newMesh);
}
return true;
}
});
MyDir = MyDir + RunExamples.getOutputFilePath("document.fbx");
scene.save(MyDir, FileFormat.FBX7400ASCII);

Create & Manage Cylinders via Java API

Aspose.3D for Java allows software developers to working with Visio in different ways inside Visio Diagrams using .NET library. The C# library has include different features for handling text in shapes, such as inserting text shape, customize text shape in the Visio diagram, update the shape’s text, find and replace the shape’s text, apply Built-in or custom style-sheet to text, apply different style on the each text value of a shape, extract plain Text from the Visio diagram page and many more.

How to Export the Cylinder to OBJ File via Java API?

import com.aspose.threed.*;

Cylinder cylinder = new Cylinder();
cylinder.setHeight(5);
cylinder.setRadius(2);

Material material = new Material();
material.setAmbientColor(Color.fromArgb(255, 0, 0));
material.setDiffuseColor(Color.fromArgb(255, 0, 0));
material.setSpecularColor(Color.fromArgb(255, 255, 255));
material.setShininess(20);

Mesh mesh = cylinder.toMesh();
mesh.setMaterial(material);

Scene scene = new Scene();
scene.getRootNode().createChildNode("cylinder").attachMesh(mesh);
scene.save("cylinder.obj", FileFormat.OBJ);