Hi everybody,
I am trying to use rhinoscriptsyntax as (rhino.getobejct, rhino.addpoint , rhino.istext, etc) in a plugin develop in Visual Studio.
How can I do this?
Thank you
Hi everybody,
I am trying to use rhinoscriptsyntax as (rhino.getobejct, rhino.addpoint , rhino.istext, etc) in a plugin develop in Visual Studio.
How can I do this?
Thank you
Hi @javiervg84,
rhinoscriptsyntax
is a library of Python-callable functions. The library is written in Python, so you’re not going to be able to call these from a C# plug-in, for example.
However, rhinoscriptsyntax
simply makes calls into RhinoCommon, which you do from a C# plug-in. So is possible to port these functions to C#.
Here is the rhinoscryptsynax
source:
https://github.com/mcneel/rhinoscriptsyntax/tree/rhino-6.x/Scripts/rhinoscript
That said, it’s probably best to just learn RhinoCommon. There are resources and plenty of code samples to help you along.
https://developer.rhino3d.com/guides/rhinocommon/
https://github.com/mcneel/rhino-developer-samples
– Dale
Hi @Dale,
Thank you in advance for you reply.
I´m developing in Visual Studio 2015 with VB. I´d like to know why doesn´t work this command Rhino.layervisible(strLayer, True)?
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
Hi @Dale,
Yes, I am. I am writing this plug-in in Visual Studio (VB). It works right until the command Rhino.layervisible. This command doesn´t do anything. I dont know why.
Hi @javiervg84,
When writing .NET plug-ins for Rhino, you will be using the RhinoCommon API, not RhinoScript.
– Dale