Grasshopper

algorithmic modeling for Rhino

Hi all

Could someone tell me if it is possible to access the line segments of a polyline object using vb scripting or if you have to create your "own" line segments from the corner points perhaps?

/Thomas

Views: 461

Replies to This Discussion

In short, the answer is that you have to create your own, but in reality that's not actually that much of an issue. The main reason for this is that both OnPolyline and OnPolyLineCurve are really nothing more than an array of points that represent each vertex in the polyline.
Ok

Thanks Damien, that was kind of what i was expecting.

Now totally unrelated, isn't it possible to do vector arithmetics in vb? like multiplying a vector?

Dim new_vec as on3dvector = 5 * old_vec

This doesn't seem to work.

/Thomas
It should. Each class has a series of operators that are available for that class. Some (like a curve or brep) don't really have any, but the On3dPoint class and the On3dVector class have quite a few operators defined. Multiplication is one of them, so it should work. Maybe it just can't be done in the same line as the declaration, or maybe you still need to declare the vector with the New keyword.
It only worked for me by multiplying its components - but havn't tried doing it outside the declerations or using the New keyword. I'm gonna try this.

Thanks
If you want to multiply a vector with a number, try putting the vector first:

Dim new_vec As On3dVector = old_vec * 5

I don't think we added all the possible operator overloads to On3dVector and On3dPoint.
Ok...

It worked, thanks!!!

And i know it really just is a "lazy"-issue :D

It worked when i multiplied the x,y and z component of the vector individually.

Thanks

/t

I have been wondering the exact same thing! I know this thread is old, but has anyone figured out a way to do this yet? Is there a built-in or downloadable component that creates a series of discrete line segments instead of a continuous polyline?

Until now I've been using polyline and then immediately splitting it at all discontinuities. However, sometimes the polyline follows a straight line between segments, and without discontinuities I don't get segments anymore.

IGNORE ME, I'M STUPID. I walked to get some coffee and it hit me how easy it was. Created a really simple component to do this from now on. It's going to get a lot of work done easy.

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