Convert .dwg to .obj with javascript


I want to load a .dwg file to three.js. But since three.js can’t load those files, I was trying to convert to .obj in javascript, how can I do it?

3ds Max is able to import DWG files. You can then perform an export to OBJ.

Sorry, I forgot to say, I’m trying to do this with javascript :confused: @Mugen87

1 Like

3ds max used to cost around $4000, but I think nowadays you can subscribe to it.

Either way it might be too much $$$ to convert some file to be used with some open source library. I don’t think that @Mugen87 advice is feasible for this.

. Dwg is a closed format I think, you need to search for some utilities that can convert it or try to save to something else (dxf for example).

Something like this perhaps, seems like it could maybe convert it to svg. It does not cost $4000.

1 Like

There is a free trial version of 3ds Max. If you just need to convert files once, it might be worth to give it a try.

Parsing CAD files is very complicated. There are no loaders for other popular CAD formats like STEP or IGES because of this. I highly recommend to convert such files with a tool in advance.

I’d like to do that, I have 3DsMax so that’s no a problem. The thing is I’m developing a react app and I’m using three.js to show the 3D object that comes from an API in a zip with a dwg file. That’s the reason why I can’t just use a tool @Mugen87 @pailhead

Hi! I am creating a react app too. My application will convert CAD files with models to an arcGis map. Did you find a solution with exporting CAD in threejs friendly formats? I would be very grateful for the advice)

I’m not aware of a JavaScript solution for converting DWG to OBJ.

No sorry. I have never worked with Forge or DWG.