algorithmic modeling for Rhino
Hi David,
Is there any way to access the source code behind the components?
Or is this something with hard core copy rights? My guess is it is, but was just curious would be awesome to have the ability to open the components and learn/use the sc.
Cheers, hope alls well.
Tags:
Hi Madu.
This is not the source code behind the GH components, but the SDK on which (I believe) GH and Rhino is written. http://www.rhino3d.com/5/rhinocommon/
cheers,
Eirik
RhinoCommon is actually Open Source as of a few weeks ago.
Grasshopper is not. You agreed to this when you accepted the license agreement (don't tell me you didn't read it!?).
It is not possible to see the full source code for Grasshopper because I compile the code into MSIL dlls before I hand it out to people. It is however possible to reverse-engineer (or "disassemble") he code to a certain degree.
You can use Reflector to disassemble .NET assemblies into a number of popular languages, including C# and VB.NET. Just as long as you realize it is in fact a breach of the license agreement to use Reflector on Grasshopper.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hi David,
Thanks for the reply, and i promise not to reverse engineer... ;)
I've been playing a bit around with creating my on custom components in visual basic 2010 for GH referencing to a couple tutorials out there. In all making some progress and the bigger computation and how gh vb is operating is get more and more clearer.
I was testing while in visual basic 2010 to create a simple form with a button and link it directly to rhino. I'm having quite a bit of difficulties perhaps its the way im calling the rhinodoc.active window. I've been referring from the 'members in the vb component in gh and still doesnt work. I've been getting an error
"Unable to load DLL 'rhcommon_c': The specified module could not be found. (Exception from HRESULT: 0x8007007E)" and when i try to add rhcommon_c dll it also gives an error saying the file can't be added.
Anyways heres the simple code any input greatly appreciated...
Imports Rhino
Imports Rhino.Geometry
Imports Rhino.Collections
Imports System
Imports System.IO
Imports System.Xml
Imports System.Data
Imports System.Drawing
Imports System.Reflection
Imports System.Collections
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Imports System.Runtime.InteropServices
Public Class Form1
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pt As New Point3d(Rnd, Rnd, Rnd)
Rhino.RhinoDoc.ActiveDoc.Objects.AddPoint(pt)
End Sub
End Class
Hi Madu,
when you create a plugin for Rhino, you should make sure you do not create a copy of the RhinoCommon.dll in your project. You should reference the file, but set the CopyLocal property to False. After you've changed this, make sure you delete any RhinoCommon.dll file from your project build folders.
You cannot add rhinocommon_c.dll because it is a C++ dll. You can only reference 'managed' dlls in a .NET project and C++ is unmanaged.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hi David Thank you for the reply.
Two Reference I've loaded (Using Visual Basic 2010 Express \ Rhino 4):
Rhino_DoTNET.dll (in the rhino systems folder) = CopyLocal property False
RhinoCommon.dll ( in the grasshopper\rh_common foler) = CopyLocal propery False
Code:
Imports Rhino
Imports Rhino.Geometry
Imports Rhino.Collections
Public Class Form1
#Region "Members"
Private doc As RhinoDoc = RhinoDoc.ActiveDoc
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim aPt As New List(Of Point3d)
Dim pt As New Point3d(Rnd, Rnd, Rnd)
aPt.Add(pt)
End Sub
End Class
Above is the error I'm recieving.
Now with RhinoDotNet and Rhinocommon references set as False and neither dll.s are in the project build folder of my vb I'm under the assumption that this must be the way I'm trying to link to rhino in my code. Am I missing something here? I've been ripping through github and havn't found any thing related to making the basic connection to rhino or on Mcneels site. (on a side note I've noticed quite a bit of examples of csharp on the site, perhaps i'm gunna trot in that terriorty next month ;) ) anyways any thoughts or feedback when you get a chance. Cheers!
p.s. the intention is to create a form with a button to execute the point creation upon being pressed
Hi madu,
you can't use RhinoCommon in Rhino4. Only Grasshopper has been granted this exception, and then only because I compile a special version of RhinoCommon as part of the Grasshopper build process.
If you want to use RhinoCommon you'll need to work in Rhino5.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Ha, ok well that would be the issue.
Cheers, I'll upgrade and take another stab at it!
Hi David & All,
I've updated to rhino 5 eval version.
Installed Rhinocommon.
In VB studio Referenced RhinoCommon = False & Rhino_DotNet = False
*%!*%# Error
System.InvalidOperationException-
{"An error occurred creating the form. See Exception.InnerException for details. The error is: Could not load file or assembly 'RhinoCommon, Version=5.0.15005.0, Culture=neutral, PublicKeyToken=552281e97c755530' or one of its dependencies. The system cannot find the file specified."}
-Warning 1 Possible problem detected while building assembly 'Random_Points': Referenced assembly 'Rhino_DotNet.dll' targets a different processor Random_Points
Code:
Option Strict Off
Option Explicit On
Imports Rhino
Imports Rhino.Geometry
Imports Rhino.Collections
Imports System
Imports System.IO
Imports System.Xml
Imports System.Data
Imports System.Drawing
Imports System.Reflection
Imports System.Collections
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Imports System.Runtime.InteropServices
Public Class Form1
#Region "members"
Private doc As RhinoDoc = RhinoDoc.ActiveDoc#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim aPt As New List(Of Point3d)
Dim oPt As New Point3d(Rnd, Rnd, Rnd)
aPt.Add(oPt)
End Sub
End Class
I'm a bit confused. Perhaps I'm missing something to enable rhino as the active document. I'm gunna keep digging around on github and mcneal and feedback greatly appreciated.
-shamefull madu
This thread has got me officially confused now. Are you trying to code up Grasshopper components or a Rhino plugin? Let's move this discussion into a new thread.
In either case, why are you referencing both Rhino_DotNET and RhinoCommon? There could be a good reason for this, but it is unlikely that applies.
To make a .NET plugin for Rhino4 (rhp) you need to reference only Rhino_DotNET.dll and make sure you don't 'Copy Local'.*
To make a .NET plugin for Rhino5 (rhp) you need to reference only RhinoCommon.dll and make sure you don't 'Copy Local'.**
To make a .NET plugin for Grasshopper (gha) you need to reference RhinoCommon.dll, Grasshopper.dll and GH_IO.dll, and they must all be CopyLocal = False.**
I do have a couple of remarks and questions:
--
David Rutten
david@mcneel.com
Poprad, Slovakia
* We will keep on supporting Rhino_DotNET for as long as possible, so any plugin build using it will also run on Rhino5.
** If Rhino_DotNET has functionality that you need and which is not (yet) available in RhinoCommon, you might need to reference it as well. But this is quite a special case.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by