I am very new to the idea of Rhino.Compute
and I am trying to understand the sample file “circleinintersection” program
from the github site.
see image and if someone could answer those questions and also
Local Rhino API vs Rhino Compute that would be helpful
Hi Marcellojs - i notice you haven’t had a reply yet so I will offer my thoughts until someone can give a better reply…
Say I would like to achieve something that Rhino/Grasshopper can do , but
- I don’t have (or don’t want to have) Rhino/Grasshopper installed on the computer my app is running on.
- I do have Rhino/Grasshopper installed but I don’t want my app to have to open Rhino/Grasshopper for it to function (i.e. I don’t want my app to be an Add-In)
I assume that for these types of scenarios i can develop my app and simply call the Rhino.Compute webAPI methods that offer the functions I am interested in. No need for Rhino/Grasshopper on my pc. No need to launch Rhino. No wait time for Rhino/Grasshopper to load.
I’m new here too so I might be wrong!
@MonkeyFace Those are great use cases for rhino3dm and Rhino.Compute!
@marcellojs - good question! If you are getting into Rhino.Compute, it is most likely because you want to access Rhino functionality, but don’t want (or can’t) have Rhino installed on the machine.
First, let’s break things out:
RhinoCommon - Access all of the functions in Rhino including geometry creation and manipulation, intersections, booleans. You can also access the RhinoDoc to manipulate things like views, layers, etc and RhinoApp to do things with the UI. Use RhinoCommon when you are developing functionality to be used while running the Rhino application. If you have a situation where Rhino is installed and you want to create applications that run on that same machine and can take advantage of all of the Rhino functions without necessarily showing Rhino, you could use Rhino.Inside. That would give you access to all of RhinoCommon as well.
rhino3dm (aka openNURBS in c++, rhino3dmIO in c#, js, py) - Open and create Rhino 3dm files, create Rhino geometry. Use rhino3dm when you just want to read or write a 3dm file, for example, as import or export plugins to another application, a 3d web viewer, etc. As @MonkeyFace mentioned, rhino3dm is great in situations where Rhino isn’t or cannot be installed (Android, iOS, Linux, etc). rhino3dm does not have access to core Rhino functionality such as intersections, booleans, meshing, etc, and for obvious reasons, you cannot access RhinoApp since you aren’t running inside Rhino. If you need access to features in Rhino, but don’t have Rhino installed on the machine, you can call an instance of Rhino running on another machine with Rhino.Compute.
Rhino.Compute: Access most of the Rhino.Geometry namespace to calculate intersections, meshing, and other stuff not available in rhino3dm. All of these functions are available as REST API calls, but we create some helper libraries for .net, js, and python that wrap those API calls. You can also do remote solving of Grasshopper definitions and python scripts.
so you are not able to use the “local” RhinoCommon if you do not have Rhino installed on your machine? why would the sample I showed early access the local Rhino api?
why are most but not all of the rhino.geometry calls within Rhino.Compute?
am I understanding this correctly?
Correct. rhino3dm is a subset of RhinoCommon (mostly Rhino.FileIO) and should include most of everything that is in openNURBS, including objects, such as circles.
If something is missing from Rhino.Geometry in Rhino.Compute, it might be because we haven’t found the right way to add it. If there is anything missing that you need access to , let us know.
I didnt see anywhere in Rhino.Compute where points could be created. Is that possible?
You don’t need compute to create points - you can do this using RhinoCommon (Rhino3dmIO).
Hi I am still not understanding this.
If you say use RhinoCommon to make the points
does this mean you do not need rhino installed on your machine to run the RhinoCommon
api such as creating points or creating breps?
If you do not need rhino installed to run rhinocommon api commands like new point3d(x,y,z) or create a new brep, why use Rhino.Compute to make breps? could you clarify? I may be mixing rhinocommon with rhinocompute. thanks
however Luis @MonkeyFace said here that you only use rhino common which includes creating points when you run rhino application. Thanks
Outside of the Rhino application, you create geometry with rhino3dm. If you need to calculate something from outside of Rhino, like trimming a surface with a curve, then you use compute.
let pt = [1, 2, 3];
Maybe it would be best to work on an example. Do you have some code to share so we understand what you want to do?
Sorry about all of the confusion. We are going to try and update our documentation to be clearer on this subject.
This sample is composed of three “things”:
- the sample code in Program.cs
- a reference to Rhino3dmIO assembly
- an extra c# file called RhinoCompute.cs
The reference to Rhino3dmIO contains all of the operations and classes that you can execute local.
The RhinoCompute.cs file contains all of the functions that require calling a Rhino Compute server. We can add more functions to this file if you find things that you need are missing.
I am just trying to learn about rhino.compute i dont have a sample code that i created i am using the sample code that you put on the github site. as shown in the image at the start of this post.
I am also not a seasoned rhino developer and I am only just getting started with rhino api but I plan to learn and help show others the benefits of rhino.compute. so perhaps we need to have an offline conversation where you could walk me thru the sample file so I could better understand the need for using rhino.compute. It seems I keep asking the same questions and not getting clear answers and It is because I am not explaining myself very clearly … so here are the questions so I could better understand. thanks!!!
Say my ultimate goal is to create a sphere of raduis 1 and at origin and show it on google chrome (But for simplicity lets skip the google chrome part) and say I am connected to a server that is not on my computer and I do NOT have rhino installed on my machine.
- say I want to make a point using the method new Rhino.Geometry.Point3D(0,0,0) do I need to have rhino installed on my computer. yes or no?
- say I want to make a sphere would I use the method new Rhino.Geometry.Sphere(pt, radius), or would I use Rhino.Compute.BrepCompute.CreateBaseballSphere(pt,radius,tol)? and why would I use that particular create sphere method.
- I want to display that sphere on chrome which sphere would I use?
I think I am confused on which method to use …
the RHINO3dmIO “local” methods or
the Rhino.Compute methods.
I think that needs to be clarified
and I keep thinking that IF I DO NOT have Rhino installed on my machine I can not USE the RHINO3DMIO “local” methods.
your clarity would help thanks!!!
I think the most relevant part is the fact that you want to display the geometry on google chrome.
If you work backwards from your goal you need - I assume- a sphere mesh to display on chrome.
If you want a mesh sphere created from your nurbs sphere you will need a means to convert that nurbs to a mesh representation of it. For that you need Rhino.Compute and for that you need a Rhino licence and access to a local rhino installation or a rhino compute server.
Someone please correct me if I’m worng.
Rhino3dm (we are soon dropping the IO part) does not require Rhino to be installed on your computer.
OK now we are getting somewhere
To run RhinoCommon methods you would need rhino installed on your machine
To run Rhino3DM methods you would NOT need rhino installed on your machine
To run RhinoCompute methods you would NOT need rhino installed on your machine
so far so good?
a few simple questions then
why is every method in RhinoCommon not in Rhino3dm?
and for that matter
why is every method in Rhino3dm not in RhinoCompute?
is that not the purpose of RhinoCompute? to run Rhino outside or Rhino when it is not installed?
and it looks like that there is OVERLAP with some methods in RhinoCompute and Rhino3dm?
so with that said
if I wanted to run a method that was both in RhinoCompute and Rhino3dm and Rhino was not on my machine then I would never need to use RhinoCompute?
Yes if all you need is methods that are available in Rhino3dm than you have no need for RhinoCompute or a Rhino license.
Why is not all available in both Rhino3dm and RhinoCompute: because Rhino3dm is free and primarily a means to read and write 3dm files. RhinoCompute is capable of geometric computations with propriatary code and as such not free and available in a separate API
Does that make sense?
Yes makes sense
But it seems to me still very confusing and Very
“here and there” if I had to explain it to someone who is wondering what rhimo.compute is…
With the vision of rhino.inside it was a great step forward in placing rhino inside another program
Rhino.compute builds on that to run anywhere without rhino installed…brilliant
But It seems to me there should be one Api
Rhino.Anywhere or whatever you call it
It has all methods from
rhinocommon rhino3DM and rhino compute and it could be used anywhere on the planet any computer anywhere inside any program
I know that’s not easy to do and the pricing model would clash against that
But for now you have to piece it together with different rhino APIs instead of one universal api
And it’s hard to know which one to use
quite honestly perhaps as more examples get produced it’ll become more clear
I considered including the compute calls in rhino3dm, but decided it was clearer to have a distinction between what was running local versus remote.
We’ve also discovered that there are many scenarios where you shouldn’t be directly calling compute and instead should be working through a web server that communicates with compute. I ran a workshop on this topic (linked below):