1×1 unit example code and diagram
From Pete:
I put together a base template for a 1×1 unit which will transition easily into a multi unit version fairly easily. I made a quick diagram for you to post as well to help clarify some of the code.
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 | Option Explicit 'Script written by Peter VanHage 'vanhage@gmail.com 'created / revised on: Tuesday, February 26, 2008 '<<< script explanation goes here>>> Call Main() Sub Main() Dim strSurfaceID: strSurfaceID = rhino.getobject("select surface to deploy module on",8) If isNull(strSurfaceID) Then Call rhino.print("NO SURFACE SELECTED") Exit Sub End If Call reparameterizeSrf(strSurfaceID) Dim u,v u=1 v=1 Call drawUnit(strSurfaceID,u,v) End Sub Function drawUnit(strSurfaceID,u,v) 'here is where you create the points for your single unit Dim a2,b2,c1,c3,d2,e2 a2 = rhino.EvaluateSurface(strSurfaceID,array(0,0.5*v)) b2 = rhino.EvaluateSurface(strSurfaceID,array(0.25*u,0.5*v)) c1 = rhino.EvaluateSurface(strSurfaceID,array(0.5*u,v)) c3 = rhino.EvaluateSurface(strSurfaceID,array(0.5*u,0)) d2 = rhino.EvaluateSurface(strSurfaceID,array(0.75*u,0.5*v)) e2 = rhino.EvaluateSurface(strSurfaceID,array(u,0.5*v)) 'now you must create a polyline through the specific points to create the desired shape, in this case a diamond within a diamond Dim diamond_01,diamond_02 diamond_01 = rhino.AddPolyline(array(a2,c1,e2,c3,a2)) diamond_02 = rhino.AddPolyline(array(b2,c1,d2,c3,b2)) End Function Function reparameterizeSrf(strSurfaceID) Call rhino.SelectObject(strSurfaceID) Call rhino.Command("reparameterize 0 1 0 1") Call rhino.UnselectAllObjects() End Function |
Popularity: 9% [?]
Related Content
























No Comments, Comment or Ping
Reply to “1×1 unit example code and diagram”
You must be logged in to post a comment.