I’ve just started using Rhino 5, where I’m modeling flow environments (e.g. a helicopter deck) to be used in a seperate flow analysis software. To do this I must export the geometries as STL format. Is Rhino able to carry the objects’ names over to the STL file?
The exported files are on the form of solid OBJECT
...
endsolid OBJECT
Where I’d like OBJECT to be replaced the object’s name in Rhino.
I’ve tried to give a Name to the mesh being exported but that does not help. Maybe the STL Exporter can be updated such that it uses the name when writing an object if the name is defined?
The file format specification does allow for the name to be used according to the STL File Format on WikiPedia
I ended up making a rudimentary script that takes a collection of STL files and combines them such that the individual filenames (I need several exports/resolutions either way) is set in as names in the new “parent” file.
Certainly not ideal, but it sort of gets the job done.
I am the developer that currently maintains the STL export plugin but it was actually written by another developer a long time ago, like pre Rhino 1.0. I am not sure why it is this way but that string actually comes from a registry key, that you are able to change. See HKEY_CURRENT_USER\Software\McNeel\Rhinoceros\5.0x64\Scheme: Default\Plug-ins\247C2434-95C3-49df-9B43-FC6747723872\Settings\ObjectTag, if you’re comfortable with regedit. As it currently stands you can only get to that value via the registry, I don’t know if there was some sort of interface in older Rhinos that got missed along the way or what. I do know that we only write out one “Solid” regardless of how many objects are in the file. (as I understand it that’s what the stl filespec requires) That may be the reason that an actual object name is not used. I suppose we could use an object name, if it exists (not sure about spaces and I’m pretty sure it’s limited to ascii characters only), and you’re only exporting a single object to the file. If you’re exporting more than one object it doesn’t really make sense since there can only be one name. Let me know if this seems worthwhile and I’ll see what I can do.
My tests so far have worked fine with several objects in one file (e.g. in one file, say multifile.stl, you can have “solid OBJECTNAME1 … endsolid OBJECTNAME1 \ \ solid OBJECTNAME 2 … endsolid OBJECTNAME2”), something I’m having made now by stitching together multiple files and naming each object based on the files name. Like I said, a rudimentary approach, at best, but it gets the work done.
When I use a separate program for meshing, it would be convenient to have the names carry over. For instance, it’s easier to know which surfaces to treat as exhaust inlets if that’s what the name in the STL file.
However, I often need differing resolution over the objects, so I’ll have to make distinct files either way, so you can probably let this issue be.
I have some questions for you (really anyone who is familiar with the stl format and has an opinion).
Before I ask, I want to make sure that you realize this could only ever happen in the ASCII version of STL export in Rhino. Short of the header, there is no means in the binary version to name an object. Nor is there any way to differentiate between multiple objects.
Are you exporting a model that only ever has a single object in it? If that is the case then the problem is easy to fix and I can work on it immediately.
I am concerned that making multiple solid entities in the same file will result in files that are not wholly readable by downstream apps. I tried merging multiple STL files into a single file with multiple solid…endsolid entities (using the technique tarjeiba desribed above) and I could not get Rhino or 3D Builder to import any more than the first object.
What if you have this scenario. You have one model consisting of a sphere (object name sphere), a cone (object named cone), a box (object named box), an ellipsoid (object has no name) and a torus (object has no name).
Using the existing code it would be easy to name the, single, solid using the first object name encountered. You might even be able to influence the name by selecting objects in order while running Export instead of SaveAs. Is that what you want?
That’s the file scenario that Rhino will not round trip as it’s currently coded. Should there be names in the STL file for the objects that are not named in Rhino? If yes, would an edit box on the export dialog be adequate? Should they be decorated, with a numeric suffix for instance, so that unnamed objects in Rhino have unique names in the STL file?
Let me know what you’re thinking so I can figure out how to proceed.
It is implementaed in the V6 ?
I could not find a way to export a named stl .
in fact it is very usefull for exporting gemoetry for CFD software like Openfoam and snappyhexmesh.
Hi Fred - it is not in V6. It’s possible but at the moment not super likely to get into V7 as of now - not because it is hard, for ascii files at least, but it has the potential to make a mess for many users by splitting output into multiple objects rather than a single mesh. It would of course be an option, but nevertheless the potential for breaking the export process for many many users is pretty great so I can’t say we’re just going to add this.