Grasshopper

algorithmic modeling for Rhino

Hi,

I am having a lot of difficulty figuring out how to access and add control points to a given NursSurface imported from Rhino.  Does anyone know how I can array a specific number of control points evenly across a given NurbsSurface so then I can move them to rebuild the surface?

Thanks,

John

Views: 892

Replies to This Discussion

i think this is a way of doing it:

import ghpythonlib.components as ghcom

ptList = ghcom.DivideSurface(inputSurface,10,10).points

## you can manipulate the ptList here

## then form a surface from the points again

ouputSurface = ghcom.SurfaceFromPoints(ptList,11)

and i think this is another way of doing it:

import rhinoscriptsyntax as rs

u_count, v_count = 10,10
du = rs.SurfaceDomain(srf,0)
dv = rs.SurfaceDomain(srf,1)

ptList = []
for u in rs.fxrange(du[0],du[1],(du[1]-du[0])/u_count):
    for v in rs.fxrange(dv[0],dv[1],(dv[1]-dv[0])/v_count):
        ptList.append(  rs.EvaluateSurface(srf,u,v)    )

## you can manipulate the ptList here

a = rs.AddSrfControlPtGrid((u_count+1,v_count+1),ptList)

unfortunately i don't know how to implement this in c# .. but Anders's comment is helpful though, so goodluck

i also attached my try to mimic the cover of this book. by the way, python can be read easily i think if you try, you would understand it.

Attachments:

While I'm no C# expert I've attached the most basic case for setting a NurbsSurface control point. Now you just need to add a loop ;)

Attachments:

You can look up the methods and properties of a NurbsSurface in the RhinoCommon SDK. What you are looking for is probably a NurbsSurfacePointList which you can access by calling the Points property of your Nurbs surface. There are also some examples in there in C#, VB and Python. Hope that helps..

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