Rhino.Script: Array around curve
The following script allows you to array an object around a curve and designate a rotation.
You will need to do the following to execute the script
1. Select an object.
2. Set the “cplane” by designating 3 points (origin, X, Y)
2. Select a “curve” the array will occupy
3. Select the # in your array
4. Designate the degree of rotation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | Option Explicit'Script written by David Mans http://www.neoarchaic.net 'Script copyrighted by core.form-ula under Creative Commons 'Script version Tuesday, September 09, 2008 2:59:56 PM Call Main() Sub Main() Call arrayRotateAboutCurve() End Sub Function arrayRotateAboutCurve() arrayRotateAboutCurve = Null Dim i,j, objects,angle, originPln, steps, curve, pt(2), dom, crvFrame, rotFrame objects = Rhino.GetObjects("Select Objects") If isNull(objects) Then Exit Function pt(0) = Rhino.GetPoint("Select Origin Point") If isNull(pt(0)) Then Exit Function pt(2) = Rhino.GetPoint("Select Point for X Axis") If isNull(pt(2)) Then Exit Function pt(1) = Rhino.GetPoint("Select Point for Y Axis") If isNull(pt(1)) Then Exit Function originPln = Rhino.PlaneFitFromPoints(pt) curve = Rhino.GetObject("Select Curve",4) If isNull(curve) Then Exit Function steps = Rhino.GetReal("Count",10) If isNull(steps) Then Exit Function angle = Rhino.GetReal("Rotational Increment", 15) If isNull(angle) Then Exit Function Call Rhino.EnableRedraw(False) Call rhino.SelectObject(curve) Call rhino.Command("reparameterize 0 1") Call rhino.UnselectAllObjects() dom = Rhino.CurveDomain(curve)(1) For i = 0 To steps Step 1 crvFrame = Rhino.CurvePerpFrame(curve,(dom/steps)*i) rotFrame = Rhino.RotatePlane(crvFrame,angle*i,crvFrame(3)) For j = 0 To uBound(objects) Step 1 Call Rhino.OrientObject(objects(j),pt,array(rotFrame(0),Rhino.PointAdd(rotFrame(0),rotFrame(1)),Rhino.PointAdd(rotFrame(0),rotFrame(3))),1) Next Next Call Rhino.EnableRedraw(True) End Function |
![]()
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Popularity: 18% [?]
Related Content

























No Comments, Comment or Ping
Reply to “Rhino.Script: Array around curve”
You must be logged in to post a comment.