← 模型のページへ作り方再生成

Rebuild / 再生成

Inputs and tools

FreeCAD must expose its FreeCAD, Part, MeshPart, TechDraw and FreeCADGui modules to the matching embedded Python, not an unrelated system Python. Set FREECAD_PYTHON to that executable and FREECAD_LIB to its module directory on your installation. No personal machine path is hardcoded in this repository. On a desktop, use a separate headless process rather than taking over an already open document.

python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
npm ci
npm run vendor

METRICS_SITE_PACKAGES=$(.venv/bin/python -c 'import site; print(site.getsitepackages()[0])')
export PYTHONPATH="$FREECAD_LIB:$METRICS_SITE_PACKAGES:scripts"

python3 scripts/design.py
.venv/bin/python -m unittest discover -s tests -v

FREECAD_USER_HOME="$PWD/build/freecad-profile" QT_QPA_PLATFORM=offscreen OMP_NUM_THREADS=2 \
  PYTHONPATH="$FREECAD_LIB:$METRICS_SITE_PACKAGES:scripts" \
  "$FREECAD_PYTHON" scripts/freecad_build.py

PYTHONPATH="$FREECAD_LIB:$METRICS_SITE_PACKAGES:scripts" \
  "$FREECAD_PYTHON" scripts/verify_cad.py
.venv/bin/python scripts/verify_meshes.py
PYTHONPATH="$FREECAD_LIB:$METRICS_SITE_PACKAGES:scripts" \
  "$FREECAD_PYTHON" scripts/verify_front_nameplate.py
node tests/motion.mjs
PYTHONPATH="$FREECAD_LIB:$METRICS_SITE_PACKAGES:scripts" \
  "$FREECAD_PYTHON" scripts/freecad_details.py
.venv/bin/python scripts/build_drawings.py
.venv/bin/python scripts/package_prints.py

freecad_build.py saves genuine FCStd files with view colors, STEP, per-part binary STL, and hidden-line CAD projections. It uses Qt's offscreen backend, not the user's interactive CAD document. On the tested macOS package Qt warns that offscreen OpenGL widgets are unsupported; solid generation, TechDraw projections, native appearance serialization and subsequent reopen are verified separately. No screenshot is substituted for a native model.

Intermediate BREP caches and render frames live under ignored build/. A cache key includes the mechanical source and parameter hashes. A changed fit value requires regenerating the full affected set, not mixing an old STL with new documentation.

Blender and media

blender --background --factory-startup --threads 2 \
  --python scripts/blender_scene.py -- --model A
blender --background --factory-startup --threads 2 site/downloads/A/A.blend \
  --python scripts/blender_verify.py -- --model A
python3 scripts/render_movies.py --model A
.venv/bin/python scripts/sanitize_artifacts.py --model A
blender --background --factory-startup --threads 2 site/downloads/A/A.blend \
  --python scripts/blender_verify.py -- --model A

Repeat sequentially for B and C; do not launch multiple high-CPU renders. The scene contains the actual delivered STL meshes, original instance IDs and catalogue transforms. Geometry is converted from millimetres to metres explicitly; the Blender scene uses metric units. Blender Workbench is used as an actual studio renderer, not a physics simulation. Objects arrive in the numbered assembly order, followed by a completed-object turntable. The still and frames are rendered by Blender. ffmpeg encodes H.264/yuv420p MP4 with faststart. The native .blend and every movie are reopened/decoded independently.

The black text module changes to white after 2.4 mm; the independent logo changes after 2.8 mm. White relief is real geometry, not a texture. Print the two modules on separate plates; no AMS is required. Text relief is1.2mm in revision5; logo relief remains0.8mm. The existing rear carrier is unchanged, but assembly depth grows0.4mm. The generic URL placeholder is now github.com/USER. METRICS_SITE_PACKAGES must belong to the same Python ABI/architecture as the FreeCAD embedded interpreter. If the selected environment cannot import NumPy/SciPy/Shapely and the FreeCAD Qt wrapper together, stop and select a matching environment; do not skip the lettering checks.

For a typography-only revision, the mechanical reuse check deliberately excludes text-only parameters/functions but still compares the full carrier/receiver/keeper/logo functions and dimensions. --reuse-baseline takes a locally preserved, verified source/catalog snapshot; it does not import old history. package_prints.py --update-parts NP3-TEXT-A NP3-TEXT-B NP3-TEXT-C rewrites only the three relevant3MF files after checking every original layout hash and occurrence count. Re-run verify_3mf.py afterward. update_blender_plaques.py swaps only that one mesh in each saved scene and removes orphan data. render_plaque_revision.py --model B --baseline PATH preserves the verified movie interval before the plaque appears, then actually rerenders all affected frames. It never relabels unchanged old footage as a newly rendered full movie. Use build_lettering_coupons.py for same-scale trial glyphs and verify_lettering.py --baseline-cache PATH --preview-folder PATH for actual native measurements.

For a geometry-identical prior cache, --reuse-baseline checks unchanged brick-function ASTs, the interface and delivered mesh hashes. --reuse-preview reuses the approved B geometry only when its recipe and per-part inputs match. Modified metadata does not justify unverified geometry reuse. The non-text meshes, dimensions and placements are checked against design/public-template-invariants.json. The unselected individual variant is withheld from public distribution and is not rebuilt by this workflow. Public parameters are checked against design/publication-policy.json. For private values, use the separate ignored-output command in the customization guide, not the public build.

Static site

The common viewer has an explicit input/mapping/offline contract. Its source data is the already-verified catalog, model assembly, actual print-plate manifests, STL and 3MF files. It verifies every print occurrence against the assembly by part ID and color. It does not invent a one-to-one physical identity for interchangeable copies.

npm ci
npm run build:assembly-guide
.venv/bin/python scripts/build_public_assembly_guides.py
.venv/bin/python -m unittest discover -s tests -p test_assembly_guide.py -v
node tests/assembly_guide_model.mjs
.venv/bin/python tests/assembly_guide_browser.py \
  --entry site/assembly-guide/B.html --all-models --capture-media

Only the public wrapper enforces the generic publication policy. For private input, use the root-independent build_assembly_guide.py with explicit paths and --standalone in the private destination; do not regenerate the public catalog with private text. The offline ZIPs contain a self-contained HTML viewer, correspondence JSON and the Three.js MIT notice. They contain no printer profile or G-code. Runtime bundling adds no network dependency. The annotated new guide images/video are captured from this real STL viewer, not claimed to be new Blender renders. The existing native scenes and movies remain unchanged.

python3 -m http.server 8000 --directory site
npm test
BASE_URL=http://127.0.0.1:8000/ npm run test:web

For a repository-subpath check, serve the parent directory with a copilot-brick-display mapping or use the local prefix server in scripts/serve.py. The Playwright test can use BROWSER_PATH to select an installed browser, otherwise install its matching Chromium using npx playwright install chromium. The runtime Three.js files and MIT notice are vendored: the public viewer does not need a CDN.

GitHub Pages deploys only site/ using the checked-in workflow. Source, native files, drawings, media, messages and notices are public; original photos, personal paths and session history are not. Do not commit build/, virtual environments, dependencies, generated frame sequences, or credentials.

After a design edit

  1. Regenerate layout and geometry; run unit, BREP, mesh and assembly checks.
  2. Rebuild projections, PDFs, BOM/print bundles, 3MF layouts, Blender scenes and videos.
  3. Confirm catalogue/mesh hashes, color/quantity/placement correspondence and reachable assembly.
  4. Request independent review of the fixed changed snapshot. A previous review is not blanket approval.
  5. Audit the public package and deploy. Print calibration coupons again before printing the object.