import rhinoscriptsyntax as rs import random as ran import Rhino.Geometry as rg #weg weg weg damit allobjs = rs.AllObjects () rs.DeleteObjects (allobjs) rs.EnableRedraw (False) # Variablen definieren Geschosse = 3 #Anzahl Geschosse h = 3 #Geschosshoehe deck_h = 0.4 #Deckenstaerke spw = 5 #Spannweite des Stuetzenrasters Auskragung = spw/10 #ueberziehen der decke ueber stuetzenachse teil_x = 4 #Raster in x teil_y = 3 #Raster in y stu_d = 0.3 #Stuetzen staerke fund_h = 0.5 #Fundament hoehe fund_kl = 0.8 #Fundament Kantenlaenge #Ableitungen aus den Variablen: mitte = [spw*(teil_x-1)/2, spw*(teil_y-1)/2, fund_h] #Rasterpunkte deck_b = spw*(teil_x-1)+ 2*Auskragung #decken breite deck_l = spw*(teil_y-1) + fund_kl #decken laenge #Objekt Parameter definieren def make_box (insertion= [0,0,0], xsize=10,ysize=10,zsize=10): corners = [[0,0,0], [xsize,0,0], [xsize,ysize,0], [0,ysize,0], [0,0,zsize], [xsize,0,zsize], [xsize,ysize,zsize], [0,ysize,zsize]] box=rs.AddBox (corners) rs.MoveObject (box, (-xsize/2, -ysize/2,0)) rs.MoveObject (box, insertion) return (box) #aufstellen der fundamente mit jeweiligen Variablen def make_fund (spw=5.0, fund_kl = 0.8, fund_h = 0.5, teil_x=2, teil_y=3): fns = [] for i in range (teil_x): for j in range (teil_y): fns.append(make_box ([i*spw,j*spw,0 ], fund_kl, fund_kl, fund_h)) return (fns) #aufstellen der stuetzen mit jeweiligen Variablen def make_stu (spw=5.0, level = 0.7, stu_d = 0.2, h = 3.0, teil_x=2, teil_y=3): cls = [] for i in range (teil_x): for j in range (teil_y): cls.append(make_box ([i*spw,j*spw,level], stu_d, stu_d, h)) return (cls) #zeugen der Objekte -> ausspucken soids ins de bloecke fund = [] #liste fundamente stu = [] #liste stuetze deck = [] #liste decke fas = [] for i in range (Geschosse): mitte [2] = fund_h + i*(deck_h + h) level = fund_h + deck_h + (i-1)*(h+deck_h) if i == 0: make_fund (spw, teil_x=teil_x, teil_y=teil_y) else: stu.extend (make_stu (spw, level, stu_d, h, teil_x, teil_y)) deck.append (make_box (mitte, deck_b, deck_l, deck_h)) #auf layer zuweisen rs.AddLayer ("fundament") rs.LayerColor ("fundament", (2, 2, 2)) rs.ObjectLayer (fund, "fundament") rs.AddLayer ("stuetze") rs.LayerColor ("stuetze", (10, 10, 10)) rs.ObjectLayer (stu, "stuetze") rs.AddLayer ("decke") rs.LayerColor ("decke", (92, 87, 81)) rs.ObjectLayer (deck, "decke") ####################################### abst_u=deck_h + fund_h abst_o=2*deck_h + fund_h + h LB = 2 #Laufbreite STG_IK=0-Auskragung STG_AK=STG_IK-LB STG_AT_y=stu_d+spw pt=20 steigung=h/pt+1 ######################### STGAntritt=rs.AddLine((STG_IK,stu_d,abst_u), (STG_AK,stu_d,abst_u)) STGAustritt=rs.AddLine((STG_IK,STG_AT_y,abst_o), (STG_AK,STG_AT_y,abst_o)) lineID1=rs.SelectObject(STGAntritt) lineID2=rs.SelectObject(STGAustritt) """ """"""lineID1=rs.GetCurveObject("STG Antritt") lineID1=rs.GetCurveObject("STG Austritt") pt=rs.GetInteger("Stufenanzahl")"""""" def GetDividedPoints(crv,div): pts=[] parameters=crv.dividebycount(div,True) for t in parameters: pt=crv.PointAt(t) pts.append(pt) return pts def getbottompoints(pts): bottomPts=[] prevZCoord=pts[0].Z for pt in pts[1:]: bottompoint=rg.Point3d(pt.X,pt.Y,prevZCoord) prevZCoord=pt.Z return bottomPts def MakeLines(pts1,pts2): lines=[] for pt1, pt2 in zip(pts1,pts2): line=rg.LineCurve(pt1,pt2) lines.append(line) return lines def MakeLoftSurfaces(lines1,lines2): for line1, line2 in zip(lines1,lines2): lines=[line1,line2] rs.AddLoftSrf(lines) return line1=rs.coercecurve(lineID1[0]) line2=rs.coercecurve(lineID2[0]) rail1=rg.LineCurve(line1.PointAtStart, line2.PointAtStart) rail2=rg.LineCurve(line1.PointAtEnd, line2.PointAtEnd) topPts1= rs.DivideCurve(rail1,pt) bottomPts1=getbottompoints(topPts1) topPts2= rs.DivideCurve(rail2,pt) bottomPts2=getbottompoints(topPts2) topLines=MakeLines(topPts1,topPts2) bottomLines=MakeLines(bottomPts1, bottomPts2) MakeLoftSurfaces(topLines[1:],bottomLines) MakeLoftSurfaces(topLines[:-1],bottomLines) """ ######################################################################### """linieID1=rs.AddLine((STG_IK,stu_d,abst_u), (STG_AK,stu_d,abst_u)) linieID2=rs.AddLine((STG_IK,STG_AT_y,abst_o), (STG_AK,STG_AT_y,abst_o)) def GetDividedPoints(crv,div): pts=[] parameters=crv.dividebycount(div,True) for t in parameters: pt=crv.PointAt(t) pts.append(pt) return pts def getbottompoints(pts): bottomPts=[] prevZCoord=pts[0].Z for pt in pts[1:]: bottompoint=rg.Point3d(pt.X,pt.Y,prevZCoord) prevZCoord=pt.Z return bottomPts def MakeLines(pts1,pts2): lines=[] for pt1, pt2 in zip(pts1,pts2): line=rg.LineCurve(pt1,pt2) lines.append(line) return lines def MakeLoftSurfaces(lines1,lines2): for line1, line2 in zip(lines1,lines2): lines=[line1,line2] rs.AddLoftSrf(lines) return line1=rs.coercecurve(linieID1, 0, False) line2=rs.coercecurve(linieID2, 0, False) rail1=rg.LineCurve(line1.PointAtStart, line2.PointAtStart) rail2=rg.LineCurve(line1.PointAtEnd, line2.PointAtEnd) topPts1= rs.DivideCurve(rail1,pt) bottomPts1=getbottompoints(topPts1) topPts2= rs.DivideCurve(rail2,pt) bottomPts2=getbottompoints(topPts2) topLines=MakeLines(topPts1,topPts2) bottomLines=MakeLines(bottomPts1, bottomPts2) MakeLoftSurfaces(topLines[1:],bottomLines) MakeLoftSurfaces(topLines[:-1],bottomLines)""" ######################################################################## """#lineid mochn lineID1=rs.GetCurveObject("Stiegen Eintritt") #Anfangsstufe lineID2=rs.GetCurveObject("Stiegen Austritt") #Endstufe count=rs.GetInteger("Stufen Anzahl")#Anzahl Stufen""" linieID1=rs.AddLine((STG_IK,stu_d,abst_u), (STG_AK,stu_d,abst_u)) linieID2=rs.AddLine((STG_IK,STG_AT_y,abst_o), (STG_AK,STG_AT_y,abst_o)) line1=rs.coercecurve(linieID1, 0, False) line2=rs.coercecurve(linieID2, 0, False) #Rail zwischen linien rail1=rg.LineCurve(line1.PointAtStart,line2.PointAtStart) rail2=rg.LineCurve(line1.PointAtEnd,line2.PointAtEnd) #Punkte fuer Rail1 topPts1= rs.DivideCurve(rail1,pt,True,True) #bottomPts1=rs.GetPoint(topPts1) #rs.CopyObjects(bottomPts1,(0,0,steigung) #Punkte fuer gegenuebere Rail topPts2=rs.DivideCurve(rail2,pt,True,True) #bottomPts2=getbottompoints(topPts2) stf_ok=rs.AddLine([topPts1], [topPts2]) p=rg.Point3d([topPts1]) vec1 = rs.CreateVector(topPts1.Location) vec2 = rs.CreateVector(topPts2.Location) #StufenLinien topLines=rs.AddLine([vec1], [vec2]) #bottomlines=rs.AddLine(bottomPts1, bottomPts2) """Makeloftsurface(toplines[1:], bottomLines) Makeloftsurface(toplines[:-1], bottomLines)"""