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。

@chenweis

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
        scene.save("C:\\Users\\bz\\Desktop\\t-1.obj",FileFormat.WAVEFRONTOBJ);
        // to Binary stl file ,FIXME) this is successful
        scene.save("C:\\Users\\bz\\Desktop\\t-2.stl",FileFormat.STL_BINARY);
        // to ASCII stl file ,FIXME) this is successful
        scene.save("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
        scene.save("C:\\Users\\bz\\Desktop\\LCC-1.obj",FileFormat.WAVEFRONTOBJ);
        // to Binary stl file , FIXME) this is a failure
        scene.save("C:\\Users\\bz\\Desktop\\LCC-2.stl",FileFormat.STL_BINARY);
        // to ASCII stl file , FIXME) this is failure
        scene.save("C:\\Users\\bz\\Desktop\\LCC-3.stl",FileFormat.STLASCII);

    } catch (IOException e) {
        e.printStackTrace();
    }
}

}
The following dependent versions were attempted:

-- the first
<groupId>com.aspose</groupId>
<artifactId>aspose-3d</artifactId>
<version>21.10</version>
-- the second
<groupId>com.aspose</groupId>
<artifactId>aspose-3d</artifactId>
<version>22.2</version>
-- the third
<groupId>com.aspose</groupId>
<artifactId>aspose-3d</artifactId>
<version>22.10</version>

The failed screenshot attachment is as follows:

image.png (8.3 KB)

We look forward to your reply.

@chenweis

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!