Grasshopper

algorithmic modeling for Rhino

I can see in the SDK

point3d Properties

Gets or sets the Z (third) coordinate of this point.

Namespace: Rhino.Geometry
Assembly: RhinoCommon (in RhinoCommon.dll) Version: 5.1.30000.5 (5.0.20693.0)

Collapse imageSyntax

C#

public double Z { get; set; }
then it could be possible to set new z to any point .
however if I try

private void RunScript(Line exampleLine, double z, ref object A)
{
exampleLine.PointAt(0).Z = exampleLine.PointAt(0).Z + z;
A = exampleLine;


}

the answer is  " cannot modify the value because is not a var"
what Im missing?
what's wrong?

Views: 563

Attachments:

Replies to This Discussion

PointAt() is simply a method that gives the Point3d at a particular parameter of the line. It does give any provision to change the properties of the line at that parameter.

If you create a new point at that parameter

Point3d newPt = exampleLine.PointAt(0);

then you can change/set the Z co-ordinate of newPt. This is what is explained in the SDK by 

public double Z { get; set; }

In order to change the Z co-ordinate of the start point of exampleLine, try this

private void RunScript(Line exampleLine, double z, ref object A)
{
   exampleLine.FromZ = exampleLine.From.Z + z;
   A = exampleLine;
}

 

thanks for your answer.

very clear.

PointAt() returns a reference value ?

In plain English, yes, you could say that.

What is important to understand from the SDK is what properties of Line can be "set". These are From point, To point, FromX co-ordinate, FromY co-ordinate, etc.

Based on this, you can change the start point with

exampleLine.From = newPoint;

Similarly, you can change its co-ordinate with

exampleLine.FromX = newCoordinate;

But again, if you try

exampleLine.From.X = newCoordinate;

this will not work, because Line does not have a method or property to "set" the co-ordinate in this manner.

I hope this helped to understand things better!

Ooops, I meant to say "It does NOT give any provision to change the properties..." :)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service