Forgot password?

Create an account!

Forum

« back

RhinoScript – open the all object in the folder and delete one layer

Messages

Please log in to write a message.

  • 1. Zolir1 (Oct 30, 2017 23.13):

    Hy

    i'm tried wrote a script ,which is open all object in the folder and delete Gem 01 layer in all file.
    But I can not handle it.
    Script is running , open all object and delete layer, but not Gem 01 layer. Do you someone know help me what is the problem my script

    Option Explicit
    'Script written by <insert name>
    'Script copyrighted by <insert company name>
    'Script version Thursday, October 19, 2017 9:21:06 PM

    Call BatchRender

    Sub BatchDelete()

    Dim sFolder
    sFolder = Rhino.BrowseForFolder(, "Select folder to process", "Batch Render")
    If VarType(sFolder) <> vbString Then Exit Sub

    Dim oFSO
    Set oFSO = CreateObject("Scripting.FileSystemObject")


    Dim oFolder
    Set oFolder = oFSO.GetFolder(sFolder)


    RecurseFolder oFolder


    Rhino.Command "_-New _None", 0


    Set oFolder = Nothing
    Set oFSO = Nothing

    End Sub

    Sub RecurseFolder(oFolder)


    Dim oFile
    For Each oFile In oFolder.Files
    ProcessFile oFile.Path
    Next

    Dim oSubFolder
    For Each oSubFolder In oFolder.SubFolders
    RecurseFolder(oSubFolder)
    Next

    End Sub


    Sub ProcessFile(sFile)


    Dim sBitmap

    Rhino.Command "_-Open " & Chr(34) & sFile & Chr(34), 0

    Dim strObject

    strObject = Rhino.FirstObject
    If Not IsNull(strObject) Then
    Rhino.SelectObject strObject
    End If
    Rhino.Command "Gem 01"
    Rhino.DeleteObject strObject
    Rhino.Command "_-save " & sFile, 0



    End Sub

Recommend

Why are these buttons gray?