← Commit history

Current base scaffold model (Base Scaffold Assembly v7: 7 mm sheet, 5-hole panels, gold contacts), alignment features, link to adom/base-scaffold-panel: GLB, provenance, tools

Drew Owens ·598955ffb3 · ·parent 6ccd00c
5 files changed +289
cad/base-scaffold.glbadded
⋯ 1 unchanged line ⋯
cad/source.jsonadded+62
@@ -0,0 +1,62 @@+{+  "schema": "adom/model-provenance@1",+  "exported": "2026-10-22",+  "source": {+    "system": "Autodesk Fusion (Adom hub)",+    "project": "Main",+    "design": "Base Scaffold Assembly",+    "version": 7,+    "lastModified": "2026-10-20",+    "lastModifiedBy": "Stephen",+    "lineageUrn": "urn:adsk.wipprod:dm.lineage:0KMYcZqHRFa0uKDmV7QO8Q",+    "tree": {+      "Assembly1.0_BaseScaffoldControlPanel v7 (Stephen, 2026-09-23)": {+        "Assembly1.1_PlainBaseScaffold v13 (Luke, 2026-08-13)": [+          "WB00_BaseScaffoldAlignmentSheet v13 (James, 2026-09-01)",+          "9 x BaseSaffoldPanel 5 hole 1.6mm v1 (James, 2026-09-01)",+          "Slider_Front v19, Slider_Back v25, UHMW Tape v1, Middle slide support (Luke)",+          "BaseScaffold_Handle v26 (Luke)",+          "fasteners: 45 BHCS M3x6 for the panels, FHCS M3x08/M3x14, hex socket button heads"+        ],+        "Assembly1.2_ControlPanelScaffoldMount v5 (Stephen, 2026-09-23)": [+          "ControlPannelMount_Scaffold v6",+          "ControlPanel_ScaffoldConnectorPinCover v4",+          "OLD_control-panel_scaffold_v2.0.1 v2 (hidden in this export)"+        ]+      },+      "Base Scaffold Rail Panel Assembly v6 (Stephen, 2026-10-20)": "workcell side, hidden in this export"+    }+  },+  "exportChanges": {+    "hidden": [+      "Base Scaffold Rail Panel Assembly (workcell side: bottom panel, rails, slider funnels, bearing Y-stops, workcell control-panel dock)",+      "OLD_control-panel_scaffold_v2.0.1 and OLD_control-panel_workcell_v2.0.1 (circuit boards with their own pages; 121 MB of STEP with them)"+    ],+    "panels": "the 9 bare 'BaseSaffoldPanel 5 hole 1.6mm' panels (FR4 only) were hidden and a local copy of 'Base Scaffold 5 HOLES' v4 (the panel PCB with its 36 contacts, adom/base-scaffold-panel) placed at each panel position, offset (+16, +16, 0) mm from the bare panel corner so the contacts land on the sheet's contact clearance pockets",+    "appearances": {+      "contacts": "Gold - Polished (design: Plastic - Matte (Black) placeholder)",+      "ABS (White) parts": "Plastic - Matte (White), because Fusion writes ABS (White) to STEP as black: Middle slide support:1, Middle slide support:2, ControlPannelMount_Scaffold:1, ControlPanel_ScaffoldConnectorPinCover:1"+    },+    "saved": false+  },+  "frame": {+    "units": "mm",+    "up": "+Z",+    "note": "Fusion assembly coordinates; the panel field is centered near X = Y = 0"+  },+  "files": {+    "cad/base-scaffold.step": {+      "format": "STEP AP214 with colors",+      "bytes": 7261119,+      "sha256": "877b455b636679f4cc7f6913fa174c33b6701c26b39bff480cb5f8e77f363ba6",+      "producer": "cad/tools/export_scaffold.py via fusion_run_modeling_script (Fusion exportManager)"+    },+    "cad/base-scaffold.glb": {+      "format": "glTF 2.0 binary, KHR_mesh_quantization, Z-up content",+      "bytes": 4156116,+      "sha256": "2ab7313a333a55b27d1a9bed55496cf1f23b04bbb533c5a844524014009ed18e",+      "producer": "step2glb convert (service-step2glb v1.9.5), then cad/tools/glb_finish.py (finish per Fusion appearance), then cad/tools/glb_dedup.mjs (lossless, 6.9 MB to 4.2 MB so the 3D widget can load it)"+    }+  },+  "renders": "screenshots/scaffold-current-*.png: the GLB in model-viewer 3.5.0, headless Chrome"+}
cad/tools/export_scaffold.pyadded+116
@@ -0,0 +1,116 @@+# Export the current base scaffold ('Base Scaffold Assembly', Main) as STEP with real contact panels.+# The assembly's 9 panels are 'BaseSaffoldPanel 5 hole 1.6mm' (bare FR4, no contacts). In memory only,+# this places a local copy of 'Base Scaffold 5 HOLES' (the panel with its 36 contacts) at each panel,+# hides the bare panels, gives the contacts 'Gold - Polished', exports, and closes WITHOUT saving.+# Scaffold only: the workcell-side 'Base Scaffold Rail Panel Assembly' and the old v2.0.1+# control-panel circuit board (own wiki page) are hidden, so they stay out of the STEP.+import os, json, time, traceback+ASM = 'urn:adsk.wipprod:dm.lineage:0KMYcZqHRFa0uKDmV7QO8Q'+PANEL5 = 'urn:adsk.wipprod:dm.lineage:qYUGHjbdRKGe-Dwb6BSu6Q'+outdir = os.path.join(os.path.expanduser('~'), 'Downloads', 'adom-scaffold-panel')+os.makedirs(outdir, exist_ok=True)+rep = {'activeBefore': app.activeDocument.name if app.activeDocument else None}+t0 = time.time(); doc = None+def colors_of(ap):+    out = None+    try:+        for i in range(ap.appearanceProperties.count):+            p = ap.appearanceProperties.item(i)+            if isinstance(p, adsk.core.ColorProperty) and p.value:+                c = p.value; out = [c.red, c.green, c.blue, c.opacity]; break+    except Exception: pass+    return out+try:+    adf = app.data.findFileById(ASM)+    rep['assembly'] = [adf.name, adf.versionNumber]+    doc = app.documents.open(adf, False)+    des = adsk.fusion.Design.cast(doc.products.itemByProductType('DesignProductType'))+    root = des.rootComponent+    bare = [o for o in root.allOccurrences if o.component.name == 'BaseSaffoldPanel 5 hole 1.6mm']+    rep['barePanels'] = len(bare)+    pdf = app.data.findFileById(PANEL5)+    rep['panel'] = [pdf.name, pdf.versionNumber]+    placed = []+    first = None+    for o in bare:+        bb = o.boundingBox  # world, cm; bare panel local x/y 0.019..19.181 cm, z -0.001..0.161+        m = adsk.core.Matrix3D.create()+        m.translation = adsk.core.Vector3D.create(bb.minPoint.x - 0.019 + 1.6, bb.minPoint.y - 0.019 + 1.6, bb.minPoint.z + 0.001)+        if first is None:+            first = root.occurrences.addByInsert(pdf, m, False)+            new = first+        else:+            new = root.occurrences.addExistingComponent(first.component, m)+        placed.append([round(bb.minPoint.x*10,2), round(bb.minPoint.y*10,2), round(bb.minPoint.z*10,2)])+    rep['placedAtBareMinMm'] = placed+    hid = 0; hideErr = None+    for o in bare:+        try:+            o.isLightBulbOn = False; hid += 1+        except Exception as e:+            hideErr = str(e)+    rep['hidden'] = hid; rep['hideErr'] = hideErr+    skipped = []+    for o in list(root.occurrences) + list(root.allOccurrences):+        if o.component.name.startswith('Base Scaffold Rail Panel Assembly') or o.component.name.startswith('OLD_control-panel'):+            if o.isLightBulbOn:+                o.isLightBulbOn = False; skipped.append(o.fullPathName)+    rep['hiddenForScaffoldOnly'] = skipped+    gold_lib = app.materialLibraries.itemByName('Fusion Appearance Library').appearances.itemByName('Gold - Polished')+    gold = des.appearances.itemByName('Gold - Polished') or des.appearances.addByCopy(gold_lib, 'Gold - Polished')+    n = 0+    for o in first.component.allOccurrences:+        if o.component.name == 'MpinContact_Large v1':+            for b in o.component.bRepBodies:+                b.appearance = gold; n += 1+    rep['contactBodiesGold'] = n+    # 'ABS (White)' exports to STEP as black (its first color property is black), so give those+    # occurrences a white plastic from the library for the export only.+    applib = app.materialLibraries.itemByName('Fusion Appearance Library').appearances+    white_lib = None+    for nm in ('Plastic - Matte (White)', 'Plastic - Glossy (White)', 'Plastic - Translucent Matte (White)'):+        white_lib = applib.itemByName(nm)+        if white_lib: break+    white = des.appearances.itemByName(white_lib.name) or des.appearances.addByCopy(white_lib, white_lib.name)+    absfix = []+    for o in root.allOccurrences:+        if not o.isVisible: continue+        bodies = [b for b in o.bRepBodies if b.isVisible and b.appearance and b.appearance.name == 'ABS (White)']+        if bodies:+            try:+                o.appearance = white; absfix.append([o.fullPathName, 'occurrence'])+            except Exception as e:+                for b in bodies:+                    try: b.appearance = white; absfix.append([o.fullPathName, 'body'])+                    except Exception as e2: absfix.append([o.fullPathName, 'FAILED ' + str(e2)[:60]])+    rep['absWhiteFix'] = {'appearance': white.name, 'parts': absfix}+    # appearance inventory of everything visible (for the GLB material pass)+    aps = {}+    def visit(comp, occ_visible=True):+        pass+    for b in list(root.bRepBodies):+        if b.isVisible and b.appearance: aps.setdefault(b.appearance.name, colors_of(b.appearance))+    for o in root.allOccurrences:+        if not o.isVisible: continue+        for b in o.bRepBodies:+            if b.isVisible:+                ap = b.appearance+                if ap: aps.setdefault(ap.name, colors_of(ap))+    rep['appearances'] = aps+    bb = root.boundingBox+    rep['bboxMm'] = [round(v*10,1) for v in (bb.minPoint.x,bb.minPoint.y,bb.minPoint.z,bb.maxPoint.x,bb.maxPoint.y,bb.maxPoint.z)]+    em = des.exportManager+    step_path = os.path.join(outdir, 'base-scaffold-v%d.step' % adf.versionNumber)+    rep['stepOk'] = em.execute(em.createSTEPExportOptions(step_path, root))+    rep['stepBytes'] = os.path.getsize(step_path) if os.path.exists(step_path) else None+    rep['stepPath'] = step_path+except Exception:+    rep['error'] = traceback.format_exc()+finally:+    if doc is not None:+        try: doc.close(False); rep['closed'] = True+        except Exception as e: rep['closeError'] = str(e)+rep['activeAfter'] = app.activeDocument.name if app.activeDocument else None+rep['totalSec'] = round(time.time() - t0, 1)+json.dump(rep, open(os.path.join(outdir, 'scaffold-export-report.json'), 'w'), indent=1)+result = rep
cad/tools/glb_dedup.mjsadded+9
@@ -0,0 +1,9 @@+// glb_dedup.mjs in.glb out.glb : lossless dedup + prune (no instancing or compression extensions, so the widget and viewer load it); needs @gltf-transform/core, functions, extensions 4.1.1+import { NodeIO } from '@gltf-transform/core';+import { ALL_EXTENSIONS } from '@gltf-transform/extensions';+import { dedup, prune } from '@gltf-transform/functions';+const [src, dst] = process.argv.slice(2);+const io = new NodeIO().registerExtensions(ALL_EXTENSIONS);+const doc = await io.read(src);+await doc.transform(dedup(), prune());+await io.write(dst, doc);
cad/tools/glb_finish.pyadded+102
@@ -0,0 +1,102 @@+#!/usr/bin/env python3+"""Give a step2glb GLB of the base scaffold (or one panel) the finishes of its Fusion appearances.++STEP carries only a color per body, so step2glb leaves metallic/roughness unset and glTF then+renders every part as rough metal. This pass finds each material by the parts (node names) that+use it and sets the finish of their Fusion appearance. Parts whose STEP color is wrong get their+own material: 'ABS (White)' parts arrive black unless the export overrode them.+Run it BEFORE any instancing/flattening pass: those drop the node names it keys on.++Usage: glb_finish.py in.glb out.glb+"""+import json, struct, sys++# part-name prefix -> (appearance label, metallic, roughness, sRGB color override or None)+PARTS = [+    ('MpinContact_Large', 'Gold - Polished (contacts)', 1.0, 0.25, None),+    ('1-copper', 'Copper (pads and plating)', 1.0, 0.35, None),+    ('64-copper', 'Copper (pads and plating)', 1.0, 0.35, None),+    ('1-soldermask', 'Soldermask (black)', 0.0, 0.6, None),+    ('64-soldermask', 'Soldermask (black)', 0.0, 0.6, None),+    ('Board', 'FR4', 0.0, 0.7, None),+    ('WB00_BaseScaffoldAlignmentSheet', 'Aluminum - Satin', 1.0, 0.45, None),+    ('BHCS', 'Aluminum - Satin', 1.0, 0.45, None),+    ('hex_socket_button_head', 'Steel (screws)', 1.0, 0.4, None),+    ('FHCS', 'Steel (screws)', 1.0, 0.4, None),+    ('M3 Square Nut', 'Steel - Satin', 1.0, 0.4, None),+    ('Slider_Back', 'Plastic - Matte (Black)', 0.0, 0.7, None),+    ('Slider_Front', 'Plastic - Matte (Black)', 0.0, 0.7, None),+    ('UHMW Tape', 'Plastic - Translucent Matte (White)', 0.0, 0.6, None),+    ('BaseScaffold_Handle', 'Plastic', 0.0, 0.5, None),+    ('ControlPanel_ScaffoldConnectorPinCover', 'ABS (White)', 0.0, 0.5, (235, 235, 230)),+    ('ControlPannelMount_Scaffold', 'ABS (White)', 0.0, 0.5, (235, 235, 230)),+    ('Middle slide support', 'ABS (White)', 0.0, 0.5, (235, 235, 230)),+]+++def lin(c):+    c = c / 255.0+    return c / 12.92 if c <= 0.04045 else ((c + 0.055) / 1.055) ** 2.4+++def rule(name):+    for p, label, metal, rough, col in PARTS:+        if name.startswith(p):+            return label, metal, rough, col+    return None+++def main(src, dst):+    b = open(src, 'rb').read()+    jlen = struct.unpack('<I', b[12:16])[0]+    g = json.loads(b[20:20 + jlen])+    rest = b[20 + jlen:]+    mats = g['materials']+    made = {}       # (old material index, label) -> new material index, for recolored parts+    votes = {}      # material index -> {rule: uses}; a shared material takes its majority part's finish+    unmatched = set()+    for n in g['nodes']:+        if 'mesh' not in n:+            continue+        r = rule(n.get('name', ''))+        if not r:+            unmatched.add(n.get('name', '').split(':')[0])+            continue+        label, metal, rough, col = r+        for p in g['meshes'][n['mesh']]['primitives']:+            mi = p.get('material')+            if mi is None:+                continue+            if col is not None:+                key = (mi, label)+                if key not in made:+                    m = json.loads(json.dumps(mats[mi]))+                    m['name'] = label+                    m['pbrMetallicRoughness']['baseColorFactor'] = [lin(c) for c in col] + [1.0]+                    m['pbrMetallicRoughness']['metallicFactor'] = metal+                    m['pbrMetallicRoughness']['roughnessFactor'] = rough+                    mats.append(m)+                    made[key] = len(mats) - 1+                p['material'] = made[key]+            else:+                v = votes.setdefault(mi, {})+                v[r] = v.get(r, 0) + 1+    for mi, v in votes.items():+        label, metal, rough, _ = max(v, key=v.get)+        pbr = mats[mi].setdefault('pbrMetallicRoughness', {})+        pbr['metallicFactor'] = metal+        pbr['roughnessFactor'] = rough+        mats[mi]['name'] = label+    j = json.dumps(g, separators=(',', ':')).encode()+    j += b' ' * ((4 - len(j) % 4) % 4)+    out = struct.pack('<III', 0x46546C67, 2, 12 + 8 + len(j) + len(rest)) + struct.pack('<II', len(j), 0x4E4F534A) + j + rest+    open(dst, 'wb').write(out)+    for i, m in enumerate(mats):+        pbr = m.get('pbrMetallicRoughness', {})+        print(i, m.get('name'), [round(x, 3) for x in pbr.get('baseColorFactor', [])[:3]], pbr.get('metallicFactor'), pbr.get('roughnessFactor'))+    if unmatched:+        print('parts with no rule (finish left unset):', sorted(unmatched))+++if __name__ == '__main__':+    main(*sys.argv[1:3])