Is it possible to convert a .dwg
file from disk into .3dm
using Rhino Compute?
const filePath = './sample.dwg'
const fileData = fs.readFileSync(filePath).toString('utf8')
...cool rhino compute code/call goes here
Is it possible to convert a .dwg
file from disk into .3dm
using Rhino Compute?
const filePath = './sample.dwg'
const fileData = fs.readFileSync(filePath).toString('utf8')
...cool rhino compute code/call goes here
We need to add a new endpoint for rhino.compute to support file conversion to 3dm. Technically this could be achieved by passing a python script to compute and returning a base64 encoded version of the 3dm file, but this approach doesn’t seem nearly as elegant as simply having a new endpoint called something like /to3dm
I added this to our bug tracker at Create to3dm endpoint · Issue #415 · mcneel/compute.rhino3d · GitHub
and will see what we can do to get this implemented soon
Here’s an option, in the form of a sample Rhino Compute plug-in.
Hey @will . Did you have an example of going in the opposite direction? We have some .dwg and .dxf files and we would like to go from those to a .3dm file.
I think you would need to write the dwg/dxf to a temporary file on the server and then import it into a headless doc.
// read request body and write to temp path with correct extension
var doc = Rhino.RhinoDoc.CreateHeadless(null);
doc.Import("path/to/file.dwg");
doc.WriteFile("path/to/file.3dm", new FileWriteOptions());
// read "path/to/outfile.3dm" and return in response
Note, there isn’t currently any support for configuring file import settings.
Awesome, cheers!