Grasshopper

algorithmic modeling for Rhino

C# Cast Rhino.Geometry.Circle to Rhino.Geometry.GeometryBase?

Im sure this is a glairing oversight on my part, but how do you cast a circle to a GeometryBase in C#?

Views: 729

Replies to This Discussion

You can't. Circles are structs and do therefore not derive from GeometryBase. You need to create an ArcCurve (which is derived from Curve which is in turn derived from GeometryBase). Circle itself has a ToNurbsCurve method which you can also use, but I recommend constructing an ArcCurve instead.

Ah! I knew it was stairing me in the face the whole time!  I did the same thing with Arcs > ArcCurve and Line > LineCurve, I just missed that ArcCurve had a constructer that took an input of a Circle...

For anyone who has a similar problem, here was my solution:

GeometryBase myNewGeometryBase = new ArcCurve(myExistingCircle);

And once again, Thank you Dave!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service