← Garden room - 4x3 - Design Profile Demo

Right Wall Front Pier

v3 Gemini approved

Create the right front pier OSB/EPS SIP wall panel, 122mm wide x 1078mm long x 500mm high. Include a horizontal spline joint on its bottom edge to lock into the right wall bottom top spline groove. Provide a vertical spline groove on its back face and horizontal spline groove on top.

Dependencies

right_wall_bottom.top_spline

Interfaces Provided

top_spline (spline)
◉
Agent initialized (status: waiting_for_dependencies, action: check_dependencies)
◉
Provider: google | Profile: balanced
◇
Received interface right_wall_bottom.top_spline: %{name: "top_spline", type: "spline", value: %{}, agent_id: "right_wall_bottom"}
◉
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)
◉
Provider updated to google / balanced
●
Received response (2067 tokens)
◆
right_wall_front_pier_v1.py · 153 lines
import FreeCAD
import Part
import math
from FreeCAD import Vector

# === PARAMETRIC CONSTANTS ===
WIDTH = 122         # Thickness of the SIP panel (X)
LENGTH = 1078       # Length of the panel (Y)
HEIGHT = 500        # Height of the panel (Z)

OSB_THICKNESS = 11
CORE_THICKNESS = WIDTH - 2 * OSB_THICKNESS  # 100mm

SPLINE_W = 45       # Width of the timber block spline
SPLINE_D = 45       # Depth of the spline groove (half of a 90mm spline)

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

# === BUILD GEOMETRY ===
# 1. Base Panel Layers
face1 = Part.makeBox(OSB_THICKNESS, LENGTH, HEIGHT, Vector(0, 0, 0))
core = Part.makeBox(CORE_THICKNESS, LENGTH, HEIGHT, Vector(OSB_THICKNESS, 0, 0))
face2 = Part.makeBox(OSB_THICKNESS, LENGTH, HEIGHT, Vector(WIDTH - OSB_THICKNESS, 0, 0))

# Combine into a single solid panel
panel = face1.fuse(core).fuse(face2)

# Calculate spline lateral position (centred in the core)
spline_x_start = OSB_THICKNESS + (CORE_THICKNESS / 2.0) - (SPLINE_W / 2.0)

# 2. Cut Receiving Grooves (Top and Back)
# Top horizontal groove (Z from HEIGHT - SPLINE_D to HEIGHT)
top_groove = Part.makeBox(SPLINE_W, LENGTH, SPLINE_D,
                          Vector(spline_x_start, 0, HEIGHT - SPLINE_D))

# Back vertical groove (Y from LENGTH - SPLINE_D to LENGTH)
back_groove = Part.makeBox(SPLINE_W, SPLINE_D, HEIGHT,
                           Vector(spline_x_start, LENGTH - SPLINE_D, 0))

panel = panel.cut(top_groove)
panel = panel.cut(back_groove)

# 3. Add Protruding Bottom Spline (Tongue)
# Projects downwards from Z=0 to Z=-SPLINE_D
bottom_spline = Part.makeBox(SPLINE_W, LENGTH, SPLINE_D,
                             Vector(spline_x_start, 0, -SPLINE_D))

final_shape = panel.fuse(bottom_spline)
final_shape = final_shape.removeSplitter()

# === PART CODE ===
PART_CODE = "C-6"
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

final_shape = _emboss_part_code(final_shape, PART_CODE)

# === ADD TO DOCUMENT ===
obj = doc.addObject("Part::Feature", "Body")
obj.Shape = final_shape

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
◇
Received interface right_wall_bottom.top_spline: %{name: "top_spline", type: "spline", value: %{}, agent_id: "right_wall_bottom"}
◇
Received interface right_wall_bottom.top_spline: %{name: "top_spline", type: "spline", value: %{}, agent_id: "right_wall_bottom"}
◉
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
◇
Received interface right_wall_bottom.top_spline: %{name: "top_spline", type: "spline", value: %{}, agent_id: "right_wall_bottom"}
◉
Upstream interface changed: right_wall_bottom.top_spline
◉
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)
◉
Provider updated to google / balanced
◉
Provider updated to google / balanced
●
Received response (1874 tokens)
◆
right_wall_front_pier_v2.py · 140 lines
import FreeCAD
import Part
import math
from FreeCAD import Vector

# === PARAMETERS ===
WIDTH = 122          # Panel thickness (11mm OSB + 100mm EPS + 11mm OSB)
LENGTH = 1078        # Panel length (Y-axis)
HEIGHT = 500         # Panel height (Z-axis)

OSB_T = 11           # OSB facing thickness
CORE_T = 100         # EPS core thickness
GROOVE_DEPTH = 45    # Standard SIP foam routing depth for block splines

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

# === BUILD GEOMETRY ===
# 1. Outer OSB Face (Left, X=0)
face1 = Part.makeBox(OSB_T, LENGTH, HEIGHT, Vector(0, 0, 0))

# 2. Inner OSB Face (Right, X=111)
face2 = Part.makeBox(OSB_T, LENGTH, HEIGHT, Vector(WIDTH - OSB_T, 0, 0))

# 3. EPS Core (Recessed for grooves)
# - Bottom horizontal groove: core starts at Z = 45
# - Top horizontal groove: core stops 45mm short of HEIGHT
# - Back vertical groove: core stops 45mm short of LENGTH (Y-axis)
# - Front face: flush (no groove)
core_y_len = LENGTH - GROOVE_DEPTH
core_z_len = HEIGHT - (2 * GROOVE_DEPTH)

core = Part.makeBox(CORE_T, core_y_len, core_z_len, Vector(OSB_T, 0, GROOVE_DEPTH))

# Fuse layers together
panel = face1.fuse(core).fuse(face2)
panel = panel.removeSplitter()

# === PART CODE ===
PART_CODE = "C-6"
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

final_shape = _emboss_part_code(panel, PART_CODE)

# === ADD TO DOCUMENT ===
obj = doc.addObject("Part::Feature", "Body")
obj.Shape = final_shape
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)
◉
Upstream interface changed: right_wall_bottom.top_spline
◉
Provider updated to google / balanced
◉
Regeneration requested by user
◉
Generating v3
○
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: right_wall_bottom.top_spline
●
Received response (2082 tokens)
◆
right_wall_front_pier_v3.py · 154 lines
import FreeCAD
import Part
from FreeCAD import Vector

# === PARAMETERS ===
# Bounding box dimensions
WIDTH_X = 122          # Panel thickness (11mm OSB + 100mm EPS + 11mm OSB)
LENGTH_Y = 1078        # Panel length
HEIGHT_Z = 500         # Panel height

# SIP layer dimensions
FACE_THICKNESS = 11    # OSB
CORE_THICKNESS = 100   # EPS

# Spline groove dimensions (Standard for SIP-100 block spline)
GROOVE_W = 90
GROOVE_D = 22.5
GROOVE_X_OFFSET = (WIDTH_X - GROOVE_W) / 2  # Centered in panel (16mm from edge)

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

# === BUILD PANEL LAYERS ===
# Face 1 (Exterior OSB)
face1 = Part.makeBox(FACE_THICKNESS, LENGTH_Y, HEIGHT_Z, Vector(0, 0, 0))

# Core (EPS Foam)
core = Part.makeBox(CORE_THICKNESS, LENGTH_Y, HEIGHT_Z, Vector(FACE_THICKNESS, 0, 0))

# Face 2 (Interior OSB)
face2 = Part.makeBox(FACE_THICKNESS, LENGTH_Y, HEIGHT_Z, Vector(FACE_THICKNESS + CORE_THICKNESS, 0, 0))

# Fuse layers into a single solid panel
panel = face1.fuse(core).fuse(face2)

# === CUT SPLINE GROOVES ===
# 1. Bottom horizontal groove (Z=0)
bottom_groove = Part.makeBox(GROOVE_W, LENGTH_Y, GROOVE_D, 
                             Vector(GROOVE_X_OFFSET, 0, 0))

# 2. Top horizontal groove (Z = HEIGHT_Z - GROOVE_D)
top_groove = Part.makeBox(GROOVE_W, LENGTH_Y, GROOVE_D, 
                          Vector(GROOVE_X_OFFSET, 0, HEIGHT_Z - GROOVE_D))

# 3. Back vertical groove (Y = LENGTH_Y - GROOVE_D)
back_groove = Part.makeBox(GROOVE_W, GROOVE_D, HEIGHT_Z, 
                           Vector(GROOVE_X_OFFSET, LENGTH_Y - GROOVE_D, 0))

# Apply all groove cuts
panel = panel.cut(bottom_groove).cut(top_groove).cut(back_groove)
panel = panel.removeSplitter()  # Clean up coplanar faces

# === PART CODE ===
PART_CODE = "C-6"
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

# === FINAL OUTPUT ===
final_shape = _emboss_part_code(panel, PART_CODE)

obj = doc.addObject("Part::Feature", "Right_Front_Pier_Panel")
obj.Shape = final_shape
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 (v3)
◉
Provider updated to google / balanced
◉
Provider updated to google / balanced
v0.0.985