Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active September 23, 2023 04:59
How to Convert OBJ to STL in Java. For more details: https://kb.aspose.com/3d/java/how-to-convert-obj-to-stl-in-java/
import com.aspose.threed.*;
public class Main
{
public static void main(String[] args) throws Exception // Change OBJ to STL in Java
{
com.aspose.threed.TrialException.setSuppressTrialException(true);
// Set the licenses
// new License().setLicense("License.lic");
// Create Scene class object
com.aspose.threed.Scene scene = new com.aspose.threed.Scene(); scene.open("Aspose3D.obj");
// Create StlSaveOptions class object
com.aspose.threed.StlSaveOptions options = new com.aspose.threed.StlSaveOptions();
// Convert OBJ to STL file
scene.save("output.stl", options);
System.out.println("Done");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment