Here is the whole code.

```
from Rhino import *
from Rhino.Commands import *
from Rhino.Geometry import *
from Rhino.Input import *
from Rhino.DocObjects import *
from Rhino.Input.Custom import *
from scriptcontext import doc
import rhinoscriptsyntax as rs
import math
__commandname__ = "GenHull"
def StemLine(Input):
BaseLinePt = (-Input['Origin_Height']/(math.tan(Input['Bow_Rake_Angle']*math.pi/180.0)),0.0,0.0)
BowPt = ((Input['Depth']-Input['Origin_Height'])/(math.tan(Input['Bow_Rake_Angle']*math.pi/180.0)),0.0,Input['Depth'])
crvpts = [BowPt,BaseLinePt]
StemCrv = rs.AddCurve(crvpts,degree=3)
return StemCrv
def KeelLine(Input,StemCrv):
KeelStrtPt = rs.CurveEndPoint(StemCrv)
FwdPt = rs.CurveStartPoint(StemCrv)
KeelFlatEndPt = (Input['Midbody_Hull_XPos'],0.0,0.0)
SternPt2 = (FwdPt.X-Input['LOA'],0.0,Input['Prop_Clearance'])
SternRun = -math.cos(Input['Stern_Rise_Angle']*math.pi/180.0)
SternRise = math.sin(Input['Stern_Rise_Angle']*math.pi/180.0)
SternPt1 = (SternPt2[0]-SternRun*Input['Stern_Length'],0.0,SternPt2[2]-SternRise*Input['Stern_Length'])
KeelCrv1Pts = [KeelStrtPt,KeelFlatEndPt]
KeelCrv2Pts = [KeelFlatEndPt,SternPt1]
KeelCrv3Pts = [SternPt1,SternPt2]
KeelCrv1 = rs.AddCurve(KeelCrv1Pts,degree = 1)
KeelCrv2 = rs.AddInterpCurve(KeelCrv2Pts,degree = 3,knotstyle=2,start_tangent=(-1.0,0.0,0.0),end_tangent=(SternRun,0.0,SternRise))
KeelCrv3 = rs.AddCurve(KeelCrv3Pts,degree = 1)
KeelCrv = rs.JoinCurves([KeelCrv1,KeelCrv2,KeelCrv3],delete_input=True)
return KeelCrv
def BowProfFillet(Input,StemCrv,KeelCrv):
Crv1 = rs.coercecurve(StemCrv)
Pt1 = rs.CurveEndPoint(StemCrv)
Crv2 = rs.coercecurve(KeelCrv)
Pt2 = rs.CurveStartPoint(KeelCrv)
FilletCrvs = Curve.CreateFilletCurves(Crv1,Pt1,Crv2,Pt2,10.0,
True,True,True,0.001, 0.01)
doc.Objects.AddCurve(FilletCrvs[0])
#StemCrv = rs.JoinCurves(Crvs[0],Crvs[1])
#KeelCrv = Crvs[2]
print "pause"
return
"""
def SternLine():
#return SternCrv
def DeckLine():
#return DeckCrv
"""
def RunCommand( is_interactive ):
#inputs
Input = {'Beam' : 30,
'LOA' : 100,
'LWL' : 75,
'Depth' : 25,
'Origin_Height' : 7,
'Midbody_Hull_Length' : 20,
'Midbody_Hull_XPos' : -60,
'Midbody_Deck_Length' : 35,
'Midbody_Deck_XPos' : -67.5,
'Keel_Width' : 2,
'Bilge_Radius' : 3,
'Deadrise' : 1,
'Half_Entrance_Angle': 30,
'Bow_Rake_Angle' : 60,
'Bow_Radius' : 10,
'Prop_Clearance' : 6.5,
'Stern_Width' : 25,
'Stern_Length' : 4,
'Stern_Rise_Angle' : 7}
StemCrv = StemLine(Input)
KeelCrv = KeelLine(Input,StemCrv)
BowProfFillet(Input,StemCrv,KeelCrv)
if( __name__=="__main__" ):
RunCommand(True)
```