Preserve installed operator workspace before consolidation
Local preservation snapshot, not a new deployment or simulation acceptance.
This commit is contained in:
@@ -0,0 +1,280 @@
|
||||
"""Export v020 CAD as a shared, articulated visual rig; source .blend is never saved.
|
||||
|
||||
Run Blender -b <v020.blend> --python tools/rover-scene/export_motion.py from repo root.
|
||||
The original reconstructed tread recipe and taut belt path live in source/.
|
||||
The 44 repeated rubber pitches are rigid visual links, not contact simulation.
|
||||
"""
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import math
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
from pathlib import Path
|
||||
|
||||
import bpy
|
||||
from mathutils import Matrix, Vector
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
sys.path[:0] = [str(HERE), str(HERE / "source")]
|
||||
from materials import classify, materials # noqa: E402
|
||||
from track_detail import add_track # noqa: E402
|
||||
from track_path import PITCH, RW, solve # noqa: E402
|
||||
|
||||
root = Path.cwd()
|
||||
source = Path(bpy.data.filepath)
|
||||
source_hash = hashlib.sha256(source.read_bytes()).hexdigest()
|
||||
bpy.context.scene.frame_set(1)
|
||||
dg = bpy.context.evaluated_depsgraph_get()
|
||||
shift = Vector((-0.0535, 0, 0))
|
||||
groups = defaultdict(list)
|
||||
pivots = {}
|
||||
for o in bpy.context.scene.objects:
|
||||
if o.name.startswith(("L_SPIN_", "R_SPIN_")):
|
||||
pivots[o.name] = o.matrix_world.translation.copy() + shift
|
||||
|
||||
for inst in dg.object_instances:
|
||||
o = inst.object
|
||||
src = o.original
|
||||
if o.type not in {"MESH", "CURVE"} or src.hide_render:
|
||||
continue
|
||||
if "MURAVEY" in src.name:
|
||||
if "carcass" not in src.name:
|
||||
continue
|
||||
# The continuous side bands have no longitudinal pattern and do not
|
||||
# change shape as rubber circulates. Keep their exact curved CAD surface.
|
||||
original = src.data
|
||||
mesh = bpy.data.meshes.new("Continuous side bands")
|
||||
mesh.from_pydata(
|
||||
[v.co[:] for v in original.vertices],
|
||||
[],
|
||||
[p.vertices[:] for p in original.polygons if all(i % 240 < 192 for i in p.vertices)],
|
||||
)
|
||||
mesh.materials.append(materials["rubber"])
|
||||
mesh.transform(Matrix.Translation(shift) @ inst.matrix_world)
|
||||
groups["STATIC"].append(mesh)
|
||||
continue
|
||||
if any(
|
||||
c.hide_render or any(t in c.name for t in ["STUDIO", "BOOLEAN", "DATUM"])
|
||||
for c in src.users_collection
|
||||
):
|
||||
continue
|
||||
if not inst.is_instance and not src.visible_get():
|
||||
continue
|
||||
parent, group = src.parent, "STATIC"
|
||||
while parent:
|
||||
if parent.name in pivots:
|
||||
group = parent.name
|
||||
break
|
||||
parent = parent.parent
|
||||
mesh = bpy.data.meshes.new_from_object(o, preserve_all_data_layers=True, depsgraph=dg)
|
||||
for i, mat in enumerate(mesh.materials):
|
||||
mesh.materials[i] = materials[classify(mat.name if mat else "", src.name)]
|
||||
if not mesh.materials:
|
||||
mesh.materials.append(materials["body"])
|
||||
matrix = Matrix.Translation(shift) @ inst.matrix_world
|
||||
if group != "STATIC":
|
||||
matrix = Matrix.Translation(-pivots[group]) @ matrix
|
||||
mesh.transform(matrix)
|
||||
groups[group].append(mesh)
|
||||
|
||||
# Blender object names are global across scenes; reserve the portable rig names.
|
||||
for name in pivots:
|
||||
bpy.data.objects[name].name = "SOURCE_" + name
|
||||
scene = bpy.data.scenes.new("DCD-006 simulation motion")
|
||||
bpy.context.window.scene = scene
|
||||
for group, meshes in groups.items():
|
||||
objects = []
|
||||
for mesh in meshes:
|
||||
o = bpy.data.objects.new(group, mesh)
|
||||
scene.collection.objects.link(o)
|
||||
objects.append(o)
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
for o in objects:
|
||||
o.select_set(True)
|
||||
bpy.context.view_layer.objects.active = objects[0]
|
||||
bpy.ops.object.join()
|
||||
o = bpy.context.object
|
||||
o.name = group
|
||||
if group != "STATIC":
|
||||
o.location = pivots[group]
|
||||
# Nine static material batches, while rotating assemblies keep their identity.
|
||||
if group == "STATIC":
|
||||
bpy.ops.object.mode_set(mode="EDIT")
|
||||
bpy.ops.mesh.select_all(action="SELECT")
|
||||
bpy.ops.mesh.separate(type="MATERIAL")
|
||||
bpy.ops.object.mode_set(mode="OBJECT")
|
||||
|
||||
# Reuse one mould pitch on every link. At ground contact the chevron points
|
||||
# toward +X (front drive sprocket), hence direction=-1 along the bottom run.
|
||||
scratch = bpy.data.collections.new("Pitch source")
|
||||
scene.collection.children.link(scratch)
|
||||
length = 2.222
|
||||
|
||||
|
||||
def flat_sample(s):
|
||||
if s > length / 2:
|
||||
s -= length
|
||||
return Vector((s, 0, 0)), Vector((1, 0, 0)), Vector((0, 0, 1))
|
||||
|
||||
|
||||
full = add_track(
|
||||
dict(
|
||||
collection=scratch,
|
||||
materials={"rubber": materials["rubber"], "metal": materials["track-steel"]},
|
||||
sample=flat_sample,
|
||||
length=length,
|
||||
pitch=PITCH,
|
||||
direction=-1,
|
||||
side_label="Template",
|
||||
)
|
||||
)
|
||||
templates = []
|
||||
for o in full:
|
||||
# Generator emits each of its five components in 44 contiguous equal blocks.
|
||||
count = len(o.data.vertices) // 44
|
||||
mesh = bpy.data.meshes.new("pitch")
|
||||
offset = 192 if "carcass" in o.name else 0
|
||||
mesh.from_pydata(
|
||||
[v.co[:] for v in o.data.vertices[offset:count]],
|
||||
[],
|
||||
[
|
||||
tuple(i - offset for i in p.vertices)
|
||||
for p in o.data.polygons
|
||||
if min(p.vertices) >= offset and max(p.vertices) < count
|
||||
],
|
||||
)
|
||||
# Re-centre each disconnected mould detail into the nearest repeated pitch.
|
||||
# This avoids a long rigid overhang when a link goes around a small roller.
|
||||
neighbours = defaultdict(set)
|
||||
for face in mesh.polygons:
|
||||
for i in face.vertices:
|
||||
neighbours[i].update(face.vertices)
|
||||
remaining = set(range(len(mesh.vertices)))
|
||||
while remaining:
|
||||
cluster, todo = set(), [next(iter(remaining))]
|
||||
while todo:
|
||||
i = todo.pop()
|
||||
if i in cluster:
|
||||
continue
|
||||
cluster.add(i)
|
||||
todo.extend(neighbours[i] - cluster)
|
||||
remaining -= cluster
|
||||
centre = sum(mesh.vertices[i].co.x for i in cluster) / len(cluster)
|
||||
correction = math.floor(centre / PITCH + 0.5) * PITCH
|
||||
for i in cluster:
|
||||
mesh.vertices[i].co.x -= correction
|
||||
mesh.materials.append(o.data.materials[0])
|
||||
part = bpy.data.objects.new("pitch", mesh)
|
||||
scene.collection.objects.link(part)
|
||||
for m in o.modifiers:
|
||||
modifier = part.modifiers.new(m.name, m.type)
|
||||
modifier.width = m.width
|
||||
modifier.segments = m.segments
|
||||
templates.append(part)
|
||||
bpy.data.objects.remove(o, do_unlink=True)
|
||||
bpy.context.view_layer.update()
|
||||
for o in templates:
|
||||
for mod in list(o.modifiers):
|
||||
bpy.context.view_layer.objects.active = o
|
||||
bpy.ops.object.modifier_apply(modifier=mod.name)
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
for o in templates:
|
||||
o.select_set(True)
|
||||
bpy.context.view_layer.objects.active = templates[0]
|
||||
bpy.ops.object.join()
|
||||
template = bpy.context.object
|
||||
path = solve()
|
||||
nodes = []
|
||||
for side, transverse in [("L", 0.3425), ("R", -0.3425)]:
|
||||
for i in range(44):
|
||||
o = bpy.data.objects.new(f"{side}_BELT_{i:02d}", template.data)
|
||||
scene.collection.objects.link(o)
|
||||
p, t, n = path["sample"](path["track_phase"] + i * PITCH, transverse)
|
||||
o.location = p + shift
|
||||
o.rotation_euler.y = math.atan2(-t.z, t.x)
|
||||
nodes.append(o)
|
||||
bpy.data.objects.remove(template, do_unlink=True)
|
||||
bpy.data.collections.remove(scratch)
|
||||
bpy.context.view_layer.update()
|
||||
objects = list(scene.objects)
|
||||
lo = Vector(
|
||||
min((o.matrix_world @ Vector(v))[i] for o in objects for v in o.bound_box) for i in range(3)
|
||||
)
|
||||
hi = Vector(
|
||||
max((o.matrix_world @ Vector(v))[i] for o in objects for v in o.bound_box) for i in range(3)
|
||||
)
|
||||
if (
|
||||
max(abs(a - b) for a, b in zip(hi - lo, (1.163, 0.905, 0.734), strict=True)) > 0.006
|
||||
or abs(lo.z) > 0.006
|
||||
):
|
||||
raise ValueError(f"Articulated model envelope changed: {lo}, {hi}")
|
||||
out = root / "apps/control-station/public/rover-scene/dcd006-v020-motion.glb"
|
||||
bpy.ops.object.select_all(action="SELECT")
|
||||
bpy.ops.export_scene.gltf(
|
||||
filepath=str(out),
|
||||
export_format="GLB",
|
||||
use_selection=True,
|
||||
use_active_scene=True,
|
||||
export_animations=False,
|
||||
export_cameras=False,
|
||||
export_lights=False,
|
||||
export_extras=False,
|
||||
export_yup=True,
|
||||
export_apply=False,
|
||||
export_attributes=False,
|
||||
export_vertex_color="NONE",
|
||||
)
|
||||
manifest = dict(
|
||||
schema_version="missioncore.rover-motion/v1",
|
||||
source_scene=source.name,
|
||||
source_sha256=source_hash,
|
||||
source_saved=False,
|
||||
visual_sha256=hashlib.sha256(out.read_bytes()).hexdigest(),
|
||||
forward_axis="+X",
|
||||
up_axis="Y",
|
||||
track_centres_m={"L": 0.3425, "R": -0.3425},
|
||||
track_width_m=0.685,
|
||||
shift_m=list(shift),
|
||||
length_m=path["length"],
|
||||
pitch_m=PITCH,
|
||||
phase_m=path["track_phase"],
|
||||
segments=path["segments"],
|
||||
link_count=44,
|
||||
wheels=[
|
||||
dict(node=name, radius_m=PITCH * 9 / (2 * math.pi) if name.endswith("DRIVE") else RW)
|
||||
for name in pivots
|
||||
],
|
||||
dimensions_m=list(hi - lo),
|
||||
minimum_m=list(lo),
|
||||
method=(
|
||||
"44 rigid visual pitches per belt; rolling assemblies retain original CAD pivots; "
|
||||
"no track contact dynamics"
|
||||
),
|
||||
)
|
||||
out.with_suffix(".json").write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n")
|
||||
|
||||
# A portable Blender preview: 1 metre of forward travel over 4 seconds, baked
|
||||
# to the exported nodes. Runtime drives these same nodes from each side's speed.
|
||||
scene.render.fps = 30
|
||||
scene.frame_start, scene.frame_end = 1, 121
|
||||
for frame in range(1, 122):
|
||||
distance = (frame - 1) / 120
|
||||
for o in nodes:
|
||||
side, _, index = o.name.split("_")
|
||||
p, t, n = path["sample"](
|
||||
manifest["phase_m"] + int(index) * PITCH + distance, 0.3425 if side == "L" else -0.3425
|
||||
)
|
||||
o.location = p + shift
|
||||
o.rotation_euler.y = math.atan2(-t.z, t.x)
|
||||
o.keyframe_insert("location", frame=frame)
|
||||
o.keyframe_insert("rotation_euler", frame=frame)
|
||||
for spec in manifest["wheels"]:
|
||||
o = scene.objects[spec["node"]]
|
||||
o.rotation_euler.y = distance / spec["radius_m"]
|
||||
o.keyframe_insert("rotation_euler", frame=frame)
|
||||
scene.frame_set(1)
|
||||
preview = root / "outputs/rover-motion/DCD-006_v020_motion.blend"
|
||||
preview.parent.mkdir(parents=True, exist_ok=True)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(preview))
|
||||
print("MOTION_EXPORT", out.stat().st_size, "bytes", len(objects), "nodes", flush=True)
|
||||
@@ -4,34 +4,9 @@ from collections import defaultdict
|
||||
from pathlib import Path
|
||||
from mathutils import Vector, Matrix
|
||||
root=Path.cwd();source=Path(bpy.data.filepath)
|
||||
# Linear colors. Painted black is a dielectric coating, not bare silver.
|
||||
specs={
|
||||
'body':('Корпус и подвеска',(.025,.028,.031),.12,.53),
|
||||
'rubber':('Резина гусениц и катков',(.014,.017,.019),0,.72),
|
||||
'track-steel':('Нержавеющие проставки',(.55,.58,.61),1,.17),
|
||||
'box':('Бортовой ящик',(.034,.038,.042),.08,.40),
|
||||
'molle':('MOLLE панель',(.085,.094,.105),.30,.44),
|
||||
'motor':('Алюминий моторов',(.30,.32,.33),.68,.38),
|
||||
'hardware':('Чёрный крепёж',(.018,.021,.024),.45,.38),
|
||||
'polymer':('Пластик и кожухи',(.018,.022,.026),0,.44),
|
||||
'drive':('Ведущие звёзды',(.22,.13,.038),0,.46),
|
||||
}
|
||||
materials={}
|
||||
for key,(label,color,metal,rough) in specs.items():
|
||||
m=bpy.data.materials.new('rover/'+key);m.use_nodes=True;bs=m.node_tree.nodes.get('Principled BSDF')
|
||||
bs.inputs['Base Color'].default_value=(*color,1);bs.inputs['Metallic'].default_value=metal;bs.inputs['Roughness'].default_value=rough;materials[key]=m
|
||||
|
||||
def classify(name,obj):
|
||||
n=name.lower();o=obj.lower()
|
||||
if 'stamped clips' in n or 'inter-window clips' in o:return 'track-steel'
|
||||
if 'molle' in n:return 'molle'
|
||||
if 'motor | cast' in n:return 'motor'
|
||||
if 'polyurethane' in n:return 'drive'
|
||||
if any(k in n for k in ['rubber','gasket','elastomer','jacket','coated roller']):return 'rubber'
|
||||
if any(k in n for k in ['case | textured','case | dark raised']):return 'box'
|
||||
if any(k in n+' '+o for k in ['bolt','screw','washer','nut','lock steel','zinc','stainless','connector brass','dark steel','black oxide']):return 'hardware'
|
||||
if any(k in n for k in ['polymer','asa','recess','cavities']):return 'polymer'
|
||||
return 'body'
|
||||
import sys
|
||||
sys.path.insert(0,str(Path(__file__).resolve().parent))
|
||||
from materials import specs, materials, classify
|
||||
|
||||
bpy.context.scene.frame_set(1);dg=bpy.context.evaluated_depsgraph_get();instances=[];assignment=defaultdict(set)
|
||||
for inst in dg.object_instances:
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import bpy
|
||||
# Linear colors. Painted black is a dielectric coating, not bare silver.
|
||||
specs={
|
||||
'body':('Корпус и подвеска',(.025,.028,.031),.12,.53),
|
||||
'rubber':('Резина гусениц и катков',(.014,.017,.019),0,.72),
|
||||
'track-steel':('Нержавеющие проставки',(.55,.58,.61),1,.17),
|
||||
'box':('Бортовой ящик',(.034,.038,.042),.08,.40),
|
||||
'molle':('MOLLE панель',(.085,.094,.105),.30,.44),
|
||||
'motor':('Алюминий моторов',(.30,.32,.33),.68,.38),
|
||||
'hardware':('Чёрный крепёж',(.018,.021,.024),.45,.38),
|
||||
'polymer':('Пластик и кожухи',(.018,.022,.026),0,.44),
|
||||
'drive':('Ведущие звёзды',(.22,.13,.038),0,.46),
|
||||
}
|
||||
materials={}
|
||||
for key,(label,color,metal,rough) in specs.items():
|
||||
m=bpy.data.materials.new('rover/'+key);m.use_nodes=True;bs=m.node_tree.nodes.get('Principled BSDF')
|
||||
bs.inputs['Base Color'].default_value=(*color,1);bs.inputs['Metallic'].default_value=metal;bs.inputs['Roughness'].default_value=rough;materials[key]=m
|
||||
|
||||
def classify(name,obj):
|
||||
n=name.lower();o=obj.lower()
|
||||
if 'stamped clips' in n or 'inter-window clips' in o:return 'track-steel'
|
||||
if 'molle' in n:return 'molle'
|
||||
if 'motor | cast' in n:return 'motor'
|
||||
if 'polyurethane' in n:return 'drive'
|
||||
if any(k in n for k in ['rubber','gasket','elastomer','jacket','coated roller']):return 'rubber'
|
||||
if any(k in n for k in ['case | textured','case | dark raised']):return 'box'
|
||||
if any(k in n+' '+o for k in ['bolt','screw','washer','nut','lock steel','zinc','stainless','connector brass','dark steel','black oxide']):return 'hardware'
|
||||
if any(k in n for k in ['polymer','asa','recess','cavities']):return 'polymer'
|
||||
return 'body'
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
"""Photo-reconstructed Composit Muravey tread and visible wheel surfaces.
|
||||
|
||||
All units are metres. Does not reset/open/save the scene.
|
||||
|
||||
add_track(ctx): collection, materials {rubber, metal[, tread]},
|
||||
sample(s) -> (position, tangent, outward_normal), length=2.222,
|
||||
width=.220, pitch=.0505, side_label. The path is the belt NEUTRAL line.
|
||||
Position contains the global track Y centre; transverse offsets use global Y.
|
||||
Optional parameters: belt_thickness=.006, lug_height=.020, phase=0,
|
||||
direction=1, include_inner_lugs=True. Exact mould dimensions are NOT known.
|
||||
|
||||
add_wheel(ctx): collection, materials {rubber,metal[, painted]}, center,
|
||||
radius, width, side_label, kind='roller' or 'sprocket'. Rotation axis Y.
|
||||
A roller is one wheel; call twice for the two running lanes if required.
|
||||
Sprocket external diameter defaults to .160, independently of roller radius.
|
||||
Return a list of created objects. Parameters retain evidence-status properties.
|
||||
"""
|
||||
import math
|
||||
import bpy
|
||||
import bmesh
|
||||
from mathutils import Vector
|
||||
|
||||
|
||||
class Geometry:
|
||||
def __init__(self):
|
||||
self.vertices=[]
|
||||
self.faces=[]
|
||||
|
||||
def prism(self, lower, upper):
|
||||
"""Matching polygon rings, including concave chevron footprints."""
|
||||
n=len(lower); k=len(self.vertices)
|
||||
self.vertices.extend(lower); self.vertices.extend(upper)
|
||||
self.faces.append(tuple(k+i for i in reversed(range(n))))
|
||||
self.faces.append(tuple(k+n+i for i in range(n)))
|
||||
self.faces.extend((k+i,k+(i+1)%n,k+n+(i+1)%n,k+n+i) for i in range(n))
|
||||
|
||||
def loft(self, rings):
|
||||
n=len(rings[0]);k=len(self.vertices)
|
||||
for ring in rings:self.vertices.extend(ring)
|
||||
self.faces.append(tuple(k+i for i in reversed(range(n))))
|
||||
for j in range(len(rings)-1):
|
||||
self.faces.extend((k+j*n+i,k+j*n+(i+1)%n,
|
||||
k+(j+1)*n+(i+1)%n,k+(j+1)*n+i) for i in range(n))
|
||||
self.faces.append(tuple(k+(len(rings)-1)*n+i for i in range(n)))
|
||||
|
||||
def object(self, name, collection, material, bevel=0, smooth=False):
|
||||
mesh=bpy.data.meshes.new(name)
|
||||
mesh.from_pydata(self.vertices,[],self.faces);mesh.update()
|
||||
bm=bmesh.new();bm.from_mesh(mesh)
|
||||
bmesh.ops.recalc_face_normals(bm,faces=bm.faces)
|
||||
bm.to_mesh(mesh);bm.free()
|
||||
ob=bpy.data.objects.new(name,mesh);collection.objects.link(ob)
|
||||
if material:mesh.materials.append(material)
|
||||
if smooth:
|
||||
for p in mesh.polygons:p.use_smooth=True
|
||||
if bevel:
|
||||
mod=ob.modifiers.new('Mould edge radii — photo estimate','BEVEL')
|
||||
mod.width=bevel;mod.segments=2
|
||||
return ob
|
||||
|
||||
|
||||
def add_track(ctx):
|
||||
col=ctx['collection'];mats=ctx['materials'];sample=ctx['sample']
|
||||
length=ctx.get('length',2.222);width=ctx.get('width',.220)
|
||||
pitch=ctx.get('pitch',.0505);count=round(length/pitch)
|
||||
if abs(count*pitch-length)>.00001:
|
||||
raise ValueError('Track length must contain an integer number of nominal pitches')
|
||||
thick=ctx.get('belt_thickness',.006);height=ctx.get('lug_height',.020)
|
||||
phase=ctx.get('phase',0);direction=ctx.get('direction',1)
|
||||
prefix=ctx.get('side_label','TRACK')
|
||||
belt=Geometry();lugs=Geometry();ribs=Geometry();clips=Geometry();inner=Geometry()
|
||||
# Catalog frontal image: opening ~22 mm / 220 mm total width.
|
||||
half_window=.011;half_open_length=.015
|
||||
|
||||
def point(s,y,h):
|
||||
p,t,n=sample((s+phase)%length)
|
||||
return Vector(p)+Vector((0,y,0))+Vector(n)*h
|
||||
|
||||
def patch(g,s0,s1,y0,y1,h0,h1,steps=1):
|
||||
for j in range(steps):
|
||||
a=s0+(s1-s0)*j/steps;b=s0+(s1-s0)*(j+1)/steps
|
||||
p=[(a,y0),(b,y0),(b,y1),(a,y1)]
|
||||
g.prism([point(s,y,h0) for s,y in p],[point(s,y,h1) for s,y in p])
|
||||
|
||||
def footprint(g, s, coords, h0, h1, taper=.82):
|
||||
# coords in (transverse, longitudinal) axes. Top narrows slightly.
|
||||
cy=sum(p[0] for p in coords)/len(coords)
|
||||
cs=sum(p[1] for p in coords)/len(coords)
|
||||
low=[point(s+direction*d,y,h0) for y,d in coords]
|
||||
high=[point(s+direction*(cs+(d-cs)*taper),cy+(y-cy)*taper,h1) for y,d in coords]
|
||||
g.prism(low,high)
|
||||
|
||||
# Two continuous side bands. Central bridges leave genuine through-windows.
|
||||
for i in range(count):
|
||||
s=i*pitch
|
||||
for sign in (-1,1):
|
||||
a,b=sorted((sign*half_window,sign*width/2))
|
||||
patch(belt,s,s+pitch,a,b,-thick/2,thick/2,12)
|
||||
bridge=pitch/2-half_open_length
|
||||
patch(belt,s-bridge,s+bridge,-half_window,half_window,-thick/2,thick/2,6)
|
||||
|
||||
# Actual repeated pattern: TWO small chevrons per half and one diagonal
|
||||
# guide beside the window. No single oversized chevron across a half.
|
||||
for sign in (-1,1):
|
||||
for centre in (.050,.087):
|
||||
# Trace of sharp Muravey (v1) V footprint, mirrored across Y.
|
||||
p=[(centre-.016,-.012),(centre-.018,-.007),
|
||||
(centre-.004,.011),(centre,.014),
|
||||
(centre+.004,.011),(centre+.018,-.007),
|
||||
(centre+.016,-.012),(centre,.005)]
|
||||
p=[(sign*y,d) for y,d in p]
|
||||
if sign<0:p.reverse()
|
||||
footprint(lugs,s,p,thick/2-.0004,thick/2+height,.81)
|
||||
diag=[(.017,.013),(.023,.014),(.035,-.015),(.028,-.016)]
|
||||
diag=[(sign*y,d) for y,d in diag]
|
||||
if sign<0:diag.reverse()
|
||||
footprint(lugs,s,diag,thick/2-.0004,thick/2+height,.86)
|
||||
# Lower continuous shoulder behind the V row, and edge mould rail.
|
||||
a,b=sorted((sign*.014,sign*(width/2-.002)))
|
||||
patch(ribs,s-.005,s+.004,a,b,thick/2,thick/2+.0020,3)
|
||||
a,b=sorted((sign*(width/2-.008),sign*(width/2)))
|
||||
patch(ribs,s-.015,s+.035,a,b,thick/2,thick/2+.0013,12)
|
||||
# Fine grooves/ribs are visible between every pair of tread rows.
|
||||
a,b=sorted((sign*.015,sign*(width/2-.008)))
|
||||
for j in range(11):
|
||||
r=s+.016+j*.00185
|
||||
patch(ribs,r-.00034,r+.00034,a,b,thick/2,thick/2+.00065,1)
|
||||
|
||||
# One pressed metal U clip wraps EACH inter-window rubber bridge.
|
||||
# Width and bend radii are photo-derived; article110200149 not proved.
|
||||
clip_width=.026;clip_half=.0083;sheet=.00115
|
||||
# U in (longitudinal,normal) section, extruded across Y.
|
||||
profile=[(-clip_half-sheet,-thick/2-.001),
|
||||
(-clip_half-sheet,thick/2+.0005),
|
||||
(-clip_half,thick/2+.0020),
|
||||
(clip_half,thick/2+.0020),
|
||||
(clip_half+sheet,thick/2+.0005),
|
||||
(clip_half+sheet,-thick/2-.001),
|
||||
(clip_half,-thick/2-.001),
|
||||
(clip_half,thick/2+.0006),
|
||||
(-clip_half,thick/2+.0006),
|
||||
(-clip_half,-thick/2-.001)]
|
||||
clips.prism([point(s+ds,-clip_width/2,h) for ds,h in profile],
|
||||
[point(s+ds,clip_width/2,h) for ds,h in profile])
|
||||
|
||||
if ctx.get('include_inner_lugs',True):
|
||||
# Internal trapezoidal drive/guide bosses visible along bottom run.
|
||||
# Native IMG_2405 crop: height about 0.61 of the 50.5 mm pitch.
|
||||
# These tall guides were missing from the initial visual blockout.
|
||||
for sign in (-1,1):
|
||||
# Several shoulders capture the rounded narrow crown in the
|
||||
# photograph, rather than a rectangular truncated cube.
|
||||
h=ctx.get('inner_lug_height',.031);rings=[]
|
||||
for hh,ss,ww in [(0,.019,.019),(.32*h,.016,.0165),
|
||||
(.84*h,.008,.012), (h,.0045,.010)]:
|
||||
corners=[(sign*(.033-ww),-ss),(sign*(.033+ww),-ss),
|
||||
(sign*(.033+ww),ss),(sign*(.033-ww),ss)]
|
||||
if sign<0:corners.reverse()
|
||||
rings.append([point(s+ds,y,-thick/2-hh) for y,ds in corners])
|
||||
inner.loft(rings)
|
||||
result=[]
|
||||
specs=[(belt,'continuous perforated rubber carcass',mats['rubber'],0),
|
||||
(lugs,'44 rows • four small V lugs and two centre diagonals',mats.get('tread',mats['rubber']),.00065),
|
||||
(ribs,'fine transverse mould ribs and edge rails',mats.get('tread',mats['rubber']),0),
|
||||
(clips,'44 pressed inter-window clips',mats['metal'],.00025),
|
||||
(inner,'inner guide bosses • photo estimate',mats['rubber'],.0012)]
|
||||
for geom,label,mat,bev in specs:
|
||||
ob=geom.object(prefix+' | '+label,col,mat,bev)
|
||||
ob['source']='Composit Muravey catalog frontal image; DCD-006 IMG_2407 / IMG_2405'
|
||||
ob['nominal_width_mm']=width*1000;ob['nominal_length_mm']=length*1000
|
||||
ob['nominal_pitch_mm']=pitch*1000;ob['pitch_count']=count
|
||||
ob['nominal_lug_height_mm']=height*1000
|
||||
ob['geometry_status']='Mould and clip contours photo reconstructed; not toleranced production geometry'
|
||||
result.append(ob)
|
||||
return result
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
"""Static taut belt solve. Metres; catalog neutral-length convention assumed."""
|
||||
import math
|
||||
from mathutils import Vector
|
||||
RW=.0625;THICK=.006;PITCH=.0505;LENGTH=2.222
|
||||
WHEELS={'rear_upper':(-.17025461,.32363473),'drive':(.40182697,.22413776),'front_lower':(.31115497,.0885),'rear_lower':(-.410,.0885),'middle_lower':(-.002609266,.0885)}
|
||||
ORDER=['rear_upper','drive','front_lower','rear_lower']
|
||||
RADII=[RW+THICK/2,PITCH/(2*math.sin(math.pi/9)),RW+THICK/2,RW+THICK/2]
|
||||
def segments(wheels):
|
||||
cc=[wheels[k]for k in ORDER];ns=[]
|
||||
for i in range(4):
|
||||
j=(i+1)%4;dx=cc[j][0]-cc[i][0];dz=cc[j][1]-cc[i][1];d=math.hypot(dx,dz);ux,uz=dx/d,dz/d;k=(RADII[i]-RADII[j])/d
|
||||
ns.append((ux*k-uz*math.sqrt(1-k*k),uz*k+ux*math.sqrt(1-k*k)))
|
||||
seg=[];total=0
|
||||
for i,(x,z)in enumerate(cc):
|
||||
r=RADII[i];n0=ns[(i-1)%4];n1=ns[i];a0=math.atan2(n0[1],n0[0]);a1=math.atan2(n1[1],n1[0])
|
||||
while a1>=a0:a1-=2*math.pi
|
||||
ln=(a0-a1)*r;seg.append(('arc',total,ln,(x,z,r,a0)));total+=ln
|
||||
j=(i+1)%4;p=(x+r*n1[0],z+r*n1[1]);q=(cc[j][0]+RADII[j]*n1[0],cc[j][1]+RADII[j]*n1[1]);ln=math.dist(p,q)
|
||||
seg.append(('line',total,ln,(*p,(q[0]-p[0])/ln,(q[1]-p[1])/ln,*n1)));total+=ln
|
||||
return total,seg
|
||||
|
||||
def solve():
|
||||
w=dict(WHEELS)
|
||||
p=(-.03196350872,.26637459865);q=w['rear_upper'];d=math.dist(p,q)
|
||||
w['rear_upper']=tuple(p[i]+(q[i]-p[i])*.145/d for i in range(2))
|
||||
lo,hi=-.55,-.32
|
||||
for _ in range(70):
|
||||
mid=(lo+hi)/2;w['rear_lower']=(mid,.0885)
|
||||
if segments(w)[0]>LENGTH:lo=mid
|
||||
else:hi=mid
|
||||
w['rear_lower']=((lo+hi)/2,.0885);length,seg=segments(w)
|
||||
def sample(s,y=0):
|
||||
s=s%length
|
||||
for kind,start,ln,d in seg:
|
||||
if s<=start+ln+1e-10:
|
||||
t=s-start
|
||||
if kind=='arc':
|
||||
x,z,r,a=d;a-=t/r;n=Vector((math.cos(a),0,math.sin(a)));tangent=Vector((math.sin(a),0,-math.cos(a)));p=Vector((x,y,z))+r*n
|
||||
else:
|
||||
x,z,tx,tz,nx,nz=d;p=Vector((x+tx*t,y,z+tz*t));n=Vector((nx,0,nz));tangent=Vector((tx,0,tz))
|
||||
return p,tangent,n
|
||||
# Put the centre of one window at the drive arc midpoint. Align one tooth there.
|
||||
drive=seg[2];mid_s=drive[1]+drive[2]/2;phase=(mid_s-PITCH/2)%PITCH
|
||||
a=drive[3][3]-drive[2]/(2*drive[3][2])
|
||||
return dict(wheels=w,length=length,segments=seg,sample=sample,track_phase=phase,sprocket_phase=a,neutral_radii=RADII)
|
||||
Reference in New Issue
Block a user