Grasshopper

algorithmic modeling for Rhino

I am using the following code in C#


  private void RunScript(int x, Curve crv, ref object A)
  {



    Point3d points;

    crv.DivideByCount(x, True, points);

    A = points;





    //your code here…
  }



I am getting the Error: The name 'True' does not exist in the current context. Help would be greatly appreciated




This is the documentation of Rhino Common I am using:

Collapse imageSyntax

C#
public double[] DivideByCount(
int segmentCount,
bool includeEnds,
out Point3d[] points
)
 


Views: 2689

Replies to This Discussion

I think it will work if you change "True" to "true".
Thanks for the reply Javier, I am still getting an error, but a different error. If you get a chance take a look at my file.
Attachments:
There is your code without any mistake. Point must be declared like free array " = new Point3d[0]" because DivideByCount can return more then only one point. "out" is a signal for void , using if you need make refernece from inside of void

http://msdn.microsoft.com/en-us/library/t3c3bfhx%28VS.80%29.aspx

Jachym
Attachments:
Thank you very much Jachym, this is very helpful!
Here is an updated reply of how to use the method .DivideByCount.

In the C# component:

private void RunScript(int x, Curve crv, bool toggle, ref object A)
{
Point3d[] newPoints = new Point3d[0];
crv.DivideByCount(x, toggle, out newPoints);

A = newPoints;
}

For further documentation:
https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_G...

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service