Forgot password?

Create an account!


« back

RhinoScript – Working off a script i found. Export each layer to seperate .3ds


Please log in to write a message.

  • 1. frodoskywalker (Aug 06, 2016 16.53):

    The issue im encountering is Rhino needs me to confirm the polygonal density. All i really need is to have the script hit enter whenever that comes up so i don't have to manually.

    I made a simple file to run the test with.

    I have no coding experience, I got this from here

    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 & ".3ds")
           ' Export the selected objects
           Rhino.Command "_-Export " & strFile, 0
         End If
       ' Unselect all
       Rhino.Command "_-SelNone", 0
       ' Enable redrawing
       Rhino.EnableRedraw True
     End Sub

Why are these buttons gray?