If extrusion object IsCylinder

According to the documentation Extrusions have an IsCylinder method, but in my code it is says an ExtrusionObject has no such attribute…? I guess I need to break it down first? Or do I need to cast the extrusion differently?

Hi Jim,

What documentation did you read that in, I cannot find it here:
https://developer.rhino3d.com/api/RhinoCommon/html/Properties_T_Rhino_Geometry_Extrusion.htm

For surfaces there is an IsCylinder method:
https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_Geometry_Surface_IsCylinder.htm

-Willem

Hi @JimCarruthers,

You have two different things here.

Extrusion class inheritance:

System.Object
  Rhino.Runtime.CommonObject
    Rhino.Geometry.GeometryBase
      Rhino.Geometry.Surface
        Rhino.Geometry.Extrusion

ExtrusionObject class inheritance:

System.Object
  Rhino.Runtime.CommonObject
    Rhino.DocObjects.ModelComponent
      Rhino.DocObjects.RhinoObject
        Rhino.DocObjects.ExtrusionObject

The former has an IsCylinder method, but the error message implies you are using the latter which doesn’t.

EDIT: Use ExtrusionObject.Geometry in order to get to the Extrusion object.

HTH
Jeremy

1 Like

Thanks!

Don’t forget you can also cast the Extrusion to a Brep - my_extrusion.ToBrep() - and then check the face(s) for a cylinder…