Rhino.geometry namespace

So I’m trying to write a python script for rhino and when I use the rhinoscriptsyntax namespace everything works well, but when I use rhino.geometry nothing appears on the screen, even tough the code seems to be working just fine.

Is there an extra step to get that geometry from rhino.geometry into rhino that I’m not aware? Maybe a “draw” function or something?

Sorry for the basic question, first time using rhino API here.

Hi Robneto - - Rhino geometry created in a script (Rhino.Geometry.Whatever) exists only in the script, so to speak, until it is added to the document - using for example, scriptcontext.doc.Objects.AddBrep(your brep geometry) followed by a redraw - scriptcontext.doc.Views.Redraw() - there is much more than that but it is along those lines. The reason that rhinoscript functions ‘work’ is that they take care of all the behind the scenes adding to the document part and your script for the most part only deals with guids of objects that exist in the document, not the more abstract underlying geometry.
Here’s an example -

scroll down for the python script example.

-Pascal

1 Like

so geometry created using rhino.geometry namespace needs to be added to the document by a separate function while rhinoscriptsyntax is automatically added to it, is that it?

In short, yes, exactly. Keep in mind too that you do not need to add geometry to the document if you are only using it for calculation - for instance, you can get say, a brep face edge as a nurbs curve and make a pipe or an offset from it - you do not need to actually add the curve as an object to the document, just the result you want - the pipe or offset.
-Pascal

2 Likes

Got it, thanks, that was very helpful!