Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aspose-com-gists/efc1af935cad821f9b8e43015de04d66 to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/efc1af935cad821f9b8e43015de04d66 to your computer and use it in GitHub Desktop.
Convert 3D Scene to HTML in Aspose.3D–Guide in Java
import com.aspose.threed.Scene;
import com.aspose.threed.HtmlExportOptions;
import com.aspose.threed.FileFormat;
import com.aspose.threed.Color;
public class ConvertSceneToHtml {
public static void main(String[] args) {
// Path to the source 3D file (OBJ, STL, FBX, etc.)
String inputPath = "C:/Models/sample.obj";
// Path where the HTML output will be saved
String outputPath = "C:/Output/sample.html";
try {
// Load the 3D scene
Scene scene = new Scene();
scene.open(inputPath, FileFormat.WAVEFRONTOBJ);
// Specify HTML5 Save Options
Html5SaveOptions htmlOptions = new Html5SaveOptions();
htmlOptions.setShowGrid(true);
htmlOptions.setShowUI(false);
// Export the scene to HTML
scene.save(outputPath, htmlOptions);
System.out.println("Conversion successful. HTML saved at: " + outputPath);
} catch (Exception e) {
System.err.println("Error during conversion: " + e.getMessage());
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment