How can I export the Rhino layers to a .stp-file? I found out that I need to create blocks having the same layer names. If this is the only way, how can I create the blocks automatically from all the layers?
Here is a batch export script that exports one STEP file per layer. If the original Rhino file has not been saved, the file browser will come up and ask you to choose a master file name plus a folder. The files will be named “MasterName-LayerName”. If the Rhino file has been named, the export names will be “RhinoFilename-LayerName”. There will still be a choice of export folder, Enter will choose the current folder. Supports sublayers, file name will be the full layer path separated by dashes.
Set up STEP export scheme before running, as this script will use the last chosen export option. Exports points, curves, surfaces and polysurfaces.
BatchExportSTPByLayer.py (2.3 KB)
Thank you for the fast response, Helvetosaur. Actually, I was looking for a way to pass the layers into only one stp-file.
I know that it works, if one creates as many blocks as layers, then puts the objects of each layer in the corresponding block and then does the export as stp-file. However, I am looking for a way to do this tranformation (i.e., Create block from layer and name the block with the layer name) automatically for all layers. I found a Rhino script (see https://www.modelical.com/en/pack-rhino-objects-one-block-per-layer-scripting/). This script does the transformation, but it gives a syntax error at a certain line (line 41, as far as I remember). The exported stp-file seems to be ok, but I am not sure, due to the mentioned syntax error. How can I correct the Rhino script, so that everything works without a syntax error?
Moved to Rhino for windows
@christian.deltaglia Welcome to the
Please choose a category so your post gets indexed/tagged for quicker/appropriate response.
Hi Christian. This should already work. Be sure to select AP214AutomotiveDesign as the STEP Schema when exporting. AP203 does not support layers.
Thank you Chuck. Do you mean that the script that I found on internet behaves correctly? If this is what you mean, how can I avoid the tedious syntax error message?
No, I didn’t look at the script. STEP does export Rhino layers as layers if you use AP214. You can see this by saving a 3dm to step and reading it back into Rhino. The layers should be there with the correct names.
Dear Chuck, thank you. Yes, you are right, I have just tested it. I saw also that unjoined surfaces of the same layer are saved in the stp-file in layers with the Rhino layer name plus an index. So, you need to join the “joinable” surfaces in the same layer before you do the export. In this way, you get less layers in the stp-file.
The issue is now solved for me.
Hi Christian. Thanks for the update. I’m a little concerned about your comment about the unjoined surfaces. I don’t see that behavior of multiple layers in Rhino, but maybe I’m not trying the exact same thing as you. Are you seeing this when importing your step file back into Rhino or are you seeing it when reading the Rhino-created step file into another product?
Thank you Chuck. I checked this using the Autodesk free online viewer (https://viewer.autodesk.com). There, you see the layer issue I mentioned. Whould be nice to have only one layer in the stp-file even if the objects in the same layer are not joined.
Thanks for the link. I downloaded the viewer and see what you are seeing. I opened a step file that has an exploded box. all six sides on the same layer in the step file, and the viewer created a separate later for each face. Unfortunately, there’s nothing we can do on our side since the creation of the separate layers for each unjoined surface is done by the autodesk step reader, rather than our exporter.