This plug-in works properly until the command Rhino.islayervisible(strLayer). Anyone know why could be this? I am developing this plug-in with VB in Visual Studio 2015.
You can see my program below:
Imports System
Imports System.Collections.Generic
Imports Rhino
Imports Rhino.Commands
Imports Rhino.DocObjects
Imports Rhino.Geometry
Imports Rhino.Input
Imports Rhino.Input.Custom
Namespace ACTIVAR_CAPAS
<System.Runtime.InteropServices.Guid("c1135058-446c-4002-bae0-3aa90b39e42b"),
Rhino.Commands.CommandStyle(Rhino.Commands.Style.ScriptRunner)>
Public Class INCOMACTIVARCAPASCommand
Inherits Rhino.Commands.Command
Shared _instance As INCOMACTIVARCAPASCommand
'''<returns>The command name as it appears on the Rhino command line.</returns>
Public Overrides ReadOnly Property EnglishName() As String
Get
Return "INCOMACTIVARCAPAS"
End Get
End Property
Protected Overrides Function RunCommand(ByVal doc As RhinoDoc, ByVal mode As RunMode) As Result
Dim Rhino, objRhinoScript As Object
objRhinoScript = CreateObject("Rhino5x64.Interface")
If (Err.Number <> 0) Then
RhinoApp.WriteLine("Unable to create Rhino5x64.Interface object")
Exit Function
End If
Rhino = objRhinoScript.GetScriptObject
If (Rhino Is Nothing) Then
RhinoApp.WriteLine("Failed to get Rhinoscript object")
Exit Function
Else
RhinoApp.WriteLine("Rhino object created.")
End If
Dim arrLayers As Array
Dim strLayer As String
arrLayers = Rhino.LayerNames
If IsArray(arrLayers) Then
For Each strLayer In arrLayers
If Rhino.islayervisible(strLayer) = False Then
Rhino.layervisible(strLayer, True)
End If
Next
End If
Rhino = Nothing
objRhinoScript = Nothing
Return Result.Success
End Function
End Class
End Namespace