Autodesk 3ds Max, formerly 3D Studio and 3D Studio Max, is a professional 3D computer graphics program for making 3D animations, models, games, and images. It is capable of creating 3DS files because it contains data for the 3D representation of scenes and images. It is also one of the popular file formats for 3D data import and export. Similarly, the Additive manufacturing file format (AMF) is an open standard for describing objects for additive manufacturing processes such as 3D printing. Unlike its predecessor STL format, AMF has native support for color, materials, lattices, and constellations.

In this article, we are going to discuss the interconversion of these two formats using REST API.

3D Modelling and Processing API

Aspose.3D Cloud API provides the capabilities to create & process 3D models, objects, and entities (Box, Cylinder, Sphere, Torus, Plane) in the cloud. Albeit specific softwares are available for 3D files processing but they incur installation and licensing costs. Also, in order to perform batch processings, programmatic solutions are the viable approach. Furthermore, the REST architecture enables you to access the API on any platform using any language.

3DS to AMF conversion with cURL command

We are aware that client URL is a free command-line tool popular for data transfer to or from a network server, using one of the supported (HTTP, HTTPS, FTP, etc). It uses URL syntax to transfer data to and from servers. cURL is widely popular because of its ability to be flexible and complete complex tasks. Since our Cloud APIs are developed as per REST architecture, so you can also use the cURL command-line tool to access Aspose.Words web services easily.

So in order to proceed further, the first step is to generate a JWT access token because our REST APIs are only accessible to authorized persons. So the next step is to obtain your personalized ClientID and ClientSecret details. Therefore, the first step is to create an account by visiting Aspose.Cloud dashboard. If you have GitHub or Google account, simply Sign Up. Otherwise, click on the Create a new Account button and provide the required information. Now login to the dashboard using credentials and expand the Applications section from the dashboard and scroll down towards the Client Credentials section to see Client ID and Client Secret details.

Client Credentials

Image 1 :- Client credentials on dashboard.aspose.cloud

Now that we have the ClientID and ClientSecret details, we need to execute the following command in the terminal to generate the JWT token.

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=718e4235-8866-4ebe-bff4-f5a14a4b6466&client_secret=388e864b819d8b067a8b1cb625a2ea8e" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

The next step is to upload the file to cloud storage while executing the following command.

curl -X PUT "https://api.aspose.cloud/v3.0/3d/storage/file/rochair_hansen.3ds" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-H  "Content-Type: multipart/form-data" \
-d {"File":{/Users/nayyershahbaz/Documents/Esso.3ds}}

In the above example, the path for the 3DS file on the local system is provided. Now that the file is uploaded in the cloud storage, we can execute the following command to perform the 3ds to amf conversion.

curl -v -X GET "https://api.aspose.cloud/v3.0/3d/saveas/newformat?name=Esso.3ds&newformat=amf&newfilename=Esso.amf&IsOverwrite=true" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>"

Convert 3DS to AMF in Java

In order to facilitate our customers using Java programming language, we have created a wrapper named Aspose.3D Cloud SDK for Java provides all the features and capabilities of 3D file processing within the Java program.

Installation and Configuration

The first step to use the programming SDK is its installation and its available for download at Maven and GitHub. Given below are the details on how to download and use aspose-3d-cloud-20.5.jar in the Maven build project.

Add the following dependencies in your pom.xml file.

<repositories>
 <repository>
        <id>aspose-cloud</id>
        <name>artifact.aspose-cloud-releases</name>
        <url>http://artifact.aspose.cloud/repo</url>
    </repository>   
</repositories>
<dependencies> 
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-3d-cloud</artifactId>
    <version>20.5</version>
</dependency>
</dependencies>
Aspose.3D Cloud jar

Image 2:- Aspose.3d.jar under project dependencies.

In the following section, we are going to discuss the details on how to perform 3DS to AMF conversion using Java Cloud SDK.

  • The first step is to create an object of ThreeDCloudApi while passing Client ID and Client Secret details as arguments
  • Create String variable to define input 3DS file name
  • Now create another String variable defining resultant file format (amf in our case)
  • In order to specify the resultant file, create another String instance
  • Finally, call the postConvertByFormat(…) method of ThreeDCloudApi to perform the conversion operation

The sample files used in above example can be downloaded from following links

Conclusion

In this article, we have discussed the steps and related details on how to perform the 3DS file format conversion to AMF. The Cloud API is so amazing that you can perform the conversion with fewer code lines (2 lines to be precise). Please try using our API and in case you encounter any issue or you have any related query, please feel free to contact via the Free support forum.

Also please note that our Cloud SDKs are developed under the opensource model and their complete code snippet can be downloaded from GitHub.

We also recommend you to visit the following links and learn more about the capabilities of our award-winning APIs