From c9d79456ef93b111b5a10ae8a69028e0700a7d8d Mon Sep 17 00:00:00 2001 From: DCCONSTRUCTIONS Date: Wed, 4 Nov 2026 17:14:56 +0300 Subject: [PATCH] feat(battery): add welded R05 frame and correct CATL enclosure labels --- .../public/battery-scene/catl-r04.glb | 4 +- .../public/battery-scene/catl-r04.json | 23 ++- .../src/components/battery/BatteryScene.tsx | 4 +- .../src/core/batteryScene/r04.json | 30 +++- tools/battery-scene/export_battery.py | 2 + tools/battery-scene/refine_battery.py | 141 ++++++++++++++++++ 6 files changed, 194 insertions(+), 10 deletions(-) create mode 100644 tools/battery-scene/refine_battery.py diff --git a/apps/control-station/public/battery-scene/catl-r04.glb b/apps/control-station/public/battery-scene/catl-r04.glb index 9fcf5e10..a60bd4eb 100644 --- a/apps/control-station/public/battery-scene/catl-r04.glb +++ b/apps/control-station/public/battery-scene/catl-r04.glb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f4ac32560ac1906abd92e7c3be35f852ce166ead700f5e27c3b3ce2bdcc7dd3 -size 39541516 +oid sha256:7a01c35d7b8fac13e841053841e372170715c7b79b865f8719ab137b24d5cd20 +size 39916192 diff --git a/apps/control-station/public/battery-scene/catl-r04.json b/apps/control-station/public/battery-scene/catl-r04.json index 6034f19a..8a019171 100644 --- a/apps/control-station/public/battery-scene/catl-r04.json +++ b/apps/control-station/public/battery-scene/catl-r04.json @@ -1,10 +1,10 @@ { - "source": "Cattle_Battery_Enclosure_R04.blend", - "source_sha256": "ec802dfbc2866ab474ce5f809ea9289f2402ec791c0abccb22826620af78a42b", + "source": "CATL_Battery_Enclosure_R05.blend", + "source_sha256": "8a3da0abaeeabc3a006dec51e2ae5a1af8af56b3b1361772279d7766084faea3", "model": "catl-r04.glb", - "sha256": "1f4ac32560ac1906abd92e7c3be35f852ce166ead700f5e27c3b3ce2bdcc7dd3", - "bytes": 39541516, - "groups": 63, + "sha256": "7a01c35d7b8fac13e841053841e372170715c7b79b865f8719ab137b24d5cd20", + "bytes": 39916192, + "groups": 75, "cell_bodies": 13, "objects": [ "bms/Cable / red silicone", @@ -61,6 +61,18 @@ "bms/DISPLAY | black glass", "bms/CASE | recessed black", "bms/CASE | darker frame", + "bms/FRAME | welded graphite steel/FRAME | bottom cross front", + "bms/FRAME | welded graphite steel/FRAME | bottom cross rear", + "bms/FRAME | welded graphite steel/FRAME | bottom longitudinal left", + "bms/FRAME | welded graphite steel/FRAME | bottom longitudinal right", + "bms/FRAME | welded graphite steel/FRAME | post front left", + "bms/FRAME | welded graphite steel/FRAME | post front right", + "bms/FRAME | welded graphite steel/FRAME | post rear left", + "bms/FRAME | welded graphite steel/FRAME | post rear right", + "bms/FRAME | welded graphite steel/FRAME | top cross front", + "bms/FRAME | welded graphite steel/FRAME | top cross rear", + "bms/FRAME | welded graphite steel/FRAME | top longitudinal left", + "bms/FRAME | welded graphite steel/FRAME | top longitudinal right", "bms/CASE | bead-blasted graphite/HANDLE | folded aperture return", "bms/CASE | bead-blasted graphite/HANDLE | folded aperture return.001", "bms/CASE | bead-blasted graphite/HANDLE | integral web underside", @@ -108,6 +120,7 @@ "bms/DISPLAY | black glass", "bms/CASE | recessed black", "bms/CASE | darker frame", + "bms/FRAME | welded graphite steel", "bms/CASE | dielectric liner", "bms/Connector / gold plated contacts", "bms/XT90-S / anti spark green insert", diff --git a/apps/control-station/src/components/battery/BatteryScene.tsx b/apps/control-station/src/components/battery/BatteryScene.tsx index bc9e1ede..782cc8bc 100644 --- a/apps/control-station/src/components/battery/BatteryScene.tsx +++ b/apps/control-station/src/components/battery/BatteryScene.tsx @@ -12,8 +12,8 @@ export function BatteryScene({editing,soc,fresh,deviceId,seedKey,cellVoltages=[] const scene=useSceneDocument(deviceId,profile); const [api,setApi]=useState>[0]|null>(null); const [phase,setPhase]=useState<'loading'|'ready'|'error'>('loading'); - return
- + return
+ {phase!=='ready'&&
{phase==='error'?'Модель не загрузилась. Показания BMS доступны ниже.':'Загружается модель аккумулятора…'}
}
; diff --git a/apps/control-station/src/core/batteryScene/r04.json b/apps/control-station/src/core/batteryScene/r04.json index 288208c6..f05c0c9a 100644 --- a/apps/control-station/src/core/batteryScene/r04.json +++ b/apps/control-station/src/core/batteryScene/r04.json @@ -431,6 +431,22 @@ "doubleSided": true, "tiling": 1, "textures": {} + }, + "bms/FRAME | welded graphite steel": { + "name": "Рама · стальной уголок 20×20×2", + "color": "#42474b", + "metalness": 0.72, + "roughness": 0.38, + "opacity": 1, + "reflectivity": 1, + "clearCoat": 0, + "clearCoatRoughness": 0.3, + "emissive": "#000000", + "emissiveIntensity": 0, + "normalStrength": 1, + "doubleSided": true, + "tiling": 1, + "textures": {} } }, "objects": { @@ -496,6 +512,18 @@ "bms/CASE | dielectric liner/right": true, "bms/Connector / gold plated contacts": true, "bms/XT90-S / anti spark green insert": true, - "bms/XT90-S / yellow PA housing": true + "bms/XT90-S / yellow PA housing": true, + "bms/FRAME | welded graphite steel/FRAME | bottom cross front": true, + "bms/FRAME | welded graphite steel/FRAME | bottom cross rear": true, + "bms/FRAME | welded graphite steel/FRAME | bottom longitudinal left": true, + "bms/FRAME | welded graphite steel/FRAME | bottom longitudinal right": true, + "bms/FRAME | welded graphite steel/FRAME | post front left": true, + "bms/FRAME | welded graphite steel/FRAME | post front right": true, + "bms/FRAME | welded graphite steel/FRAME | post rear left": true, + "bms/FRAME | welded graphite steel/FRAME | post rear right": true, + "bms/FRAME | welded graphite steel/FRAME | top cross front": true, + "bms/FRAME | welded graphite steel/FRAME | top cross rear": true, + "bms/FRAME | welded graphite steel/FRAME | top longitudinal left": true, + "bms/FRAME | welded graphite steel/FRAME | top longitudinal right": true } } diff --git a/tools/battery-scene/export_battery.py b/tools/battery-scene/export_battery.py index b00d4674..d7f402c9 100644 --- a/tools/battery-scene/export_battery.py +++ b/tools/battery-scene/export_battery.py @@ -69,6 +69,8 @@ for obj in sorted(objects, key=lambda o: o.name): ) if name == "CASE | dielectric liner" and obj.name.startswith("SLOT BACKER |"): part = "left" if obj.name.endswith(" -1") else "right" + if obj.name.startswith("FRAME |"): + part = obj.name if display: role, part = "bms/cell-display/" + cell, None key = (role, part) diff --git a/tools/battery-scene/refine_battery.py b/tools/battery-scene/refine_battery.py new file mode 100644 index 00000000..9186d370 --- /dev/null +++ b/tools/battery-scene/refine_battery.py @@ -0,0 +1,141 @@ +"""R05 visual revision over an immutable R04 source; dimensions are in metres. + +Blender --background R04.blend --python refine_battery.py -- R05.blend +This is viewport geometry, not a fabrication or electrical-clearance approval. +""" + +import json +import math +import re +import sys +from pathlib import Path + +import bmesh +import bpy +from mathutils import Matrix, Vector + +output = Path(sys.argv[sys.argv.index("--") + 1]) +if output.exists(): + raise FileExistsError("Revision already exists") +source = bpy.data.filepath +outer = next(c for c in bpy.data.collections if c.name.startswith("OUT |")) +collection = bpy.data.collections.new("R05 | Welded angle frame 20x20x2") +outer.children.link(collection) +material = bpy.data.materials.new("FRAME | welded graphite steel") +material.diffuse_color = (0.055, 0.063, 0.07, 1) +material.use_nodes = True +principled = material.node_tree.nodes.get("Principled BSDF") +principled.inputs["Base Color"].default_value = material.diffuse_color +principled.inputs["Metallic"].default_value = 0.72 +principled.inputs["Roughness"].default_value = 0.38 +# Profile heels overlap the inner sheet surface by 0.2 mm to close the existing +# 0.5 mm sheet joints. Butt joints trim the cross rails/posts, with no coplanar +# overlapping end polygons or transparent sealing material. +xmin, xmax, ymin, ymax, zmin, zmax = -0.2777, 0.3077, -0.1177, 0.1177, -0.0097, 0.1757 +leg, wall = 0.020, 0.002 +profile = [(0, 0), (leg, 0), (leg, wall), (wall, wall), (wall, leg), (0, leg)] +created = [] + + +def angle(name, axis, start, end, u, v, su, sv, cu, cv): + vertices = [] + for longitudinal in (start, end): + for a, b in profile: + point = [0.0, 0.0, 0.0] + point[axis] = longitudinal + point[u] = cu + su * a + point[v] = cv + sv * b + vertices.append(point) + faces = [tuple(range(5, -1, -1)), tuple(range(6, 12))] + faces += [(i, (i + 1) % 6, (i + 1) % 6 + 6, i + 6) for i in range(6)] + mesh = bpy.data.meshes.new(name) + mesh.from_pydata(vertices, [], faces) + mesh.materials.append(material) + bm = bmesh.new() + bm.from_mesh(mesh) + bmesh.ops.recalc_face_normals(bm, faces=list(bm.faces)) + bm.to_mesh(mesh) + bm.free() + obj = bpy.data.objects.new(name, mesh) + collection.objects.link(obj) + created.append(obj) + + +for y, sy, side in [(ymin, 1, "left"), (ymax, -1, "right")]: + for z, sz, level in [(zmin, 1, "bottom"), (zmax, -1, "top")]: + angle(f"FRAME | {level} longitudinal {side}", 0, xmin, xmax, 1, 2, sy, sz, y, z) +for x, sx, endname in [(xmin, 1, "rear"), (xmax, -1, "front")]: + for z, sz, level in [(zmin, 1, "bottom"), (zmax, -1, "top")]: + angle(f"FRAME | {level} cross {endname}", 1, ymin + leg, ymax - leg, 0, 2, sx, sz, x, z) + for y, sy, side in [(ymin, 1, "left"), (ymax, -1, "right")]: + angle(f"FRAME | post {endname} {side}", 2, zmin + leg, zmax - leg, 0, 1, sx, sy, x, y) +texts = [] +for obj in bpy.data.objects: + if obj.type == "FONT" and re.search("cattle", obj.data.body, re.I): + obj.data.body = re.sub("cattle", "CATL", obj.data.body, flags=re.I) + texts.append(obj.name) +assert len(texts) == 5 +# The circled attachment is the modelled NTC1 probe, not a busbar connector. +# Move its pad/probe together to a free top-lid area of C05; retain electrical +# endpoint identities and reroute only its two depicted leads. +pad = bpy.data.objects["NTC1 dielectric attachment"] +pivot = pad.matrix_world.translation.copy() +rotation = Matrix.Rotation(-math.pi / 2, 4, "X") +target = Vector((-0.072, -0.038, 0.1238)) +transform = Matrix.Translation(target) @ rotation @ Matrix.Translation(-pivot) +for name in ["NTC1 dielectric attachment", "NTC1 insulated probe"]: + obj = bpy.data.objects[name] + obj.matrix_world = transform @ obj.matrix_world +for strand in (1, 2): + obj = bpy.data.objects[f"NTC1 | P3.{strand}"] + curve = obj.data + # Preserve the BMS connector end and the existing elevated harness route. + spline = curve.splines[0] + points = [ + p.co.to_3d().copy() + for p in (spline.bezier_points if spline.type == "BEZIER" else spline.points) + ] + assert (points[0] - Vector((-0.072, -0.0891, 0.087))).length < 0.004 + dx = (strand - 1) * 0.0009 + new = [ + Vector((-0.072 + dx, -0.033, 0.1256)), + Vector((-0.072 + dx, -0.032, 0.143)), + Vector((-0.072 + dx, -0.085, 0.145)), + ] + points[2:] + curve.splines.clear() + spline = curve.splines.new("BEZIER") + spline.bezier_points.add(len(new) - 1) + for p, co in zip(spline.bezier_points, new, strict=True): + p.co = co + p.handle_left_type = "AUTO" + p.handle_right_type = "AUTO" +bpy.context.view_layer.update() +# Every profile must be a closed solid and must stay clear of the cell envelopes. +for obj in created: + bm = bmesh.new() + bm.from_mesh(obj.data) + assert all(e.is_manifold for e in bm.edges) + bm.free() + bounds = [obj.matrix_world @ Vector(p) for p in obj.bound_box] + lo = [min(p[i] for p in bounds) for i in range(3)] + hi = [max(p[i] for p in bounds) for i in range(3)] + for cell in [o for o in bpy.data.objects if "Blue cell body" in o.name]: + b = [cell.matrix_world @ Vector(p) for p in cell.bound_box] + assert not all( + min(hi[i], max(p[i] for p in b)) - max(lo[i], min(p[i] for p in b)) > 1e-6 + for i in range(3) + ) +output.parent.mkdir(parents=True, exist_ok=True) +bpy.ops.wm.save_as_mainfile(filepath=str(output)) +report = dict( + source=Path(source).name, + revision=output.name, + frame_profiles=len(created), + profile_mm=[20, 20, 2], + texts=texts, + attachment="NTC1 moved onto C05 top lid", + cell_geometry_unchanged=True, + source_preserved=True, +) +output.with_suffix(".json").write_text(json.dumps(report, indent=2)) +print(json.dumps(report))