02.25.16 – David Aldana

Screen Shot 2016-02-25 at 11.16.00 AM

 

import rhinoscriptsyntax as rs
#Author: David Aldana
#Date: 01.22.16
#Purpose: Demostrate how to write a skeletal code
#Input Parameters: None
#Output Parameters: None
def addRoots():
"""
Purposes: It will add a foundation geometry
Order:Roots done from left to right and bottom to top
"""

point0= 1,1,0
point1=1,6.5,0
point2=3.934,10,0
points=point0,point1,point2
curve1 = rs.AddCurve(points)

""" attempt to create sweep with ellipses
"""
center = 1,1,0
sec = 0.8,1.10,0
thr = 1,1,.3
e1 = rs.AddEllipse3Pt(center,sec,thr)

center = 3.934,10,0
sec = 3.6,11.347,0
thr = 3.934,10, 1
e2 = rs.AddEllipse3Pt(center,sec,thr)

rail = curve1
shapes = e1,e2
rs.AddSweep1(rail,shapes,closed=True)

"""I'm a genious and now the attempt is a reality. GO David!!!
"""

point3=2.5,1,0
point4=2.5,3.5,0
point5=5.585,7.002,0
points1=point3,point4,point5
curve6 = rs.AddCurve(points1)
""" I came back for you. even though you are tiny I do care for you 😉
sweep 7
"""
center = 2.5,1,0
sec = 2.3,1,0
thr = 2.5,1,0.3
e10 = rs.AddEllipse3Pt(center,sec,thr)

center = 5.59,7,0
sec = 5.35,7.4,0
thr = 5.59,7,0.5
e11 = rs.AddEllipse3Pt(center,sec,thr)

rail = curve6
shapes = e10,e11
rs.AddSweep1(rail,shapes,closed=True)

""" second attempt to create sweep with ellipses
"""
point6=7,1,0
point7=7.5,4,0
point8=5,8,0
points2=point6,point7,point8
curve2 = rs.AddCurve(points2)

point10=3,11,0
point11=3,15,0
points3=point8,point10,point11
curve3 = rs.AddCurve(points3)

point12=3,22,0
point13=9,25,0
points4=point11,point12,point13
curve4 = rs.AddCurve(points4)

center = 7,1,0
sec = 6.5,1,0
thr = 7,1,0.5
e4 = rs.AddEllipse3Pt(center,sec,thr)

center = 5,8,0
sec = 4.5,7.7,0
thr = 5,8,1.3
e5 = rs.AddEllipse3Pt(center,sec,thr)
""" sweep 2
"""
rail = curve2
shapes = e4,e5
rs.AddSweep1(rail,shapes,closed=True)

center = 3,15,0
sec = 1.5,15,0
thr = 3,15,1.5
e6 = rs.AddEllipse3Pt(center,sec,thr)
""" sweep 3
"""
rail = curve3
shapes = e5,e6
rs.AddSweep1(rail,shapes,closed=True)

center = 9,25,0
sec = 7.9,27,0
thr = 9,25,2.5
e7 = rs.AddEllipse3Pt(center,sec,thr)
""" sweep 4
"""
rail = curve4
shapes = e6,e7
rs.AddSweep1(rail,shapes,closed=True)

""" sweep 5
"""

start=9,25,0
end=14.04,27.48,0
line1 = rs.AddLine(start,end)

center = 14.04,27.48,0
sec = 12.88,29.52,0
thr = 14.04,27.48,2.5
e8 = rs.AddEllipse3Pt(center,sec,thr)

rail = line1
shapes = e7,e8
rs.AddSweep1(rail,shapes,closed=True)

""" sweep 6
"""

point14=14.04,27.48,0
point15=18.5,30,0
point16=20,35,0
points1=point14,point15,point16
curve5 = rs.AddCurve(points1)

center = 20,35,0
sec = 17.3,35.8,0
thr = 20,35,2.5
e9 = rs.AddEllipse3Pt(center,sec,thr)


rail = curve5
shapes = e8,e9
rs.AddSweep1(rail,shapes,closed=True)

"""so far so good champ
"""

""" sweep 8
"""
point17=15,1,0
point18=14,8,0
point19=9,12,0
points1=point17,point18,point19
curve7 = rs.AddCurve(points1)


center = 15,1,0
sec = 14.7,1,0
thr = 15,1,0.3
e12 = rs.AddEllipse3Pt(center,sec,thr)

center = 9,12,0
sec = 8.8,11.5,0
thr = 9,12,0.6
e13 = rs.AddEllipse3Pt(center,sec,thr)

rail = curve7
shapes = e12,e13
rs.AddSweep1(rail,shapes,closed=True)

"""sweep 9 & continuation of 8
"""
point20=5,16,0
point21=6.104,23,0
points4=point19,point20,point21
curve8 = rs.AddCurve(points4)

center = 6.1,23,0
sec = 5.2,23,0
thr = 6.1,23,0.9
e14 = rs.AddEllipse3Pt(center,sec,thr)

rail = curve8
shapes = e13,e14
rs.AddSweep1(rail,shapes,closed=True)

""" sweep 10
"""
point22=18,1,0
point23=16,11,0
point24=6.5,16,0
points5=point22,point23,point24
curve9 = rs.AddCurve(points5)

center = 18,1,0
sec = 17.8,1,0
thr = 18,1,0.2
e15 = rs.AddEllipse3Pt(center,sec,thr)

center = 6.5,16,0
sec = 6.34,15.7,0
thr = 6.5,16,0.4
e16 = rs.AddEllipse3Pt(center,sec,thr)

rail = curve9
shapes = e15,e16
rs.AddSweep1(rail,shapes,closed=True)


object= rs.GetObjects()
start= 20,1,0
end= 20,35,0
rs.MirrorObject (object,start , end, copy=True)

point25=20,50,0
point26=45,58,0
points6=point16,point25,point26
rs.AddCurve(points6)

object= rs.GetObjects()
start= 45,58,0
end= 45,1,0
rs.MirrorObject (object,start , end, copy=True)

addRoots()

def addTrunk():
"""
Purposes: It will add a foundation geometry
Order:Trunk done from left to right and bottom to top
"""
PA= 45,58,0
PB= 47,75,0
PC= 60,90,0
Points7= PA,PB,PC
rs.AddCurve(Points7)

PD=75,105,0
PE=78,125,0
Points8= PC,PD,PE
rs.AddCurve(Points8)

PF=63.54,93.70,0
PG=38,110,0
PH=25,140,0
Points9=PF,PG,PH
rs.AddCurve(Points9)

addTrunk()

def addBranches():


BA= 49.65,74.14,0
BB= 49,90,0
BC= 53.17,101.23,0
Points7= BA,BB,BC
rs.AddCurve(Points7)

BD= 66,126,0
BE=61,168,0
Points8= BC,BD,BE
rs.AddCurve(Points8)

BF= 46.09,107.92,0
BG= 16,97,0
BH= 8,108,0
Points9= BF,BG,BH
rs.AddCurve(Points9)

obj=rs.GetObjects()
rs.JoinCurves(obj)

object=rs.GetObject()
start=1,1,0
end=8,108,0
translation=end-start
rhs.CopyObject (object, translation)

addBranches()

def addLeaves():
pass
addLeaves()


def makeAMangrove():
addRoots()
addTrunk()
addBranches()
addLeaves()

makeAMangrove()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s