Findclippingplanesforviewport" method


#1

Hi,
I am trying to use “findclippingplanesforviewport” method as the below codes.
RhinoDoc doc = RhinoDoc.ActiveDoc; RhinoView viewe = doc.Views.ActiveView;
ClippingPlaneObject cpl = Rhino.DocObjects.Tables.ObjectTable.FindClippingPlanesForViewport(viewe.ActiveViewport);

but it gives the error “An object reference is required for the non-static field, method, or property”, why is it?

Thanks


(Menno Deij - van Rijswijk) #2

You should use doc.FindClippingPlanesForViewport(viewe.ActiveViewport)

The FindClippingPlanesForViewport method is an instance method, not a static method. If it were static you could use it like your code above. But now, you need an instance of the class RhinoDoc and call the method on that instance.


C# data types
#3

great, thank you :slight_smile:


#4

Sorry, It is still unclear

Do you mean:

doc.FindClippingPlanesForViewport(viewe.ActiveViewport)

or

doc.Objects.FindClippingPlanesForViewport(viewe.ActiveViewport)

because FindClippingPlanesForViewport comes from ObjectTables

https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_RhinoDoc.htm
https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_RhinoDoc_Objects.htm
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_Tables_ObjectTable_FindClippingPlanesForViewport.htm