DOCX JPG PDF XML DAE
  Product Family
DAE

Merge DAE via Java

Merge DAE using Java library without any 3D modeling software.

How to Merge DAE File Using Java

In order to merge DAE file, we’ll use

Aspose.3D for Java

API which is a feature-rich, powerful and easy to use Merger API for Java platform. You can download its latest version directly from

Aspose Maven Repository

and install it within your Maven-based project by adding the following configurations to the pom.xml.

Repository


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

Dependency

<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-3d</artifactId>
<version>version of aspose-3d API</version>
<classifier>jdk17</classifier>
</dependency>

Steps to Merge DAE via Java

Java programmers can easily merge DAE in just a few lines of code.

  • Merge multiple DAE files by looping
  • After merging, a usdz file is generated, waiting for download processing
  • Load the generated usdz file through the constructor of the Scene class
  • Process usdz files and save them in the format you want

System Requirements

Aspose.3D for JAVA is supported on all major operating systems. Just make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with Java Runtime Environment for JSP/JSF Application and Desktop Applications.
  • Get latest version of Aspose.3D for Java directly from Maven.
 

JAVA code to Merge DAE


//Multiple source files that need to be merged
String[] files = {"template.dae","template2.dae"};

//Process file merge to generate usdz file
Scene scene = new Scene();
int i = 0;

for(String file: files)
{
    FileStream fs = new FileStream(file, FileStream.OPEN, FileStream.READ);
    FileFormat fmt = FileFormat.detect(fs, files[i]);
    Node subNode = scene.getRootNode().createChildNode(files[i]);
    i++;
    try
    {
        Scene subScene = new Scene();
        LoadOptions opt = fmt.createLoadOptions();
        subScene.open(fs, opt);
        subNode.setEntity(PolygonModifier.mergeMesh(subScene));
        MoveTo(subScene.getRootNode(), subNode);
    }
    catch (Exception e)
    {
    }
}

String reviewFile = "result.usdz";
UsdSaveOptions usdz = new UsdSaveOptions(FileFormat.USDZ);
usdz.setPrimitiveToMesh(false);
usdz.setExportMetaData(true);

scene.save(reviewFile, usdz);

//Process usdz files and save them in the format you want
Scene scene2 = new Scene();
String physicalFile = reviewFile;
FileStream fs2 = new FileStream(physicalFile, FileStream.OPEN, FileStream.READ);
FileFormat fmt2 = FileFormat.detect(fs2, "result");
Scene subScene2 = new Scene();
LoadOptions opt2 = fmt2.createLoadOptions();
subScene2.open(fs2, opt2);
Node newNode = scene2.getRootNode().createChildNode("");
double[] value = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
newNode.getTransform().setTransformMatrix(new Matrix4(value));
MoveTo(subScene2.getRootNode(), newNode);
String output = "merger.fbx";
scene2.save(output, FileFormat.FBX7400ASCII);

//MoveTo class for call processing
public static void MoveTo(Node subScene, Node parent)
{
    while (subScene.getChildNodes().size() > 0)
    {
        Node node = subScene.getChildNodes().get(0);
        subScene.getChildNodes().remove(0);
        parent.addChildNode(node);
    }
}
 
  • Free App to Merge DAE

    Other Supported App to Merge Formats

    Using JAVA, One can also merge many other file formats including.

    3DS (3D Studio Mesh File Format)
    3MF (3D Manufacturing Format)
    AMF (Additive Manufacturing Format)
    ASE (Aseprite Sprite File)
    DAE (Digital Asset Exchange File Format)
    DXF (Autodesk Drawing Exchange File Format)
    DRC (Google Draco)
    FBX (Filmbox Interchange File)
    GLB (Binary GlTF File)
    GLTF (GL Transmission Format)
    JT (JT File Format)
    OBJ (OBJ File Format)
    PLY (Polygon File Format)
    PDF (3D PDF)
    RVM (RVM File Format)
    STL (Stereolithography)
    U3D (Universal 3D File Format)
    VRML (Virtual Reality Modeling Language)
    X (DirectX Model File)
    USD (Universal Scene Description)
    USDZ (Universal Scene Description Zip Archive)