We have a plug-in which we are looking at updating for Rhino 6. It has quite a lot of code that uses Rhino.NET, and I understand that this is no longer supported, but should be replaced by Rhinocommon libraries.
I do not have any experience with this, so any pointers to learning materials would be appreciated. Is there a guide on what mapping / replacement of classes and functions is involved in moving from Rhino.NET to RhinoCommon?
I am trying to understand the difference between Geometry in the Rhino.Geometry library and in the Rhino.DocObjects library. Am I right in assuming that the DocObjects contain the geometry and the GUID and that I should be looking to operate with those? Should the RMA object (such as MRhinoCurveObject) typically be replaced by DocObjects?
The kind of questions I am looking to answer are as follows. What are the replacements for the following (or where should I go to look)?:
On3dPoint -> Point3d
On3dVector -> Vector3d
OnLine -> Line (?)
OnLineCurve -> ?
MRhinoCurveObject -> Rhino.DocObjects.CurveObject or Rhino.Geometry.Curve ?
OnObject -> Object(?)
RhUtil -> ? (is there a comparison anywhere)
RMA.Rhino-> ?
RMA.OpenNURBS -> ?
I need to replace the following code (in VB.NET):
a_function(âŚ, ByRef line As OnLine, âŚ)
if line IsNot Nothing âŚ
Can I replace this with:
a_function(âŚ, ByRef line As Line, âŚ)
if line.IsValid âŚ
Hi Dale, no, we have not made any progress on this. Do you have any available guidance on this, whether general or detailed? I thought that you might have put out some guidance when the switch took place - guidance for developers inside or outside Rhino. I have not been able to find anything, though. Perhaps I (& Google) have been looking in the wrong places.
Thank you for this. I wasnât aware of the developer samples, but I was aware of the others.
So⌠regarding specifics, what replaces the following:
RMA.Rhino
RMA.Rhino.RhUtil
RMA.OpenNURBS
RhinoApp
RhinoCurve
RhinoCurve.SetCurve(Line)
MRhinoCurveObject (how is this different from RhinoCurve?)
MRhinoMeshObject
OnMesh (how is this different from
MRhinoObjectAttributes
OnLineCurve
OnObject
Point3dArray
OnUtil
I hope you donât mind me asking you a few of these (some of which may not have answers) as I am hoping that whatever you can answer will give me the general idea of how to move forward.
One other thought - do you have a manual for Rhino.NET that I could use to understand the old code (never having programmed with Rhino.NET)?
Keep in mind that there is not a one-to-one correspondence between Rhino_DotNet and RhinoCommon. Rhino_DotNet was structured around the Rhino C/C++ SDK. There has been more thought put into RhinoCommon and the organization of the namespaces.
It should also be noted that you can still reference both RhinoDotNet and RhinoCommon in a single plugin for Rhino 6. Converting to RhinoCommon doesnât need to be an âall or nothingâ type conversion. Instead, it can transform over time.
Hi Steve, that sounds very interesting to me. Are you saying that we donât need to do the conversion to RhinoCommon, but can continue to reference the RhinoDotNet library? We would prefer to make no changeâŚ
That is a little tricky to answer correctly. We broke some of our SDK with respect to RhinoDotNet in V6 so there is a good chance your plugin wonât load in V6 right now without at least some modifications. That said, if you send me your plugin, I can see if we can change any code to possibly get things working again.
The other route is to start with a new RhinoCommon based plugin and add RhinoDotNet as an assembly reference to that plugin. Once that is done you can create RhinoCommon commands, but use legacy RhinoDotNet code inside of the commands (your existing code).
This is not allowed in RhinoCommon. You typically create a curve object just to add it to the document. In that case you would just call doc.Objects.AddCurve(âŚ) passing your curve geometry to the function