Stl to obj in java

Hello, the current stl to obj model has problems when the stl file format is binary, and the conversion is unsuccessful. Success can only be achieved if the stl file format is ASCII. It is the same problem for Maven to switch multiple aspose-3d versions.

However, it is successful to use python to convert。


Can you please share your sample source file and the code snippet that you are using? We will test the scenario in our environment and address it accordingly.

Hello, the following code snippets and comments of the case I used:

public class Test {

public static void main(String[] args) {
    try {

        // 1. This is an ASCII encoded stl file
        Scene scene = Scene.fromFile("C:\\Users\\bz\\Desktop\\t.stl",FileFormat.STLASCII);
        // to obj file ,FIXME) this is successful"C:\\Users\\bz\\Desktop\\t-1.obj",FileFormat.WAVEFRONTOBJ);
        // to Binary stl file ,FIXME) this is successful"C:\\Users\\bz\\Desktop\\t-2.stl",FileFormat.STL_BINARY);
        // to ASCII stl file ,FIXME) this is successful"C:\\Users\\bz\\Desktop\\t-1.stl",FileFormat.STLASCII);

        // 2. This is a binary encoded stl file
        scene = Scene.fromFile("C:\\Users\\bz\\Desktop\\LCC.stl", FileFormat.STL_BINARY);
        // to Binary obj file , FIXME) this is a failure"C:\\Users\\bz\\Desktop\\LCC-1.obj",FileFormat.WAVEFRONTOBJ);
        // to Binary stl file , FIXME) this is a failure"C:\\Users\\bz\\Desktop\\LCC-2.stl",FileFormat.STL_BINARY);
        // to ASCII stl file , FIXME) this is failure"C:\\Users\\bz\\Desktop\\LCC-3.stl",FileFormat.STLASCII);

    } catch (IOException e) {

The following dependent versions were attempted:

-- the first
-- the second
-- the third

The failed screenshot attachment is as follows:

image.png (8.3 KB)

We look forward to your reply.


This issue has been logged as THREEDJAVA-227 in our issue tracking system for further investigation. We will try to fix it in next upcoming release. Please be patient and spare us some time.

We are sorry for the inconvenience.

Thanks for you!