Grasshopper

algorithmic modeling for Rhino

So simply,i want to know how it's possible to get a new NurbSurface by the method SetControlPoint() in the NurbSurface sub, if i understand well 3 inputs are required 2 integers and 1 ControlPoint, but like it's expected by IntelliSense i got a boolean :( with no error ... but i just need a new nurbs srf any sugestion ?

below Srf as Surface, U and V as int et Pt1 as ControlPoint

<code>

Srf.ToNurbsSurface().Points.SetControlPoint(U, V, Pt1);

</code>

Views: 534

Replies to This Discussion

Hi Julz,

because ToNurbsSurface() returns a new surface, you should store that in a new variable and work from there. With this single statement, the new surface that you might achieve to modify is anyways lost.

Cheers,

- Giulio
________________
giulio@mcneel.com

Hi Giulio, thanks for the answer ,
Probably there is something that I don't understand... the line return a Boolean not a new NurbsSurface ...
So, the question still :( how it's possible to get a surface as output and not a boolean ?

How about this:

NurbsSurface ns = input_srf.ToNurbsSurface(); //stores new surface
ns.Points.SetControlPoint(a, b, c);
//...
A = ns; //do not return input_srf

Cheers,

- Giulio
________________
giulio@mcneel.com

Thanks Giulio that work perfectly now !my pb came from a static control point, thanks again.
For information maybe there is a problem under the ControlPoint.location.Transform(Transform.Rotation(a,b,c)); thanks again.

Is this a question? Can you upload a sample please?

Thanks,

- Giulio
________________
giulio@mcneel.com

Here the "bug" isolation, hop that can help... Thanks again Giulio.

Attachments:

This is very tricky, but there is no bug here at first sight. The tricky part is that Point3d is a value type.

See Value Types and Reference Types on Msdn for more information.

On line 116 you are modifying (with the Transform method) a copy of the Location of Pt1, and not the Location of Pt1 itself. Location can only be modified by assigning a new value to it, like this:

Pt1.Location = somePoint;

This is a rule in C# (and Vb.Net), and is somehow similar to the problem in the first post, where a copy was modified. To avoid this, I have a small suggestion: it often helps to write only one expression part per line, and use well named variables to store their results.

- Giulio
________________
giulio@mcneel.com

Thanks Giulio, for taking the time to explain, it's a little bit more clear for me now :)
I have also another question : what's the best way for computing the v normal of a ControlPoint ? I have used the ClosetPoint but not sure that is very accurate any suggestion ?

Hi Julz,

I cannot answer the question above directely because it is nested too deeply. Also, I am not so sure what the v normal of the ControlPoint is.

Can you start a new thread with that question? Maybe with a small diagram: that would really help.

Thanks,

- Giulio
_______________
giulio@mcneel.com

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service