← Garden room - 4x3 - Design Profile Demo

Front Left Wall Panel

v2 Gemini approved

Create the front left OSB/EPS SIP wall panel, 1453x122x2310mm. Include a spline joint on its left edge to mate with the corner post spline groove, and a vertical spline groove on its right edge for the door header. Base sits on the sole plate.

Dependencies

front_left_sole_plate.top_face front_left_corner_post.right_spline

Interfaces Provided

top_face (face) header_spline (spline)
◉
Agent initialized (status: waiting_for_dependencies, action: check_dependencies)
◉
Provider: google | Profile: balanced
◇
Received interface front_left_sole_plate.top_face: %{name: "top_face", type: "face", value: %{}, agent_id: "front_left_sole_plate"}
◇
Received interface front_left_corner_post.right_spline: %{name: "right_spline", type: "spline", value: %{}, agent_id: "front_left_corner_post"}
◉
All dependencies resolved, starting generation
◉
Generating v1
◇
Received interface front_left_corner_post.back_spline: %{name: "back_spline", type: "spline", value: %{}, agent_id: "front_left_corner_post"}
○
Calling Gemini API for code generation (gemini-3.1-pro-preview)...
◉
Generation token budget: max_tokens=12288, thinking_budget=0 (retry_count=0)
◉
Provider updated to google / balanced
●
Received response (1316 tokens)
◆
front_left_sip_v1.py · 90 lines
This component represents the front left SIP wall panel, incorporating a standard 1200mm section and a custom 253mm remainder to achieve the 1453mm target width. It features an integrated block spline protruding on the left edge for corner mating, and leaves a 22.5mm deep core groove on the right edge to receive the door header's frame spline.

```python
import FreeCAD
import Part
import math
import os
from FreeCAD import Vector

# === PARAMETERS ===
LENGTH = 1453        # Panel total width (X)
WIDTH = 122          # Panel thickness (Y)
HEIGHT = 2310        # Panel height (Z)

FACE_THICKNESS = 11  # OSB face thickness
CORE_THICKNESS = 100 # EPS core thickness (SIP-100)
SPLINE_W = 45        # Block spline width

PANEL_1_W = 1200     # First standard panel width
PANEL_2_W = LENGTH - PANEL_1_W  # Remainder panel width (253mm)

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

shapes = []

# --- Panel 1 (1200mm) ---
p1_f1 = Part.makeBox(PANEL_1_W, FACE_THICKNESS, HEIGHT, Vector(0, 0, 0))
# Core is recessed by 22.5mm on both left and right edges for splines
p1_core = Part.makeBox(PANEL_1_W - SPLINE_W, CORE_THICKNESS, HEIGHT, Vector(SPLINE_W/2, FACE_THICKNESS, 0))
p1_f2 = Part.makeBox(PANEL_1_W, FACE_THICKNESS, HEIGHT, Vector(0, FACE_THICKNESS + CORE_THICKNESS, 0))
shapes.extend([p1_f1, p1_core, p1_f2])

# --- Left Spline ---
# Protruding tongue to mate with the corner post groove
left_spline = Part.makeBox(SPLINE_W, CORE_THICKNESS, HEIGHT, Vector(-SPLINE_W/2, FACE_THICKNESS, 0))
shapes.append(left_spline)

# --- Middle Spline ---
# Block spline joining Panel 1 and Panel 2
mid_spline = Part.makeBox(SPLINE_W, CORE_THICKNESS, HEIGHT, Vector(PANEL_1_W - SPLINE_W/2, FACE_THICKNESS, 0))
shapes.append(mid_spline)

# --- Panel 2 (253mm) ---
p2_f1 = Part.makeBox(PANEL_2_W, FACE_THICKNESS, HEIGHT, Vector(PANEL_1_W, 0, 0))
# Core is recessed by 22.5mm on the left (for mid spline) and right (leaving the groove for door header)
p2_core = Part.makeBox(PANEL_2_W - SPLINE_W, CORE_THICKNESS, HEIGHT, Vector(PANEL_1_W + SPLINE_W/2, FACE_THICKNESS, 0))
p2_f2 = Part.makeBox(PANEL_2_W, FACE_THICKNESS, HEIGHT, Vector(PANEL_1_W, FACE_THICKNESS + CORE_THICKNESS, 0))
shapes.extend([p2_f1, p2_core, p2_f2])

# Fuse all parts into a solid panel structure
result = shapes[0]
for s in shapes[1:]:
    result = result.fuse(s)

# Refine shape to remove internal coplanar face seams
result = result.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
●
Executing in FreeCAD...
✖
FreeCAD execution failed: Traceback (most recent call last): File "/opt/freecad/bin/../Mod/CadClaude/cadclaude_worker.py", line 159, in _run_script exec(compile(script_source, "<cadclaude>", "exec"), {}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<cadclaude>", line 1 This component represents the front left SIP wall panel, incorporating a standard 1200mm section and a custom 253mm remainder to achieve the 1453mm target width. It features an integrated block spline protruding on the left edge for corner mating, and leaves a 22.5mm deep core groove on the right edge to receive the door header's frame spline. ^ SyntaxError: invalid decimal literal
◉
Retrying (attempt 2/4)
●
Received corrected script, re-executing...
●
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
◉
Upstream interface changed: front_left_sole_plate.top_face
◇
Received interface front_left_corner_post.right_spline: %{name: "right_spline", type: "spline", value: %{}, agent_id: "front_left_corner_post"}
◇
Received interface front_left_corner_post.back_spline: %{name: "back_spline", type: "spline", value: %{}, agent_id: "front_left_corner_post"}
◉
Regeneration requested by user
◉
Generating v2
○
Calling Gemini API for code generation (gemini-3.1-pro-preview)...
◉
Generation token budget: max_tokens=12288, thinking_budget=0 (retry_count=0)
◉
Upstream interface changed: front_left_corner_post.right_spline
●
Received response (1816 tokens)
◆
front_left_sip_v2.py · 140 lines
import FreeCAD
import Part
from FreeCAD import Vector

# === PARAMETRIC CONSTANTS ===
LENGTH = 1453.0         # mm
THICKNESS = 122.0       # mm
HEIGHT = 2310.0         # mm

OSB_THICKNESS = 11.0    # mm
CORE_THICKNESS = 100.0  # mm
GROOVE_DEPTH = 45.0     # mm (Recess depth for splines, sole plate, and top plate)

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

# === GEOMETRY ===
# Front OSB Face
osb_front = Part.makeBox(LENGTH, OSB_THICKNESS, HEIGHT, Vector(0, 0, 0))

# Back OSB Face
osb_back = Part.makeBox(LENGTH, OSB_THICKNESS, HEIGHT, Vector(0, THICKNESS - OSB_THICKNESS, 0))

# EPS Core (routed back on all four edges to receive structural timber)
core_length = LENGTH - (2 * GROOVE_DEPTH)
core_height = HEIGHT - (2 * GROOVE_DEPTH)
eps_core = Part.makeBox(
    core_length, 
    CORE_THICKNESS, 
    core_height, 
    Vector(GROOVE_DEPTH, OSB_THICKNESS, GROOVE_DEPTH)
)

# Fuse skins and core into a single SIP panel
panel = osb_front.fuse(eps_core).fuse(osb_back)
panel = panel.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

# Apply part code
panel = _emboss_part_code(panel, PART_CODE)

# === FINAL ===
obj = doc.addObject("Part::Feature", "SIP_Front_Left_Panel")
obj.Shape = panel

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 (v2)
◉
Provider updated to google
◉
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
v0.0.985