Reading 3DM file content and putting them into text

Hello,

I am looking to read the entire contents of 3DM file and dump the contents into a text file so that it can be read by humans. I would also like to do the reverse - read the text file and convert it into a 3DM file.

The idea is that one should be able to edit the contents of the 3DM file manually. Is this possible? If so, what are the tools available to do this? Thank you

To a certain extent it should be possible, but when you say

to which level of detail are you expecting to be able to edit? The notes in the 3dm file, the units, the vertices of a mesh? The control points of a curve? Some of these will be more editable than others simply because they are less complex.

Generally, we have APIs in different languages. You can do this within Rhino with a c++ or dotnet plugin, or scripted with python or csharp. From outside of Rhino you can use OpenNURBS in c++, or rhino3dm in python, dotnet, or javascript.

Hi, thanks for the quick response. I am expecting to be able to edit at ALL levels of detail. Basically everything that describes the model in its completeness and at all levels of complexity. For the purpose of this exercise, assume that the person doing the editing can edit at all levels of complexity and would like to do so outside of Rhino in text format.

We did look at the OpenNURBS in C++ but that toolkit seems to have a lot of issues with its library which doesn’t appear to be stable and has missing constraints. Are there any other open source tools outside of Rhino that can be used to read a 3DM file in its completeness?

You have to keep in mind that deserializing all of this data into a human editable format means you need to serialize it back. It isn’t a trivial task especially for complex geometry types like breps. Meshes are not complex but may contain a lot of data.

What issues are there with openNURBS? This is what Rhino itself uses to read and write 3dm files.

Hi @Richard_James,

More on openNURBS:

As @fraguada has mentioned, openNURBS is used by core Rhino for I/O and other geometry-related operations. Also, third party applications that read and/or write Rhino’s .3dm file format are using it as well.

We’d love to hear more about this.

Thanks,

– Dale

1 Like

Hello all,

I am also attempting to achieve the same goal. We have 3DM files in our possession, and I intend to convert them into text files. For this purpose, I am referring to https://github.com/mcneel/opennurbs. Unfortunately, I am encountering difficulties in compiling the code correctly. If anyone has any insights into this matter, your assistance would be greatly appreciated.

Thank you for your time and consideration.

Best regards.

What difficulties are you having?

– Dale

Your request is hard to understand.

You said you’d like to read and write 3DM files. You said that you don’t want to use OpenNURBS.

Here are a few of the available paths:

  1. write a Rhino plugin specifically for import/export of your format. This is being improved for V8. Rhino - Code-Driven File IO (rhino3d.com)
  2. Write a plugin and loop over all objects, writing out whatever details you like. On the read, you could do something analagous but option #1 seems better
  3. use \OpenNURBS for either/both of the read/write
  4. Read via one of the above methods and save to RhinoScript which can then be run by Rhino as substitute for reading a 3DM.

What are you actually trying to do?

What’s your intended workflow?

Specifically, what’s wrong with these and other options built into Rhino?

If you try to build everything from scratch you’re going to have a lot of problems they’ve already put many many dev hours into solving. Most obviously, you’re going to get much better backward and forward compatibility for free within their toolchain than outside it.

1 Like