#################################################################################################################################### ## VARIABLES #################################################################################################################################### ## Level of Detail attr LOD = 1 ############################ ## Height and floors numberOfFloors = rint((scope.sx * scope.sz)/floorHeight/10 * popDensityFactor ) popDensityFactor = 1 coreHeight = numberOfFloors * floorHeight // actual height of the core sectionHeight = numberOfFloors * floorHeight * 2 // potential maximum height of the recursive sections and building floorHeight = 3 tileWidth = 3 ############################ ## Sections sectionRandomizer = (rint(randomSectionDistribution * sectionHeight *.75/floorHeight)) * floorHeight randomSectionDistribution = 15%:.4 20%:.2 20%:.1 20%:.5 else: .3 gapRandomizer = (rint(randomGapDistribution * sectionHeight *.75/floorHeight)) * floorHeight randomGapDistribution = 50%:.05 20%:.1 20%:.2 else: .3 #################################################################################################################################### ## RULES #################################################################################################################################### Lot--> // make a rectangle from the initial shape, rescale it and align it innerRect s('0.7,'1,'0.7) center(xz) alignScopeToAxes(y) s('1,0,'1) Squareize Squareize --> // make the new rectangle shape into square, lenght of side is the shortest scope length case scope.sx == scope.sz: s('1,0,'1) center(xz) Footprint case scope.sx > scope.sz: s(scope.sz,0,scope.sz) center(xz) Footprint case scope.sz > scope.sx: s(scope.sx,0,scope.sx) center(xz) Footprint else: NIL Footprint--> // extrude the core case scope.sx * scope.sz > 500: extrude(coreHeight ) Tower else: NIL ################################ ################################ ## CORE AND SECTIONS ################################ Tower--> // insert the model i(fileRandom("assets/volumes/Rule5/*.obj")) //CORE split(z){ '0.1: NIL | '0.3 : s('.5, '1, '.5) center(xz) t(0,0,2) Mass | '0.2 : NIL | '0.3: s('.5, '1, '.5) center(xz) t(0,0,-10) Mass |'0.1: NIL } //SECTIONS split(z){ '0.1: NIL | '0.7: center(xz) s('1, sectionHeight, '1) RecursiveSections |~1: NIL } ############################### ############################### ## RECURSIVE SECTIONS ############################### RecursiveSections --> // ALTERNATIVE 1: DESIRED repeat the section and gap, while it touches the core case touches(intra) : split(y){ sectionRandomizer: Mass | gapRandomizer : NIL | ~1: RecursiveSections } else: NIL // ALTERNATIVE 2: CHECK turn off touches() to see if some of the sections touch the core /* split(y){ sectionRandomizer: Mass | gapRandomizer : NIL | ~1: RecursiveSections } */ ################################ ################################ ## MASS ################################ Mass--> // split up the mass into roof, base and sides alignScopeToAxes(y) center(xyz) comp(f) {horizontal: BasicRoof |all : WallAlignCheck } ################################ ################################ ## WALL ################################ WallAlignCheck--> // check the alignment (not sure how this part works, but it seems to work) alignScopeToGeometry(zUp, auto) alignScopeToAxes(y) split(y){0.01 : TinySplit // Workaround split to get a tiny horizontal edge, for vertical alignment | ~1 : Wall1 } Wall1--> // split odd shapes into more usual shapes (not sure how this part works, but it seems to work) convexify() comp(f){all: Wall2} Wall2--> // give it a nice color color("#ff0000") ################################ ################################ ## FRAME ################################ Frame--> // give it a nice color color("#ff0000") Done. ################################ ################################ ## TINY SPLIT ################################ TinySplit--> // give it a nice color color("#ff0000") Done. ################################ ################################ ## BASIC ROOF ################################ BasicRoof --> // leave it white Roof.
Solved! Go to Solution.
unsolvable issue