Grasshopper

algorithmic modeling for Rhino

Hello guys,

 

Im not seeing the possibility in the SDK to either:

 

A. Create a surface with a set of control points, while retaining weight info

B. Manipulate the weight of the control points of a NurbsSrf

 

 

thanks for any help

Views: 9084

Replies to This Discussion

Hi Brendon,


NurbsSurface has a Points property which provides access to the control-points. You can both get and set control-points via NurbsSurface.Points. A control-point can have a weight assigned to it, so it would seem this is possible. But I've never tried this before so I'm not certain.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hey Brendon,

how are you?! It's been a while!

Thought it was a nice idea so I gave it a shot.

Don't know what you were planning to do so I just created a simple example with an attractor point.

One thing: it doesn't seem to work when all weights of the InputSrf are set to 1 (just tweak one points' weight a tiny little bit). There should be another way in .NET but I haven't found it in the RhinoCommon help.

 

Greetings from Amsterdam,

Marc

 

Attachments:

Hey Marc!   

 

going well, I'm actually in Rotterdam right now for a few days but not going to make it to Amsterdam on this trip. You still at UN?

 

Thanks for the example. I was just about to get into it again so ill take a look at what you worked out.

 

hope all is good !

 

Brendon

hi brendon,
i previously did some experiments with curve weight in c# with the new RhinoCommon SDK. Its pretty interesting how it works. You can access all the Control Points thru this SDK and modify them how David mentioned it. So i did the same with a NurbsSurface. On the attached script you can see all the necessary code and i commented all the important steps.

A. you create your Surface in Rhino or Grasshopper
B. The C# node gives you all the control points of the surface + weight value (display on 3d-Tags)
C. You can access single Control-Points and weight them.

There is just one big Problem. And its really strange. As you weight a control Point either in Rhino manually or in Grasshopper the Control Points move virtually in space. You will see what i mean just try it. The Result: the Grasshopper weight makes some strange results that are not the same as the manual weight in Rhino. I hope this script helps you anyway to understand the mechanics of what you want to do.

To solve the one Problem maybe David can help you out.

Best regards, good work and don't hesitate to contact me if you need some help
Attachments:
Hi Florian,
The Problem is the way that Rhinocommon deals with control points.
In rhino control points are pre-multiplied whereas in RhinoCommon they are euclidian coordinates.
That means that you have to multiply the x,y,z coordinate with the weight to get the proper coordinate in Rhino. Just have a look at my script I uploaded as an anser to brendons question. Here you'll find the line of code that where I multiply the weight to the coordinates.

Marc

This must be a bug, Rhino itself uses different kinds of control-point, but we've been trying to make RhinoCommon work just as the Weight command in Rhino.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

I just checked in changes to this. The next release of Grasshopper and RhinoCommon for Rhino5 will treat Surface control-points in the same way as Curve control-points. I.e. you will no longer have to worry about adjusting the location based on the weight.

 

I realize this will break existing code, sorry.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks Marc, thanks David
Multiply the x,y,z might be a solution as a workaround and works pretty good.
Once a point is weighted and later on u want to reweight again maths is needed and it shouldn't be like this. For example the control point weighting on curves works well without messing with point multiply and works with the same ControlPoint class.
So thanks if this will be solved in RhinoCommon as i remember in the old OpenNurbs it was the same prob
Greetings and have all a nice day

Hi Brendon,

I wanted to know if you find out how to create a Surface with a set if control points or not. If yes, could you please tell me how! I am struggling with that for a couple of days!

Thanks

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service