C# data types




I have a question. I could not find the answer.

In one of the code example on the website, we have a line:
Add annotation text:

Rhino.Geometry.Plane plane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane();

But when I replace it to this I will get an error.

Rhino.Geometry.Plane plane = Rhino.Display.RhinoViewport.ConstructionPlane();

I am looking for the topic of this error. I just have not found it yet. I searched under “custom type access c#” , “accessing classes” keywords etc.


Is it the answer?

This method is instance, not static?

(jesterKing) #3

If you check the API documentation for RhinoViewport and scroll down to the method ConstructionPlane() you’ll find that it indeed is an instance method - most are. Mousing over the icon also tells you that:

Static methods on a class overview are marked with a fat superscript s:

ActiveViewport gives you an instance of RhinoViewport. If you want a different viewport than you’ll have to get the parent view from the views table doc.Views from the example and then use the ActiveViewport property.


Thanks jesterKing,