miho / JCSG

Java implementation of BSP based CSG (Constructive Solid Geometry)
Other
177 stars 52 forks source link

How to import OBJ ? #56

Closed co-ord closed 4 years ago

co-ord commented 4 years ago

Thank you for this wonderful library @miho .

I'm testing the different functions of JCSG and would like to know how to import an OBJ file.

Writing MyObj = Importer3D.load("column.obj") returns the following error:

Unknown 3D file format [obj] at eu.mihosoft.jcsg.ext.openjfx.importers.Importer3D.loadIncludingAnimation(Importer3D.java:139)

Another attempt with MyObj= ObjImporter("C:/Users/solub/Desktop/meshes/column.obj") returns:

java.net.MalformedURLException: unknown protocol: c at java.net.URL.(URL.java:600) at java.net.URL.(URL.java:490) at java.net.URL.(URL.java:439) at eu.mihosoft.jcsg.ext.openjfx.importers.obj.ObjImporter.(ObjImporter.java:108) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

Am I doing something wrong here ?

co-ord commented 4 years ago

@miho Any help on this matter would also be greatly appreciated.

Please.

miho commented 4 years ago

There's no OBJ importer. Only exporting is supported (see project description). You can import STL files, however.

elect86 commented 4 years ago

let me suggest this jvm port of assimp

miho commented 4 years ago

Good suggestion. With that you can "add support" for all formats supported by assimp. If you are okay with going through this intermediate step you can achieve this with only a few lines of code.

co-ord commented 4 years ago

Thanks to both of you.

Now that miho clarified that there is no OBJ importer I realize my question was irrelevant. Apologies.

Processing has a built-in mesh importer that I can use. Unfortunately, it seems impossible to convert the imported shape to a CSG object.