Grasshopper

algorithmic modeling for Rhino

Hi,

I want to move point on curves, using vector to determine the midpoint of my hanging mobile based on loads on either side. I can do that in line but i could not do that in curves.

can anyone help me with this

Views: 1830

Replies to This Discussion

You can access (get/set) the control vertices of a curve like so:

myCurve.Points.Item[cvIndex] = newPoint

Here you access the NurbsCurvePointList of the curve named myCurve. Get the control vertex at the integer named cvIndex. Set this control vertex to a point named newPoint.

Hope that helps..

hi, actually I want to move the line created from points in curves: here i can move the cable on 

line but could not move in curve

def mobile():
#define variable

pt1 = (0,0,0)
pt2 = (6,0,3)
pt3 = (12,0,0)
point = rs.AddPoint(pt1)
point2 = rs.AddPoint(pt2)
point3 = rs.AddPoint(pt3)

points = (point,point2,point3)
line =rs.AddCurve(points)



#find start, end, and line length
start = rs.CurveStartPoint(line)
end = rs.CurveEndPoint (line)
linelength = rs.CurveLength (line)

# add car loads
carload1_endpt = rs.VectorAdd(start,(0,0,-15))
carload1 = rs.AddLine(start,carload1_endpt)

carload2_endpt = rs.VectorAdd(end,(0,0,-15))
carload2 = rs.AddLine(end,carload2_endpt)

#at end o fline make 2nd level line

newendpt= rs.VectorAdd (start, (0,10,0))
twoline =rs.AddLine (start, newendpt)
newendpt2= rs.VectorAdd (start, (0,-10,0))
twoline2 =rs.AddLine (start, newendpt2)


#find center of even load distribution

midpoint= ((linelength*car2)/(car1+car2))
print midpoint
mid = rs.VectorAdd (start,(midpoint,0,0))

mid = rs.AddPoint (mid)

#make line at load center point
mid_endpt = rs.VectorAdd(mid,(0,0,15))
midend = rs.AddPoint(mid_endpt)
print mid_endpt
mid_line = rs.AddLine(mid, mid_endpt)

return (line, carload1, carload2, mid, mid_line,twoline,twoline2)

I hope you understood what am asking for..

Afraid not. It is generally easier to troubleshoot if you can narrow down the problem to its most basic case and/or provide a GH file to test from. Hope that makes sense :)

Edit: Oh wait, are you looking to get a point on a curve at a given parameter or length. If so you can use:

pt = myCurve.PointAtNormalizedLength(tValue)

or

pt = myCurve.PointAtLength(lenValue)

You can look up more methods and properties in the RhinoCommon SDKhere.

find my attachment . I want to move the point on curve not on the line. the point moves with the respect to car values

Attachments:

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service