← shed

Front South Wall

v1 Claude approved

Create the front facade SIP wall, 2000mm length x 122mm width x 1856mm height (11mm OSB3 / 100mm EPS / 11mm OSB3). Include a 900x1878mm centered cutout for the door opening starting from the bottom edge. The bottom edge and top edge foam core must be recessed by 45mm deep x 100mm wide to form a rebate_spline connection for timber plates.

Dependencies

foundation.floor_surface

Interfaces Provided

inner_face (face) top_edge (edge)
◉
Agent initialized (status: waiting_for_dependencies, action: check_dependencies)
◉
Provider: google | Profile: balanced
◇
Received interface foundation.floor_surface: %{name: "floor_surface", type: "surface", value: %{}, agent_id: "foundation"}
◉
All dependencies resolved, starting generation
◉
Generating v1
○
Calling Gemini API for code generation (gemini-3.1-pro-preview)...
◉
Generation token budget: max_tokens=12288, thinking_budget=0 (retry_count=0)
●
Received response (1983 tokens)
◆
south_wall_v1.py · 158 lines
import FreeCAD
import Part
import math
from FreeCAD import Vector

# === ANCHOR POINTS ===
# === END ANCHOR POINTS ===

# === PARAMETERS ===
LENGTH = 2000         # mm - total wall span
WIDTH = 122           # mm - total wall thickness
HEIGHT = 1856         # mm - total wall height

FACE_THICKNESS = 11   # mm - OSB3 facing
CORE_THICKNESS = 100  # mm - EPS foam core

DOOR_W = 900          # mm - door opening width
DOOR_H = 1878         # mm - door opening height
RECESS_DEPTH = 45     # mm - recess for top/bottom timber plates

# === DOCUMENT ===
doc = FreeCAD.ActiveDocument or FreeCAD.newDocument("SIP_Wall")

# === BUILD GEOMETRY ===
# 1. Construct the SIP panel layers
face1 = Part.makeBox(LENGTH, FACE_THICKNESS, HEIGHT, Vector(0, 0, 0))
core = Part.makeBox(LENGTH, CORE_THICKNESS, HEIGHT, Vector(0, FACE_THICKNESS, 0))
face2 = Part.makeBox(LENGTH, FACE_THICKNESS, HEIGHT, Vector(0, FACE_THICKNESS + CORE_THICKNESS, 0))

# Fuse into a single solid body
wall = face1.fuse([core, face2]).removeSplitter()

# 2. Define cutting tools
# Centered Door Cutout
door_x = (LENGTH - DOOR_W) / 2
door_cut = Part.makeBox(DOOR_W, WIDTH + 2, DOOR_H, Vector(door_x, -1, 0))

# Bottom Core Recess (routes out foam core at the base)
bottom_recess = Part.makeBox(
    LENGTH, 
    CORE_THICKNESS, 
    RECESS_DEPTH, 
    Vector(0, FACE_THICKNESS, 0)
)

# Top Core Recess (routes out foam core at the top)
top_recess = Part.makeBox(
    LENGTH, 
    CORE_THICKNESS, 
    RECESS_DEPTH, 
    Vector(0, FACE_THICKNESS, HEIGHT - RECESS_DEPTH)
)

# 3. Apply cuts
result = wall.cut([door_cut, bottom_recess, top_recess]).removeSplitter()

# === PART CODE ===
PART_CODE = "C-1"
PRINT_SCALE = 50  # 1:50 model scale — adjust if printing at a different scale

def _emboss_part_code(shape, code, print_scale=PRINT_SCALE):
    """Cut part code into largest face. Returns shape unmodified on any failure."""
    import os, math
    depth_raw = 0.6 * print_scale
    try:
        # --- font ---
        rd = FreeCAD.getResourceDir()
        font = None
        for fn in ("osifont-lgpl3fe.ttf", "FreeSans.ttf", "FreeCAD.ttf"):
            fp = os.path.join(rd, "Mod", "TechDraw", "Resources", "fonts", fn)
            if os.path.exists(fp):
                font = fp; break
        if font is None:
            return shape

        # --- cap depth at 33% of thinnest component dimension ---
        all_dims = sorted([shape.BoundBox.XLength, shape.BoundBox.YLength, shape.BoundBox.ZLength])
        depth = min(depth_raw, all_dims[0] * 0.33)

        # --- find largest face ---
        best = max(shape.Faces, key=lambda f: f.Area)
        n = best.normalAt(0, 0)
        c = best.CenterOfMass

        # --- text height: 2 mm at print scale, capped at 80% of longest face edge ---
        fb = best.BoundBox
        fb_dims = sorted([d for d in (fb.XLength, fb.YLength, fb.ZLength) if d > 1.0])
        text_h = min(2.0 * print_scale, (fb_dims[-1] * 0.80) if fb_dims else 2.0 * print_scale)

        # --- orthonormal face frame: right (r), up (u), out (n) ---
        wz = Vector(0, 0, 1)
        wy = Vector(0, 1, 0)
        up_ref = wy if abs(n.dot(wz)) > 0.9 else wz
        r = up_ref.cross(n).normalize()
        u = n.cross(r).normalize()

        # --- build text faces from wires (handles letters with holes) ---
        ss = Part.makeShapeString(String=code, FontFile=font, Size=text_h, Tracking=0)
        wires = sorted(ss.Wires, key=lambda w: w.BoundBox.DiagonalLength, reverse=True)
        faces_out = []
        used = set()
        for i, ow in enumerate(wires):
            if i in used:
                continue
            ob = ow.BoundBox
            holes = []
            for j, iw in enumerate(wires):
                if j <= i or j in used:
                    continue
                ib = iw.BoundBox
                if ob.XMin < ib.XMin and ob.XMax > ib.XMax and ob.YMin < ib.YMin and ob.YMax > ib.YMax:
                    holes.append(iw)
                    used.add(j)
            used.add(i)
            try:
                faces_out.append(Part.Face([ow] + holes) if holes else Part.Face(ow))
            except Exception:
                try:
                    faces_out.append(Part.Face(ow))
                except Exception:
                    pass
        if not faces_out:
            return shape
        tf = Part.Compound(faces_out) if len(faces_out) > 1 else faces_out[0]

        # --- combined matrix: center text → rotate onto face → translate to face center ---
        tb = tf.BoundBox
        mc = FreeCAD.Matrix()          # center text at local origin
        mc.A14 = -tb.XLength / 2
        mc.A24 = -tb.YLength / 2
        mr = FreeCAD.Matrix()          # rotate: X→r, Y→u, Z→n
        mr.A11 = r.x;  mr.A12 = u.x;  mr.A13 = n.x
        mr.A21 = r.y;  mr.A22 = u.y;  mr.A23 = n.y
        mr.A31 = r.z;  mr.A32 = u.z;  mr.A33 = n.z
        mt = FreeCAD.Matrix()          # translate to face center, offset 5% outward
        mt.A14 = c.x + n.x * depth * 0.05
        mt.A24 = c.y + n.y * depth * 0.05
        mt.A34 = c.z + n.z * depth * 0.05
        tf2 = tf.transformGeometry(mt.multiply(mr.multiply(mc)))

        # --- extrude inward and cut ---
        extrude_vec = Vector(-n.x * depth * 1.1, -n.y * depth * 1.1, -n.z * depth * 1.1)
        text_solid = tf2.extrude(extrude_vec)
        return shape.cut(text_solid)

    except Exception as e:
        print(f"[part_code] emboss skipped: {e}")
        return shape

result = _emboss_part_code(result, PART_CODE)

# === ADD TO DOCUMENT ===
feature = doc.addObject("Part::Feature", "SIP_Front_Facade")
feature.Shape = result

doc.recompute()
if FreeCAD.GuiUp:
    FreeCAD.Gui.ActiveDocument.ActiveView.fitAll()
●
Executing in FreeCAD...
◉
StepAnalyzer failed: FreeCAD could not read STEP file: FreeCAD exception thrown (File to load not existing or not readable) — skipping
●
FreeCAD execution succeeded
●
Exported: model.stl
◉
Generation succeeded and component was auto-approved (v1)
◉
Provider updated to google / balanced
◉
Provider updated to google / balanced
◉
Provider updated to google / balanced
◉
Provider updated to google / balanced
◉
Provider updated to google / balanced
◉
Provider updated to google / balanced
◉
Provider updated to google / balanced
◉
Provider updated to google / balanced
◉
Provider updated to google / balanced
◉
Provider updated to google / balanced
◉
Provider updated to anthropic / balanced
v0.0.985