Hello Guys,
hopefully you can help me. I use Rhino4.
As I said in the Topic I want to save my Layers as single files, therefore I use the Script ‘ExportLayerObjects’ from RhinoScripts.
Option Explicit
Sub ExportLayerObjects
’ Declare local variables
Dim strPath, strFile
Dim arrLayers, strLayer
Dim arrSelected
’ Get the path to and name of the current document.
’ Surround with double-quotes in case path includes spaces.
strPath = Chr(34) & Rhino.DocumentPath & Rhino.DocumentName & Chr(34)
’ Get names of all layers
arrLayers = Rhino.LayerNames
’ Disable redrawing
Rhino.EnableRedraw False
’ Process each layer
For Each strLayer In arrLayers
’ Unselect all
Rhino.Command “_-SelNone”, 0
’ Select all objects on layer. Surround layer name
’ with double-quotes in case it includes spaces.
Rhino.Command "_-SelLayer " & Chr(34) & strLayer & Chr(34), 0
’ Make sure some objects were selected
arrSelected = Rhino.SelectedObjects
If IsArray(arrSelected) Then
’ Generate a modified path string
’ that includes the layer name
strFile = strPath
strFile = Replace(strFile, “.3dm”, “_” & strLayer & “.3dm”)
’ Export the selected objects
Rhino.Command "_-Export " & strFile, 0
End If
Next
’ Unselect all
Rhino.Command “_-SelNone”, 0
’ Enable redrawing
Rhino.EnableRedraw True
End Sub
It works properly, I can change the filetype to .STEP or .IGES. Also the default .3DM works fine.
My problem is that I want to open the newly created files in MOI, but MOI can only handle the Rhino2 .3DM file format.
Now my question, is it possible to change the .3dm output from Rhino4 to Rhino2:
’ Generate a modified path string
’ that includes the layer name
strFile = strPath
strFile = Replace(strFile, “.3dm”, “_” & strLayer & “.3dm”)
And if it’s not possible:
I can also use .step but I need to choose the STEP-Option scheme for each Layer, can i skip that?
Thanks for your help!
Cheers
Thomas