import rhinoscriptsyntax as rs allobjs = rs.AllObjects() rs.DeleteObjects(allobjs) initialv = "B" initialn = "P" sizeB = 30 sizeP = 25 hgtB = 20 hgtP = 30 dh = 2.0 sa = 2.75 sd = 0.15 #draw a closed curve #rs.Command("_Curve Degree=2 0,0,0 0,30,0 6,30,0 11.8,29, 15,26,0 16,22.3,0 15.1,18.6,0 12,16,0 16.1,13.2,0 17.6,8.7,0 16.7,4.7,0 13.2,1,0 9,0,0 close _Enter") #crv = rs.FirstObject(select=True) ##Buchstabe 1 mytext = rs.AddText(initialv, (0,0,0), height=sizeB, font="Comic Sans MS") crv = rs.ExplodeText(mytext, True) [0] rs.SelectObject(crv) #extrude the curve rs.Command("ExtrudeCrv Solid=No DeleteInput=Yes {} _Enter".format(hgtB)) #rs.UnselectObject(crv) srf = rs.FirstObject(select=True) #use handles to change NURBS shape rs.Command("-_Rebuild UPointCount=10 VPointCount=5 UDegree=3 VDegree=3 DeleteInput=Yes _Enter") rs.EnableObjectGrips(srf, True) """ pointlist = rs.ObjectGripLocations(srf) print pointlist for i,pt in enumerate(pointlist): cmd = "-Dot {} {} _Enter".format(str(i),str(pt)) rs.Command(cmd, False) """ rs.SelectObjectGrip(srf,29) rs.Command("-_Move 0,0,0 5,0,0 _Enter") rs.UnselectAllObjects() rs.SelectObjectGrip(srf,10) rs.Command("-_Move 0,0,0 -5,0,0 _Enter") rs.UnselectAllObjects() rs.SelectObjectGrip(srf,24) rs.SelectObjectGrip(srf,19) rs.Command("-_Move 0,0,0 -5,0,0 _Enter") rs.UnselectAllObjects() rs.SelectObjectGrip(srf,4) rs.Command("-_Move 0,0,0 4,4,0 _Enter") rs.UnselectAllObjects() rs.SelectObjectGrip(srf,49) rs.Command("-_Move 0,0,0 -4,0,0 _Enter") rs.UnselectAllObjects() rs.SelectObjectGrip(srf,2) rs.SelectObjectGrip(srf,7) rs.Command("-_Move 0,0,0 0,10,0 _Enter") rs.EnableObjectGrips(srf, False) #create contourlines in z-direction and extrude them rs.SelectObject(srf) rs.Command("Contour 0,0,0 0,0,1 {} _Enter".format(dh)) rs.Command("ExtrudeCrv Solid=Yes 0.3 _Enter") #create contourlines in x-direction and use the pipe command rs.SelectObject(srf) rs.Command("Contour 0,0,0 1,0,0 {} _Enter".format(sa)) rs.Command("Pipe {} _Enter".format(sd)) rs.UnselectAllObjects() rs.DeleteObject(srf) rs.DeleteObject(crv) ##Buchstabe 2 myletter = rs.AddText(initialn, (28,0,0), height=sizeP, font=("Lucida Console")) crv = rs.ExplodeText(myletter, True) [0] rs.SelectObject(crv) #extrude the curve rs.Command("ExtrudeCrv Solid=No {} _Enter".format(hgtP)) #rs.UnselectObject(crv) srf = rs.FirstObject(select=True) #use handles to change NURBS shape rs.Command("-_Rebuild UPointCount=10 VPointCount=5 UDegree=3 VDegree=3 DeleteInput=Yes _Enter") rs.EnableObjectGrips(srf, True) """ pointlist = rs.ObjectGripLocations(srf) print pointlist for i,pt in enumerate(pointlist): cmd = "-Dot {} {} _Enter".format(str(i),str(pt)) rs.Command(cmd, False) """ rs.SelectObjectGrip(srf,4) rs.SelectObjectGrip(srf,9) rs.SelectObjectGrip(srf,14) rs.SelectObjectGrip(srf,19) rs.SelectObjectGrip(srf,24) rs.SelectObjectGrip(srf,29) rs.SelectObjectGrip(srf,34) rs.SelectObjectGrip(srf,39) rs.SelectObjectGrip(srf,44) rs.SelectObjectGrip(srf,49) rs.Command("-_Move 0,0,0 4,4,0 _Enter") rs.UnselectAllObjects() rs.SelectObjectGrip(srf,0) rs.SelectObjectGrip(srf,5) rs.SelectObjectGrip(srf,10) rs.SelectObjectGrip(srf,15) rs.SelectObjectGrip(srf,20) rs.SelectObjectGrip(srf,25) rs.SelectObjectGrip(srf,30) rs.SelectObjectGrip(srf,35) rs.SelectObjectGrip(srf,40) rs.SelectObjectGrip(srf,45) rs.Command("-_Move 0,0,0 -4,0,0 _Enter") rs.UnselectAllObjects() rs.EnableObjectGrips(srf, False) #create contourlines in z-direction and extrude them rs.SelectObject(srf) rs.Command("Contour 0,0,0 0,0,1 {} _Enter".format(dh)) rs.Command("ExtrudeCrv Solid=Yes 0.3 _Enter") #create contourlines in x-direction and use the pipe command rs.SelectObject(srf) rs.Command("Contour 0,0,0 1,0,0 {} _Enter".format(sa)) rs.Command("Pipe {} _Enter".format(sd)) rs.UnselectAllObjects() rs.DeleteObject(srf) rs.DeleteObject(crv)