import sand3d as s3d
def camera_frames():
root = s3d.at(frame_structure(), x=-689, y=0, z=0)
swivel = s3d.at(camera_rotator(), x=-2050, y=-59, z=2833)
other = s3d.at(camera_rotator(side=1), x=672, y=-61, z=2833)
s3d.joint(&class="tok-comment">#39;joint_cameraRotator_right_01_joint_00class="tok-string">39;, swivel, on=s3d.local(root, x=-1361, y=-61, z=2954), kind=39;revoluteclass="tok-string">39;, axis=39;+Z39;, range=(-90,90))
s3d.joint(&class="tok-comment">#39;joint_cameraRotator_left_01_joint_00class="tok-string">39;, other, on=s3d.local(root, x=1361, y=-61, z=2954), kind=39;revoluteclass="tok-string">39;, axis=39;+Z39;, range=(-90,90))
return s3d.assembly(&class="tok-comment">#39;camera_frames39;, root, swivel, other)
def frame_structure(spacing=2142, h=5076, rail_w=121, edge_w=25, rail_t=17, rail_bottom=470, rail_top=4930, ys=(-546,-61,203,505), base_w=199, base_h=475, base_t=5, base_depth=715, small_depth=460, foot_w=312, foot_h=85, top_w=164, top_h=215, end_w=355, end_d=350, clasp_h=420, clasp_w=100, arm_w=473, arm_d=210):
pieces = []
x = -spacing/2
for y in ys:
for dx in (-(rail_w-edge_w)/2, (rail_w-edge_w)/2):
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;rail_edge39;, w=edge_w, d=rail_t, h=rail_top-rail_bottom), x=x+dx, y=y, z=rail_bottom))
for z in range(900,4000,450):
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;rail_bridge39;, w=rail_w, d=rail_t, h=75), x=x, y=y, z=z))
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;rail_cap39;, w=rail_w, d=rail_t, h=h-rail_top), x=x, y=y, z=rail_top))
for y in (ys[0]+42,ys[-1]-41):
pieces.append(s3d.at(s3d.cylinder(&class="tok-comment">#39;guide_rod39;, d=24, h=rail_top-rail_bottom), x=x, y=y, z=rail_bottom))
for y,depth in ((-303,base_depth),(354,small_depth)):
housing=s3d.shell(s3d.box(&class="tok-comment">#39;base_housingclass="tok-string">39;, w=base_w, d=depth, h=base_h), t=base_t, open=39;bottom39;)
pieces.append(s3d.at(housing, x=x, y=y, z=0))
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;foot_plate39;, w=base_w, d=depth+2*base_t, h=foot_h), x=x, y=y, z=0))
for end in (-1,1):
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;foot_ear39;, w=foot_w, d=rail_w*3, h=foot_h), x=x, y=y+end*(depth/2-rail_w), z=foot_h))
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;top_bar39;, w=top_w, d=rail_top/4, h=rail_t*2), x=x, y=-20, z=h-top_h))
for y in (-444,404):
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;top_end_block39;, w=rail_w, d=234, h=top_h), x=x, y=y, z=h-top_h))
for z in (h-top_h,h-rail_t*4):
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;projecting_plate39;, w=end_w, d=end_d, h=rail_t*2), x=x, y=680, z=z))
for y in (-650,610):
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;outer_clasp39;, w=clasp_w, d=rail_w, h=clasp_h), x=x, y=y, z=1660))
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;clasp_link39;, w=rail_w, d=rail_w, h=rail_t*2), x=x, y=y+(rail_w if y<0 else -rail_w)/2, z=1860))
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;lower_bridge39;, w=rail_w, d=269, h=400), x=x-rail_w, y=-61, z=1040))
pieces.append(s3d.at(s3d.box(&class="tok-comment">#39;camera_arm39;, w=arm_w, d=arm_d, h=150), x=x-(arm_w-rail_w)/2, y=-61, z=2924))
half=s3d.group(&class="tok-comment">#39;frame_half39;, *pieces)
s3d.material(half, kind=&class="tok-comment">#39;steelclass="tok-string">39;, color=39;#777b7c39;)
image=s3d.transform(s3d.copy(half), mirror=&class="tok-comment">#39;x39;)
return s3d.group(&class="tok-comment">#39;frame_structure39;, half, image)
def camera_rotator(w=162, d=162, h=121, side=-1):
solid=s3d.cylinder(&class="tok-comment">#39;swivel39;, d=w, h=h)
s3d.material(solid, kind=&class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#55595c39;)
head=s3d.at(camera_head(), x=side*12, y=-2.5, z=-24)
parent=s3d.group(&class="tok-comment">#39;camera_rotator39;, solid)
name=&class="tok-comment">#39;joint_cameraBody_right_01_joint_00class="tok-string">39; if side<0 else 39;joint_cameraBody_left_01_joint_0039;
limits=(-45,0) if side<0 else (0,45)
s3d.joint(name, head, on=s3d.local(parent, x=side*8, y=-2 if side<0 else 0, z=21), kind=&class="tok-comment">#39;revoluteclass="tok-string">39;, axis=39;+Y39;, range=limits)
return s3d.group(&class="tok-comment">#39;rotator_with_head39;, parent, head)
def camera_head(w=104, d=137, h=91):
solid=s3d.box(&class="tok-comment">#39;camera_case39;, w=w, d=d, h=h)
s3d.material(solid, kind=&class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#353a4039;)
return s3d.group(&class="tok-comment">#39;camera_head39;, solid)