Grasshopper

algorithmic modeling for Rhino

If I explode a rectangle in gh I will obtain four segments

 

however if I use a rectangle "rec"

Polyline p = new Polyline (rec.ToPolyline());

 

and look for the number of segments

 Print ( p.count.ToString());

I see five,

 

why?

Views: 750

Replies to This Discussion

What does 'SegmentCount' give you?

The first and last points will be the same. This is what makes the polyline closed.  Have a look at the actual implementation of ToPolyline in the Rectangle3d class and it should help clear up what is going on

https://github.com/mcneel/rhinocommon/blob/master/dotnet/opennurbs/...

 

By the way, your code will be slightly more efficient if you change it to

Polyline p = rec.ToPolyline();

 

Thanks,

-Steve

ok.

then p.Count get the really members of the list : point3d

however p.SegmentCount get segments.

yes, it returns for. thank you luis

steve,

thanks a lot

Im impressed of what github could help.

is all rhinocommon open there?

thanks for your sophisticated touch. I never had thought I could do that.

could I do the same with lists, arrays, even objects  of my own classes?

 

The C# portion of RhinoCommon is all on GitHub. The C++ part isn't to my knowledge.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Much of the C++ portion actually is on github now

https://github.com/mcneel/rhinocommon/tree/master/c

This is the portion that would be necessary to build a version of RhinoCommon against OpenNURBS.

 

-Steve

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service