"""GRASS CUTTER - the automation kit in the farm style: timber, barn red, tin, tractor green, iron, burlap and hay. SM_RobotMower the little mower of a dock; the Reaper is the same machine, bigger. Front = -Y. SM_RobotDock plank pad with a lean-to shed and a charging post, 3 x 3 m. SM_BundleCatcher a burlap funnel on four legs with a tin chute to the front, 3 x 3 m. SM_Binder a red baling box with a hopper, a flywheel and a twine spool, 2 x 2 m. SM_SolarPost, SM_SolarPair, SM_SolarTracker `Head` carries the cells, the tracker turns it toward the sun. Authored in Blender space: metres, Z up, front = -Y (Unity +Z), origin on the ground in the middle of the footprint. Run (from project root): blender -b --factory-startup --python ArtSource/Blender/scripts/gc_robots.py -- [SM_RobotMower ...] """ import sys, os sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import common from gc_farm_machines import * # noqa: F401,F403 (helpers + material names) CELL = "M_SolarPanel" TILT = 0.42 def wheel(P, x, y, r, w): spoked(P, (x, y, r), "X", R=r, w=w, n=5, rim=RUB, spoke=GOLD, hub=IRON) def robot_mower(): P = [] # chassis and the cutter skirt under the nose P.append(bx(-0.4, 0.4, -0.62, 0.62, 0.14, 0.26, IRON, bev=0.03, segs=2, name="chassis")) P.append(cz("skirt", 0.46, 0.06, 0.14, 0, -0.2, TIN, v=28, bev=0.012)) # the tractor-green bonnet and a cream stripe over it P.append(sphere("bonnet", 0.5, (0, -0.18, 0.3), m=GRN, scale=(0.78, 0.9, 0.62))) P.append(bx(-0.08, 0.08, -0.62, 0.1, 0.56, 0.6, CRM, bev=0.01, name="stripe")) # the bin at the back, full of cuttings P.append(bx(-0.38, 0.38, 0.1, 0.16, 0.26, 0.62, TIM, name="binfront")) P.append(bx(-0.38, 0.38, 0.58, 0.64, 0.26, 0.62, TIM, name="binback")) for sx in (-1, 1): P.append(bx(sx * 0.35 - 0.03, sx * 0.35 + 0.03, 0.1, 0.64, 0.26, 0.62, RED, name="binside")) hay_heap(P, (0, 0.37, 0.56), 0.32, 0.24, 0.14) for sx in (-1, 1): wheel(P, sx * 0.47, -0.42, 0.15, 0.08) wheel(P, sx * 0.47, 0.44, 0.2, 0.1) # a lamp for a nose, and a flag so you can find it in tall grass lantern(P, 0, -0.72, 0.42, m="M_Emissive", r=0.05) P.append(beam((0.3, 0.6, 0.6), (0.3, 0.6, 1.15), 0.022, 0.022, m=STL, bev=0.005, name="mast")) P.append(bx(0.3, 0.52, 0.59, 0.61, 0.98, 1.12, PRED, bev=0.003, name="flag")) ffin(P, "Body") return dict(elev=25, azim=-35) def robot_dock(): P = [] for k in range(10): y = -1.35 + k * 0.3 P.append(bx(-1.4, 1.4, y - 0.14, y + 0.14, 0.1, 0.16, DECK, bev=0.01, name="plank")) for sx in (-1, 1): P.append(bx(sx * 1.42 - 0.07, sx * 1.42 + 0.07, -1.5, 1.5, 0.0, 0.17, TIM, bev=0.016, name="kerb")) P.append(bx(-1.5, 1.5, sx * 1.42 - 0.07, sx * 1.42 + 0.07, 0.0, 0.17, TIM, bev=0.016, name="kerb")) # the lean-to at the back for x in (-1.2, 1.2): for y in (0.3, 1.25): P.append(beam((x, y, 0.16), (x, y, 1.75), 0.12, 0.12, name="post")) P.append(bx(-1.25, 1.25, 1.21, 1.29, 0.16, 1.75, RED, name="backwall")) for sx in (-1, 1): P.append(bx(sx * 1.2 - 0.04, sx * 1.2 + 0.04, 0.3, 1.25, 0.16, 1.75, RED, name="sidewall")) roof_ridge_x(P, -1.42, 1.42, 0.1, 1.45, 1.72, 2.1, m=TIN, t=0.05) bale(P, (0.72, 0.85, 0.33)) bale(P, (-0.72, 0.82, 0.33), rz=0.2) bale(P, (0.6, 0.85, 0.65), rz=-0.15) # the charging post and where the robot parks P.append(beam((-1.2, -1.2, 0.16), (-1.2, -1.2, 1.1), 0.1, 0.1, name="charger")) P.append(bx(-1.28, -1.12, -1.28, -1.12, 0.74, 0.96, IRON, bev=0.012, name="chargerbox")) lantern(P, -1.2, -1.2, 1.1, m="M_Emissive", r=0.06) chevron_flat(P, -0.3, 0.5, 0.16, 0.1, 0.16, 0.17) chevron_flat(P, -0.75, 0.5, 0.16, 0.1, 0.16, 0.17) ffin(P, "Body") return dict(elev=30, azim=-35) def bundle_catcher(): P = [] for (sx, sy) in ((1, 1), (-1, 1), (1, -1), (-1, -1)): P.append(beam((sx * 1.2, sy * 1.2, 0.0), (sx * 0.85, sy * 0.85, 1.45), 0.13, 0.13, name="leg")) for sy in (-1, 1): P.append(beam((-1.0, sy * 1.0, 0.75), (1.0, sy * 1.0, 0.75), 0.09, 0.09, name="rail")) P.append(beam((sy * 1.0, -1.0, 0.75), (sy * 1.0, 1.0, 0.75), 0.09, 0.09, name="rail")) # the funnel: burlap inside and out, tin rim, timber ribs P.append(revm("net", [(0.38, 1.2), (1.42, 2.55), (1.47, 2.55), (0.43, 1.2)], BUR, segs=24, closed=True)) P.append(torus("rim", 1.45, 0.05, (0, 0, 2.55), "Z", seg=40, rseg=8, m=TIN)) P.append(torus("throat", 0.42, 0.04, (0, 0, 1.2), "Z", seg=24, rseg=8, m=IRON)) for k in range(8): a = k * PI / 4 c, s = math.cos(a), math.sin(a) P.append(beam((c * 0.48, s * 0.48, 1.2), (c * 1.5, s * 1.5, 2.55), 0.05, 0.05, name="rib")) # the tin chute to the front P.append(beam((0, -0.15, 1.1), (0, -1.42, 0.5), 0.56, 0.05, m=TIN, name="chute")) for sx in (-1, 1): P.append(beam((sx * 0.28, -0.15, 1.16), (sx * 0.28, -1.42, 0.56), 0.04, 0.12, m=TIM, name="chuteside")) P.append(beam((1.15, 1.15, 0.7), (1.15, 1.15, 3.1), 0.05, 0.05, m=STL, name="mast")) P.append(bx(1.15, 1.6, 1.14, 1.16, 2.8, 3.06, PRED, bev=0.003, name="flag")) ffin(P, "Body") return dict(elev=25, azim=-35) def binder(): P = [] farm_skid(P, -0.85, 0.85, -0.75, 0.75) P.append(bx(-0.78, 0.78, -0.7, 0.7, 0.13, 1.1, RED, name="body")) for sx in (-1, 1): for sy in (-1, 1): P.append(bx(sx * 0.78 - 0.05, sx * 0.78 + 0.05, sy * 0.7 - 0.05, sy * 0.7 + 0.05, 0.13, 1.14, TIM, name="corner")) P.append(bx(-0.84, 0.84, -0.76, 0.76, 1.1, 1.16, IRON, name="lid")) plank_funnel(P, 0, 0.2, 1.16, 1.62, 0.34, 0.62, 4, [TIM, CRM]) hay_heap(P, (0, 0.2, 1.42), 0.42, 0.42, 0.26) # flywheel and belt on the side, twine spool on the lid spoked(P, (0.88, 0.1, 0.62), "X", R=0.46, w=0.07, n=6, rim=IRON, spoke=PRED, hub=IRON) P.append(cz("spool", 0.15, 1.16, 1.44, -0.55, -0.48, TWINE, v=16, bev=0.02)) # the chute at the front, with a bale on its way out P.append(bx(-0.36, 0.36, -1.0, -0.7, 0.28, 0.36, TIN, bev=0.008, name="chute")) for sx in (-1, 1): P.append(bx(sx * 0.38 - 0.03, sx * 0.38 + 0.03, -1.0, -0.7, 0.28, 0.52, TIM, name="chuteside")) lantern(P, 0.6, -0.5, 1.16, m="M_Emissive", r=0.05) ffin(P, "Body") return dict(elev=25, azim=-35) def panel(P, x, w, d): """One framed panel lying flat around the head's origin.""" P.append(bx(x - w / 2, x + w / 2, -d / 2, d / 2, -0.04, 0.02, TIN, bev=0.008, name="frame")) P.append(bx(x - w / 2 + 0.04, x + w / 2 - 0.04, -d / 2 + 0.04, d / 2 - 0.04, 0.02, 0.035, CELL, bev=0.002, name="cells")) def stand(high, r=0.09): P = [] P.append(cz("foot", r * 2.6, 0.0, 0.14, m=IRON, v=16, bev=0.015)) P.append(cz("post", r, 0.1, high - 0.08, m=TIM, v=12)) P.append(cz("cap", r * 1.3, high - 0.1, high + 0.02, m=IRON, v=12, bev=0.01)) ffin(P, "Stand") def tilted(P, high): """The fixed panels lean back and look at the noon sun.""" o = ffin(P, "Head") xf(o, rx=TILT, t=(0, 0, high)) set_origin(o, (0, 0, high)) def solar_post(): stand(1.6) P = [] panel(P, 0, 1.0, 0.8) tilted(P, 1.6) return dict(elev=20, azim=-35) def solar_pair(): stand(1.9, r=0.11) P = [] panel(P, -0.76, 1.5, 1.2) panel(P, 0.76, 1.5, 1.2) tilted(P, 1.9) return dict(elev=20, azim=-35) def solar_tracker(): stand(2.6, r=0.15) P = [] panel(P, 0, 2.4, 1.92) P.append(bx(-1.1, 1.1, -0.06, 0.06, -0.16, -0.04, IRON, bev=0.01, name="spine")) P.append(bx(-0.06, 0.06, -0.9, 0.9, -0.16, -0.04, IRON, bev=0.01, name="spine")) o = ffin(P, "Head") xf(o, t=(0, 0, 2.6)) set_origin(o, (0, 0, 2.6)) return dict(elev=20, azim=-35) BUILDERS = { "SM_RobotMower": robot_mower, "SM_RobotDock": robot_dock, "SM_BundleCatcher": bundle_catcher, "SM_Binder": binder, "SM_SolarPost": solar_post, "SM_SolarPair": solar_pair, "SM_SolarTracker": solar_tracker, } if __name__ == "__main__": common.run(BUILDERS)