[{"data":1,"prerenderedAt":1338},["ShallowReactive",2],{"en-blog-detail-/en/blog/20261119-parametric-python-cad-build123d-klipper-workflow-2026-12-03":3,"en-blog-linked-project-/en/blog/20261119-parametric-python-cad-build123d-klipper-workflow-2026-12-03":1323,"en-blog-ko-counterpart-/en/blog/20261119-parametric-python-cad-build123d-klipper-workflow-2026-12-03":1328,"en-blog-surround-/en/blog/20261119-parametric-python-cad-build123d-klipper-workflow-2026-12-03":1329},{"id":4,"title":5,"adsEnabled":6,"author":7,"body":8,"buildLogLabel":1303,"category":1304,"coverImage":1305,"coverImageAlt":1306,"date":1307,"description":1308,"extension":1309,"faq":1310,"meta":1311,"navigation":6,"noindex":1312,"path":1313,"project":1314,"promo":1312,"seo":1315,"seoDescription":1310,"seoTitle":1310,"status":1316,"stem":1317,"tags":1318,"__hash__":1322},"enBlog/en/blog/20261119-Parametric-Python-CAD-Build123d-Klipper-Workflow.md","Designing Hardware with Python Instead of a Mouse: build123d Parametric CAD & Klipper High-Speed 3D Printing",true,"KangSum",{"type":9,"value":10,"toc":1292},"minimark",[11,15,19,46,49,54,80,100,219,237,239,243,260,267,275,688,734,738,752,920,922,926,936,988,990,994,1017,1050,1202,1226,1228,1232,1235,1282,1288],[12,13,5],"h1",{"id":14},"designing-hardware-with-python-instead-of-a-mouse-build123d-parametric-cad-klipper-high-speed-3d-printing",[16,17,18],"p",{},"Running a photography studio, wet darkroom, and custom lighting studio means constantly needing non-standard mechanical hardware that off-the-shelf catalogs simply do not carry. From overhead lighting batten brackets and large-diameter optical filter adapters to eccentric view-camera lens boards and chemical-resistant agitation jigs, almost every fixture demands bespoke dimensions tailored to a specific barrel diameter, pipe gauge, or mounting thread.",[16,20,21,22,27,28,37,38,41,42,45],{},"Early on, I relied on conventional mouse-driven GUI CAD paired with a stock FDM 3D printer. That setup broke down quickly under real iteration: changing a single mounting dimension would shatter downstream fillets and sketch references, while mechanical resonances across a large gantry introduced unpredictable dimensional drift from print to print. In this build log—part of the ",[23,24,26],"a",{"href":25},"/en/projects/klipper-kinematics-studio-cad","Klipper Kinematics Retrofit & Parametric Studio CAD project","—I walk through how moving geometry into ",[29,30,31,32,36],"strong",{},"version-controlled Python code (",[33,34,35],"code",{},"build123d"," and FreeCAD macros)"," and upgrading the motion platform with ",[29,39,40],{},"MGN12H linear rails and ADXL345-calibrated Klipper vibration control"," delivered repeatable ",[29,43,44],{},"±0.05 mm"," precision at high print speeds.",[47,48],"hr",{},[50,51,53],"h2",{"id":52},"_1-why-mouse-driven-cad-breaks-tnp-and-the-shift-to-python-code","1. Why Mouse-Driven CAD Breaks (TNP) and the Shift to Python Code",[16,55,56,57,60,61,60,64,67,68,71,72,75,76,79],{},"Studio batten pipe brackets (",[33,58,59],{},"Ø25 mm",", ",[33,62,63],{},"Ø32 mm",[33,65,66],{},"Ø38 mm",") and optical mounts undergo relentless specification churn: a clamping bolt moves from M4 to M5, or a fixture switches to a ",[33,69,70],{},"1/4-20 UNC"," brass heat-set insert. Under a traditional history-based GUI CAD workflow, this kind of routine variation triggers its most notorious structural bottleneck: the ",[29,73,74],{},"Topological Naming Problem (TNP)",". When you click a face in the viewport (",[33,77,78],{},"Face_6",") to attach a counterbored hole or edge fillet, the model binds to an ephemeral internal index. Edit an upstream sketch thickness later, and the geometry kernel renumbers the generated faces—cascading failures down the entire feature tree.",[16,81,82,83,87,88,91,92,95,96,99],{},"I initially used FreeCAD Python macros to automate repetitive dimension updates before consolidating onto ",[29,84,85],{},[33,86,35],{},", which runs on the exact same industrial ",[29,89,90],{},"OpenCascade (OCCT) BREP kernel"," while exposing a clean, declarative Python API. Unlike mesh-based CSG tools such as OpenSCAD, an OCCT BREP pipeline generates exact analytical arcs, reliable variable-radius fillets, and lossless ",[33,93,94],{},".step"," solids ready for third-party CNC machining alongside ",[33,97,98],{},".stl"," exports for local 3D printing.",[101,102,103,123],"table",{},[104,105,106],"thead",{},[107,108,109,114,117],"tr",{},[110,111,113],"th",{"align":112},"left","Dimension",[110,115,116],{"align":112},"History-Based GUI CAD (Mouse-Driven)",[110,118,119,120,122],{"align":112},"Code-First Python ",[33,121,35],{}," CAD",[124,125,126,146,159,178,198],"tbody",{},[107,127,128,134,140],{},[129,130,131],"td",{"align":112},[29,132,133],{},"Geometry Reference Model",[129,135,136,137,139],{"align":112},"Binds to transient internal IDs at click time (",[33,138,78],{},")",[129,141,142,143,139],{"align":112},"Resolves dynamically via geometric predicates (",[33,144,145],{},"faces().sort_by(Axis.Z)[-1]",[107,147,148,153,156],{},[129,149,150],{"align":112},[29,151,152],{},"Dimensional Change Resilience",[129,154,155],{"align":112},"Upstream sketch edits cascade into broken fillets and references (TNP)",[129,157,158],{"align":112},"Re-evaluates topological selectors cleanly across diameter and bolt changes",[107,160,161,166,169],{},[129,162,163],{"align":112},[29,164,165],{},"Multi-Variant Generation",[129,167,168],{"align":112},"Manual file duplication, edits, and one-by-one STL exports",[129,170,171,172,174,175,177],{"align":112},"Single script execution batch-generates ",[33,173,94],{}," and ",[33,176,98],{}," across all specs",[107,179,180,185,188],{},[129,181,182],{"align":112},[29,183,184],{},"Shrinkage & Tolerance Propagation",[129,186,187],{"align":112},"Manual sketch offsets per feature, prone to silent omissions",[129,189,190,191,174,194,197],{"align":112},"Global ",[33,192,193],{},"shrinkage",[33,195,196],{},"clearance"," parameters propagate into every equation",[107,199,200,205,208],{},[129,201,202],{"align":112},[29,203,204],{},"Version Control & Diffing",[129,206,207],{"align":112},"Opaque binary project files; impossible to audit minor tolerance tweaks",[129,209,210,211,214,215,218],{"align":112},"Plain-text ",[33,212,213],{},".py"," source tracked in Git with line-level ",[33,216,217],{},"0.05 mm"," tolerance diffs",[220,221,222],"blockquote",{},[16,223,224,227,228,231,232,236],{},[29,225,226],{},"Key Takeaway:","\nThe real advantage of code-first CAD is not typing instead of clicking—it is ",[29,229,230],{},"declaring geometric design intent in code"," (for example, ",[233,234,235],"em",{},"\"the outer vertical edges intersecting the topmost Z plane\"",") rather than latching onto fragile internal face indices. Dimensions can shift drastically without collapsing the feature tree, and every tolerance revision lives as an auditable Git commit.",[47,238],{},[50,240,242],{"id":241},"_2-parameter-table-driven-batch-export-for-step-stl","2. Parameter-Table-Driven Batch Export for STEP & STL",[16,244,245,246,252,253,255,256,259],{},"To prevent tolerance drift across variants, I decoupled the geometric modeling routine from a ",[29,247,248,249,139],{},"typed specification and tolerance table (",[33,250,251],{},"dataclass",". Supplying a pipe diameter, M4/M5 bolt size, heat-set insert bore, material thermal shrinkage factor (",[33,254,193],{},"), and mechanical assembly clearance (",[33,257,258],{},"clearance = 0.20",") immediately compiles production-ready solids with zero manual viewport intervention.",[16,261,262],{},[263,264],"img",{"alt":265,"src":266},"End-to-end engineering pipeline diagram from Python build123d parametric specification and BREP solid generation to Klipper Input Shaper vibration-compensated 3D printing","/images/content-images/blog/20261119-Parametric-Python-CAD-Build123d-Klipper-Workflow/20261119-Parametric-Python-CAD-Build123d-Klipper-Workflow002.png",[268,269,271,272,274],"h3",{"id":270},"_21-build123d-studio-bracket-optical-mount-generator","2.1. ",[33,273,35],{}," Studio Bracket & Optical Mount Generator",[276,277,282],"pre",{"className":278,"code":279,"language":280,"meta":281,"style":281},"language-python shiki shiki-themes github-light github-dark","from dataclasses import dataclass\nfrom pathlib import Path\nfrom build123d import *\n\n\n@dataclass(frozen=True)\nclass MountSpec:\n    name: str\n    pipe_dia: float          # Pipe or lens barrel outer diameter (mm)\n    wall_t: float            # Wall thickness (mm)\n    height: float            # Extrusion / print height (mm)\n    bolt_dia: float          # Clamping bolt nominal diameter (M4=4.0, M5=5.0)\n    cbore_dia: float         # Counterbore diameter (mm)\n    insert_dia: float        # Heat-set insert pilot hole diameter (mm)\n    insert_depth: float      # Insert bore depth (mm)\n    shrinkage: float = 1.004 # Material thermal shrinkage factor (PETG=1.004, ASA=1.007)\n    clearance: float = 0.20  # Assembly fit clearance (mm)\n\n\ndef build_studio_mount(spec: MountSpec) -> Part:\n    inner_r = (spec.pipe_dia * spec.shrinkage) / 2.0 + spec.clearance\n    outer_r = inner_r + spec.wall_t\n    ear_span = outer_r + 14.0\n\n    with BuildPart() as part:\n        with BuildSketch(Plane.XY):\n            Circle(radius=outer_r)\n            with Locations((ear_span / 2.0, 0)):\n                Rectangle(ear_span, 18.0)\n            Circle(radius=inner_r, mode=Mode.SUBTRACT)\n            with Locations((ear_span / 2.0, 0)):\n                Rectangle(ear_span, 2.4, mode=Mode.SUBTRACT)\n        extrude(amount=spec.height)\n\n        with Locations(Plane.XZ.offset(-9.0)):\n            with Locations((outer_r + 6.5, spec.height / 2.0)):\n                CounterBoreHole(\n                    radius=(spec.bolt_dia + spec.clearance) / 2.0,\n                    counter_bore_radius=(spec.cbore_dia + spec.clearance) / 2.0,\n                    counter_bore_depth=4.2,\n                    depth=18.0,\n                )\n\n        top_face = part.faces().sort_by(Axis.Z)[-1]\n        with Locations(top_face):\n            with PolarLocations(radius=(inner_r + outer_r) / 2.0, count=2, start_angle=120, angular_range=120):\n                Hole(radius=(spec.insert_dia * spec.shrinkage) / 2.0, depth=spec.insert_depth)\n\n        outer_edges = (\n            part.edges()\n            .filter_by(Axis.Z)\n            .filter_by_position(Axis.X, minimum=outer_r - 1.0, maximum=ear_span + 2.0)\n        )\n        fillet(outer_edges, radius=1.8)\n\n    return part.part\n\n\nPRESETS = [\n    MountSpec(\"batten_32mm_m5_petg\", 32.0, 6.0, 24.0, 5.0, 9.0, 5.6, 6.5, 1.004, 0.20),\n    MountSpec(\"optic_rod_25mm_m4_asa\", 25.0, 5.5, 20.0, 4.0, 7.5, 5.6, 6.5, 1.007, 0.20),\n]\n\nout_dir = Path(\"./dist/studio-mounts\")\nout_dir.mkdir(parents=True, exist_ok=True)\nfor spec in PRESETS:\n    solid = build_studio_mount(spec)\n    export_step(solid, out_dir / f\"{spec.name}.step\")\n    export_stl(solid, out_dir / f\"{spec.name}.stl\", tolerance=0.01, angular_tolerance=0.05)\n","python","",[33,283,284,292,298,304,310,315,321,327,333,339,345,351,357,363,369,375,381,387,392,397,403,409,415,421,426,432,438,444,450,456,462,467,473,479,484,490,496,502,508,514,520,526,532,537,543,549,555,561,566,572,578,584,590,596,602,607,613,618,623,629,635,641,647,652,658,664,670,676,682],{"__ignoreMap":281},[285,286,289],"span",{"class":287,"line":288},"line",1,[285,290,291],{},"from dataclasses import dataclass\n",[285,293,295],{"class":287,"line":294},2,[285,296,297],{},"from pathlib import Path\n",[285,299,301],{"class":287,"line":300},3,[285,302,303],{},"from build123d import *\n",[285,305,307],{"class":287,"line":306},4,[285,308,309],{"emptyLinePlaceholder":6},"\n",[285,311,313],{"class":287,"line":312},5,[285,314,309],{"emptyLinePlaceholder":6},[285,316,318],{"class":287,"line":317},6,[285,319,320],{},"@dataclass(frozen=True)\n",[285,322,324],{"class":287,"line":323},7,[285,325,326],{},"class MountSpec:\n",[285,328,330],{"class":287,"line":329},8,[285,331,332],{},"    name: str\n",[285,334,336],{"class":287,"line":335},9,[285,337,338],{},"    pipe_dia: float          # Pipe or lens barrel outer diameter (mm)\n",[285,340,342],{"class":287,"line":341},10,[285,343,344],{},"    wall_t: float            # Wall thickness (mm)\n",[285,346,348],{"class":287,"line":347},11,[285,349,350],{},"    height: float            # Extrusion / print height (mm)\n",[285,352,354],{"class":287,"line":353},12,[285,355,356],{},"    bolt_dia: float          # Clamping bolt nominal diameter (M4=4.0, M5=5.0)\n",[285,358,360],{"class":287,"line":359},13,[285,361,362],{},"    cbore_dia: float         # Counterbore diameter (mm)\n",[285,364,366],{"class":287,"line":365},14,[285,367,368],{},"    insert_dia: float        # Heat-set insert pilot hole diameter (mm)\n",[285,370,372],{"class":287,"line":371},15,[285,373,374],{},"    insert_depth: float      # Insert bore depth (mm)\n",[285,376,378],{"class":287,"line":377},16,[285,379,380],{},"    shrinkage: float = 1.004 # Material thermal shrinkage factor (PETG=1.004, ASA=1.007)\n",[285,382,384],{"class":287,"line":383},17,[285,385,386],{},"    clearance: float = 0.20  # Assembly fit clearance (mm)\n",[285,388,390],{"class":287,"line":389},18,[285,391,309],{"emptyLinePlaceholder":6},[285,393,395],{"class":287,"line":394},19,[285,396,309],{"emptyLinePlaceholder":6},[285,398,400],{"class":287,"line":399},20,[285,401,402],{},"def build_studio_mount(spec: MountSpec) -> Part:\n",[285,404,406],{"class":287,"line":405},21,[285,407,408],{},"    inner_r = (spec.pipe_dia * spec.shrinkage) / 2.0 + spec.clearance\n",[285,410,412],{"class":287,"line":411},22,[285,413,414],{},"    outer_r = inner_r + spec.wall_t\n",[285,416,418],{"class":287,"line":417},23,[285,419,420],{},"    ear_span = outer_r + 14.0\n",[285,422,424],{"class":287,"line":423},24,[285,425,309],{"emptyLinePlaceholder":6},[285,427,429],{"class":287,"line":428},25,[285,430,431],{},"    with BuildPart() as part:\n",[285,433,435],{"class":287,"line":434},26,[285,436,437],{},"        with BuildSketch(Plane.XY):\n",[285,439,441],{"class":287,"line":440},27,[285,442,443],{},"            Circle(radius=outer_r)\n",[285,445,447],{"class":287,"line":446},28,[285,448,449],{},"            with Locations((ear_span / 2.0, 0)):\n",[285,451,453],{"class":287,"line":452},29,[285,454,455],{},"                Rectangle(ear_span, 18.0)\n",[285,457,459],{"class":287,"line":458},30,[285,460,461],{},"            Circle(radius=inner_r, mode=Mode.SUBTRACT)\n",[285,463,465],{"class":287,"line":464},31,[285,466,449],{},[285,468,470],{"class":287,"line":469},32,[285,471,472],{},"                Rectangle(ear_span, 2.4, mode=Mode.SUBTRACT)\n",[285,474,476],{"class":287,"line":475},33,[285,477,478],{},"        extrude(amount=spec.height)\n",[285,480,482],{"class":287,"line":481},34,[285,483,309],{"emptyLinePlaceholder":6},[285,485,487],{"class":287,"line":486},35,[285,488,489],{},"        with Locations(Plane.XZ.offset(-9.0)):\n",[285,491,493],{"class":287,"line":492},36,[285,494,495],{},"            with Locations((outer_r + 6.5, spec.height / 2.0)):\n",[285,497,499],{"class":287,"line":498},37,[285,500,501],{},"                CounterBoreHole(\n",[285,503,505],{"class":287,"line":504},38,[285,506,507],{},"                    radius=(spec.bolt_dia + spec.clearance) / 2.0,\n",[285,509,511],{"class":287,"line":510},39,[285,512,513],{},"                    counter_bore_radius=(spec.cbore_dia + spec.clearance) / 2.0,\n",[285,515,517],{"class":287,"line":516},40,[285,518,519],{},"                    counter_bore_depth=4.2,\n",[285,521,523],{"class":287,"line":522},41,[285,524,525],{},"                    depth=18.0,\n",[285,527,529],{"class":287,"line":528},42,[285,530,531],{},"                )\n",[285,533,535],{"class":287,"line":534},43,[285,536,309],{"emptyLinePlaceholder":6},[285,538,540],{"class":287,"line":539},44,[285,541,542],{},"        top_face = part.faces().sort_by(Axis.Z)[-1]\n",[285,544,546],{"class":287,"line":545},45,[285,547,548],{},"        with Locations(top_face):\n",[285,550,552],{"class":287,"line":551},46,[285,553,554],{},"            with PolarLocations(radius=(inner_r + outer_r) / 2.0, count=2, start_angle=120, angular_range=120):\n",[285,556,558],{"class":287,"line":557},47,[285,559,560],{},"                Hole(radius=(spec.insert_dia * spec.shrinkage) / 2.0, depth=spec.insert_depth)\n",[285,562,564],{"class":287,"line":563},48,[285,565,309],{"emptyLinePlaceholder":6},[285,567,569],{"class":287,"line":568},49,[285,570,571],{},"        outer_edges = (\n",[285,573,575],{"class":287,"line":574},50,[285,576,577],{},"            part.edges()\n",[285,579,581],{"class":287,"line":580},51,[285,582,583],{},"            .filter_by(Axis.Z)\n",[285,585,587],{"class":287,"line":586},52,[285,588,589],{},"            .filter_by_position(Axis.X, minimum=outer_r - 1.0, maximum=ear_span + 2.0)\n",[285,591,593],{"class":287,"line":592},53,[285,594,595],{},"        )\n",[285,597,599],{"class":287,"line":598},54,[285,600,601],{},"        fillet(outer_edges, radius=1.8)\n",[285,603,605],{"class":287,"line":604},55,[285,606,309],{"emptyLinePlaceholder":6},[285,608,610],{"class":287,"line":609},56,[285,611,612],{},"    return part.part\n",[285,614,616],{"class":287,"line":615},57,[285,617,309],{"emptyLinePlaceholder":6},[285,619,621],{"class":287,"line":620},58,[285,622,309],{"emptyLinePlaceholder":6},[285,624,626],{"class":287,"line":625},59,[285,627,628],{},"PRESETS = [\n",[285,630,632],{"class":287,"line":631},60,[285,633,634],{},"    MountSpec(\"batten_32mm_m5_petg\", 32.0, 6.0, 24.0, 5.0, 9.0, 5.6, 6.5, 1.004, 0.20),\n",[285,636,638],{"class":287,"line":637},61,[285,639,640],{},"    MountSpec(\"optic_rod_25mm_m4_asa\", 25.0, 5.5, 20.0, 4.0, 7.5, 5.6, 6.5, 1.007, 0.20),\n",[285,642,644],{"class":287,"line":643},62,[285,645,646],{},"]\n",[285,648,650],{"class":287,"line":649},63,[285,651,309],{"emptyLinePlaceholder":6},[285,653,655],{"class":287,"line":654},64,[285,656,657],{},"out_dir = Path(\"./dist/studio-mounts\")\n",[285,659,661],{"class":287,"line":660},65,[285,662,663],{},"out_dir.mkdir(parents=True, exist_ok=True)\n",[285,665,667],{"class":287,"line":666},66,[285,668,669],{},"for spec in PRESETS:\n",[285,671,673],{"class":287,"line":672},67,[285,674,675],{},"    solid = build_studio_mount(spec)\n",[285,677,679],{"class":287,"line":678},68,[285,680,681],{},"    export_step(solid, out_dir / f\"{spec.name}.step\")\n",[285,683,685],{"class":287,"line":684},69,[285,686,687],{},"    export_stl(solid, out_dir / f\"{spec.name}.stl\", tolerance=0.01, angular_tolerance=0.05)\n",[16,689,690,691,174,694,697,698,60,701,60,704,707,708,711,712,715,716,719,720,723,724,726,727,729,730,733],{},"Notice how ",[33,692,693],{},"top_face",[33,695,696],{},"outer_edges"," are selected strictly through spatial predicates (",[33,699,700],{},"sort_by(Axis.Z)[-1]",[33,702,703],{},"filter_by(Axis.Z)",[33,705,706],{},"filter_by_position(Axis.X, ...)","). Whether ",[33,709,710],{},"PRESETS"," generates a ",[33,713,714],{},"32 mm"," batten clamp in PETG or a ",[33,717,718],{},"25 mm"," optical rod mount in ASA, the counterbore alignment, polar insert bosses, and ",[33,721,722],{},"1.8 mm"," external edge fillets resolve cleanly on the first run—producing both ",[33,725,94],{}," archival CAD and fine-tessellation ",[33,728,98],{}," (",[33,731,732],{},"tolerance=0.01",") in a single pass.",[268,735,737],{"id":736},"_22-empirical-clearance-matrix-by-polymer-nozzle-profile","2.2. Empirical Clearance Matrix by Polymer & Nozzle Profile",[16,739,740,741,744,745,174,748,751],{},"The table below captures our caliper-verified fit matrix for a ",[29,742,743],{},"0.4 mm nozzle at 0.2 mm layer height",". Because studio fixtures sit directly beside hot continuous lamps and undergo sustained clamping loads, production hardware is printed almost exclusively in ",[29,746,747],{},"PETG",[29,749,750],{},"ASA",", reserving PLA for quick form-factor checks.",[101,753,754,782],{},[104,755,756],{},[107,757,758,761,767,773,779],{},[110,759,760],{"align":112},"Interface & Mechanical Purpose",[110,762,763,764,139],{"align":112},"PLA (",[33,765,766],{},"1.002",[110,768,769,770,139],{"align":112},"PETG (",[33,771,772],{},"1.004",[110,774,775,776,139],{"align":112},"ASA (",[33,777,778],{},"1.007",[110,780,781],{"align":112},"Engineering Baseline (0.4 mm Nozzle)",[124,783,784,809,833,860,889],{},[107,785,786,791,796,801,806],{},[129,787,788],{"align":112},[29,789,790],{},"Bearing & Dowel Press Fit",[129,792,793],{"align":112},[33,794,795],{},"+0.05 mm",[129,797,798],{"align":112},[33,799,800],{},"+0.06 mm",[129,802,803],{"align":112},[33,804,805],{},"+0.08 mm",[129,807,808],{"align":112},"Zero-play interference fit under arbor press",[107,810,811,816,821,825,830],{},[129,812,813],{"align":112},[29,814,815],{},"Optical Filter Rotation Ring (Sliding Fit)",[129,817,818],{"align":112},[33,819,820],{},"+0.12 mm",[129,822,823],{"align":112},[33,824,820],{},[129,826,827],{"align":112},[33,828,829],{},"+0.15 mm",[129,831,832],{"align":112},"Smooth dry-friction rotational damping",[107,834,835,840,845,850,854],{},[129,836,837],{"align":112},[29,838,839],{},"Pipe Clamp & Bolt Clearance (Standard)",[129,841,842],{"align":112},[33,843,844],{},"+0.18 mm",[129,846,847],{"align":112},[33,848,849],{},"+0.20 mm",[129,851,852],{"align":112},[33,853,849],{},[129,855,856,857,859],{"align":112},"Bind-free standard ",[33,858,196],{}," baseline",[107,861,862,867,872,877,882],{},[129,863,864],{"align":112},[29,865,866],{},"M4 Heat-Set Insert Pilot Bore",[129,868,869],{"align":112},[33,870,871],{},"Ø 5.50 mm",[129,873,874],{"align":112},[33,875,876],{},"Ø 5.60 mm",[129,878,879],{"align":112},[33,880,881],{},"Ø 5.65 mm",[129,883,884,885,888],{"align":112},"Thermal staking for ",[33,886,887],{},"6.0 mm"," OD brass inserts",[107,890,891,899,902,908,913],{},[129,892,893],{"align":112},[29,894,895,896,139],{},"77 mm Optical Thread (",[33,897,898],{},"P=0.75",[129,900,901],{"align":112},"Excluded (low HDT)",[129,903,904,907],{"align":112},[33,905,906],{},"+0.14 mm"," offset",[129,909,910,907],{"align":112},[33,911,912],{},"+0.16 mm",[129,914,915,916,919],{"align":112},"Printed at ",[33,917,918],{},"0.12 mm"," layers for barrel mating",[47,921],{},[50,923,925],{"id":924},"_3-large-format-box-frame-retrofit-mgn12h-linear-rails-direct-drive","3. Large-Format Box-Frame Retrofit: MGN12H Linear Rails & Direct Drive",[16,927,928,929,931,932,935],{},"Even a mathematically flawless ",[33,930,98],{}," means very little if the printer's own mechanical frame introduces backlash. To print large-diameter optical baffles and multi-point brackets as single monolithic pieces without glue seams, I retrofitted a ",[29,933,934],{},"350 × 350 × 400 mm cube box-frame chassis (Ender-5 Plus base)"," across three core kinematic subsystems:",[937,938,939,954,974],"ul",{},[940,941,942,945,946,949,950,953],"li",{},[29,943,944],{},"X/Y-Axis MGN12H Linear Rail Conversion:"," The factory POM V-slot wheels developed flat spots and uneven preload over time, turning circular bores into subtle ellipses under direction reversals. Replacing them with ",[33,947,948],{},"450 mm"," high-carbon steel ",[29,951,952],{},"MGN12H linear rails"," locked lateral gantry play down to effectively zero during rapid accelerations.",[940,955,956,959,960,963,964,973],{},[29,957,958],{},"Direct-Drive Extruder Conversion:"," Removing the stock ",[33,961,962],{},"800 mm"," Bowden tube and mounting a lightweight direct-drive extruder directly above the hotend slashed retraction distance from ",[29,965,966,969,970],{},[33,967,968],{},"6.5 mm"," down to ",[33,971,972],{},"0.6 mm",". That single change eliminated PETG stringing across fine internal threads and drastically improved extrusion pressure responsiveness.",[940,975,976,983,984,987],{},[29,977,978,979,982],{},"Independent Dual-Z Synchronization (",[33,980,981],{},"z_tilt_adjust","):"," Driving the left and right Z leadscrews from independent stepper channels allows Klipper to probe and level the ",[33,985,986],{},"350 mm"," build plate automatically before every job, preventing first-layer skew across wide fixtures.",[47,989],{},[50,991,993],{"id":992},"_4-adxl345-resonance-profiling-klipper-input-shaper-pressure-advance","4. ADXL345 Resonance Profiling, Klipper Input Shaper & Pressure Advance",[16,995,996,997,1000,1001,1004,1005,1008,1009,1012,1013,1016],{},"When a heavy large-format gantry accelerates rapidly, structural resonance leaves periodic surface ripples (",[29,998,999],{},"ringing / ghosting",") along sharp transitions and eats directly into internal bore tolerances. Under ",[29,1002,1003],{},"Klipper",", I wired an ",[29,1006,1007],{},"ADXL345 accelerometer"," directly to the toolhead over SPI to sweep the mechanical frequency response from ",[33,1010,1011],{},"10 Hz"," to ",[33,1014,1015],{},"130 Hz",".",[16,1018,1019,1020,1025,1026,1031,1032,1037,1038,1043,1044,1049],{},"The measured spectral peaks dictated asymmetric shaper choices per axis: the lighter X-axis peaked cleanly at ",[29,1021,1022],{},[33,1023,1024],{},"46.2 Hz",", allowing the sharper ",[29,1027,1028],{},[33,1029,1030],{},"MZV"," shaper with minimal corner smoothing, while the heavier Y-axis carriage exhibited a broader resonance band around ",[29,1033,1034],{},[33,1035,1036],{},"38.4 Hz",", making the wider-attenuation ",[29,1039,1040],{},[33,1041,1042],{},"EI"," shaper far more effective at suppressing residual vibrations. To prevent corner bulging from skewing square housings and clamp slots at high speed, I also calibrated dynamic melt-zone pressure compensation to ",[29,1045,1046],{},[33,1047,1048],{},"pressure_advance = 0.042"," for our primary PETG filament profile.",[276,1051,1055],{"className":1052,"code":1053,"language":1054,"meta":281,"style":281},"language-ini shiki shiki-themes github-light github-dark","# Klipper printer.cfg — kinematics, resonance compensation & extrusion tuning excerpt\n[printer]\nkinematics: cartesian\nmax_velocity: 250\nmax_accel: 4500\nsquare_corner_velocity: 5.0\n\n[adxl345]\ncs_pin: rpi:None\nspi_bus: spidev0.0\n\n[resonance_tester]\naccel_chip: adxl345\nprobe_points: 175, 175, 30\n\n[input_shaper]\nshaper_freq_x: 46.2\nshaper_type_x: mzv\nshaper_freq_y: 38.4\nshaper_type_y: ei\n\n[extruder]\nnozzle_diameter: 0.400\nfilament_diameter: 1.750\npressure_advance: 0.042\npressure_advance_smooth_time: 0.040\n\n[firmware_retraction]\nretract_length: 0.60\nretract_speed: 35\n","ini",[33,1056,1057,1062,1067,1072,1077,1082,1087,1091,1096,1101,1106,1110,1115,1120,1125,1129,1134,1139,1144,1149,1154,1158,1163,1168,1173,1178,1183,1187,1192,1197],{"__ignoreMap":281},[285,1058,1059],{"class":287,"line":288},[285,1060,1061],{},"# Klipper printer.cfg — kinematics, resonance compensation & extrusion tuning excerpt\n",[285,1063,1064],{"class":287,"line":294},[285,1065,1066],{},"[printer]\n",[285,1068,1069],{"class":287,"line":300},[285,1070,1071],{},"kinematics: cartesian\n",[285,1073,1074],{"class":287,"line":306},[285,1075,1076],{},"max_velocity: 250\n",[285,1078,1079],{"class":287,"line":312},[285,1080,1081],{},"max_accel: 4500\n",[285,1083,1084],{"class":287,"line":317},[285,1085,1086],{},"square_corner_velocity: 5.0\n",[285,1088,1089],{"class":287,"line":323},[285,1090,309],{"emptyLinePlaceholder":6},[285,1092,1093],{"class":287,"line":329},[285,1094,1095],{},"[adxl345]\n",[285,1097,1098],{"class":287,"line":335},[285,1099,1100],{},"cs_pin: rpi:None\n",[285,1102,1103],{"class":287,"line":341},[285,1104,1105],{},"spi_bus: spidev0.0\n",[285,1107,1108],{"class":287,"line":347},[285,1109,309],{"emptyLinePlaceholder":6},[285,1111,1112],{"class":287,"line":353},[285,1113,1114],{},"[resonance_tester]\n",[285,1116,1117],{"class":287,"line":359},[285,1118,1119],{},"accel_chip: adxl345\n",[285,1121,1122],{"class":287,"line":365},[285,1123,1124],{},"probe_points: 175, 175, 30\n",[285,1126,1127],{"class":287,"line":371},[285,1128,309],{"emptyLinePlaceholder":6},[285,1130,1131],{"class":287,"line":377},[285,1132,1133],{},"[input_shaper]\n",[285,1135,1136],{"class":287,"line":383},[285,1137,1138],{},"shaper_freq_x: 46.2\n",[285,1140,1141],{"class":287,"line":389},[285,1142,1143],{},"shaper_type_x: mzv\n",[285,1145,1146],{"class":287,"line":394},[285,1147,1148],{},"shaper_freq_y: 38.4\n",[285,1150,1151],{"class":287,"line":399},[285,1152,1153],{},"shaper_type_y: ei\n",[285,1155,1156],{"class":287,"line":405},[285,1157,309],{"emptyLinePlaceholder":6},[285,1159,1160],{"class":287,"line":411},[285,1161,1162],{},"[extruder]\n",[285,1164,1165],{"class":287,"line":417},[285,1166,1167],{},"nozzle_diameter: 0.400\n",[285,1169,1170],{"class":287,"line":423},[285,1171,1172],{},"filament_diameter: 1.750\n",[285,1174,1175],{"class":287,"line":428},[285,1176,1177],{},"pressure_advance: 0.042\n",[285,1179,1180],{"class":287,"line":434},[285,1181,1182],{},"pressure_advance_smooth_time: 0.040\n",[285,1184,1185],{"class":287,"line":440},[285,1186,309],{"emptyLinePlaceholder":6},[285,1188,1189],{"class":287,"line":446},[285,1190,1191],{},"[firmware_retraction]\n",[285,1193,1194],{"class":287,"line":452},[285,1195,1196],{},"retract_length: 0.60\n",[285,1198,1199],{"class":287,"line":458},[285,1200,1201],{},"retract_speed: 35\n",[220,1203,1204],{},[16,1205,1206,1208,1209,1211,1212,1215,1216,1012,1219,1222,1223,1225],{},[29,1207,226],{},"\nA ",[33,1210,258],{}," parameter in Python CAD only translates into repeatable real-world assemblies once ",[29,1213,1214],{},"Input Shaper and Pressure Advance are calibrated on the printer",". Eliminating ringing and corner over-extrusion is what makes it possible to raise acceleration from ",[33,1217,1218],{},"1,200",[33,1220,1221],{},"4,500 mm/s²"," without surrendering ",[33,1224,44],{}," dimensional accuracy.",[47,1227],{},[50,1229,1231],{"id":1230},"_5-production-results-engineering-summary","5. Production Results & Engineering Summary",[16,1233,1234],{},"Unifying code-first parametric CAD with a resonance-compensated Klipper fabrication pipeline changed how custom studio hardware gets built and deployed:",[937,1236,1237,1260,1273],{},[940,1238,1239,1245,1246,174,1249,1252,1253,1255,1256,1259],{},[29,1240,1241,1242,982],{},"Lead-Time Compression (",[33,1243,1244],{},"1–2 weeks → 4 hours"," Eccentric large-format lens boards (printed in matte light-trapping ASA), ",[33,1247,1248],{},"77 mm",[33,1250,1251],{},"82 mm"," filter rotation rings (",[33,1254,918],{}," sliding clearance), and custom interior mounting brackets (",[33,1257,1258],{},"0.20 mm"," standard clearance) now move from measurement to installed hardware on the same afternoon.",[940,1261,1262,1265,1266,1268,1269,1272],{},[29,1263,1264],{},"First-Pass High-Speed Accuracy:"," At ",[33,1267,1221],{}," acceleration, measured gantry vibration drops by over ",[29,1270,1271],{},"92%",", allowing printed parts to mate directly with commercial optical filter threads and metric fasteners on the first print—without iterative trial-and-error reprints.",[940,1274,1275,1278,1279,1281],{},[29,1276,1277],{},"Hardware Designs as Versioned Code Assets:"," Every studio fixture accumulates as a reusable Python module in Git. Whenever a prototype needs to graduate from engineering polymer to anodized aluminum, the exact same script emits a lossless ",[33,1280,94],{}," master file ready for CNC fabrication.",[16,1283,1284,1285,1016],{},"Full hardware specifications, kinematic parameters, and fabrication notes are documented on the ",[23,1286,1287],{"href":25},"Klipper Kinematics Retrofit & Parametric Studio CAD project page",[1289,1290,1291],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":281,"searchDepth":294,"depth":294,"links":1293},[1294,1295,1300,1301,1302],{"id":52,"depth":294,"text":53},{"id":241,"depth":294,"text":242,"children":1296},[1297,1299],{"id":270,"depth":300,"text":1298},"2.1. build123d Studio Bracket & Optical Mount Generator",{"id":736,"depth":300,"text":737},{"id":924,"depth":294,"text":925},{"id":992,"depth":294,"text":993},{"id":1230,"depth":294,"text":1231},"Python build123d Parametric CAD · Klipper Resonance Compensation Pipeline","tech","/images/content-images/blog/20261119-Parametric-Python-CAD-Build123d-Klipper-Workflow/20261119-Parametric-Python-CAD-Build123d-Klipper-Workflow001.jpg","Swiss editorial technical cover on a matte darkroom canvas displaying an optical bracket cross-section dimension blueprint alongside Python build123d parametric CAD and Klipper vibration-compensation telemetry","2026-11-19","Eliminating GUI CAD topological naming breakage with Python build123d parametric code, MGN12H rails, and Klipper Input Shaper for ±0.05mm hardware.","md",null,{},false,"/en/blog/20261119-parametric-python-cad-build123d-klipper-workflow","klipper-kinematics-studio-cad",{"title":5,"description":1308},"published","en/blog/20261119-Parametric-Python-CAD-Build123d-Klipper-Workflow",[1319,35,1320,1003,1321],"Python","Parametric CAD","3D Printing","LUtpSBvt8jd2npSrFViyoSLLaLT43dXUInbA5t19AzQ",{"path":25,"title":1324,"subtitle":1325,"track":1326,"liveUrl":1310,"liveLabel":1310,"date":1327,"status":1316},"Ender-5 Plus Klipper Kinematics Retrofit & Code-First Parametric Studio CAD","Large-format 3D printer linear-rail and ADXL345 Input Shaper retrofit paired with Python (build123d) & FreeCAD parametric studio optical mount engineering","hardware-3d","2026-08-22","/blog/20261119-parametric-python-cad-build123d-klipper-workflow",[1330,1334],{"title":1331,"path":1332,"stem":1333,"date":1307,"status":1316,"noindex":1312,"children":-1},"Cloudflare CF-Connecting-IP Guide: Restoring Real Client IPs in Nginx & Multi-Layer Botnet Defense","/en/blog/20261119-cloudflare-cf-connecting-ip-multi-layer-botnet-defense","en/blog/20261119-Cloudflare-CF-Connecting-IP-Multi-Layer-Botnet-Defense",{"title":1335,"path":1336,"stem":1337,"date":1307,"status":1316,"noindex":1312,"children":-1},"Debugging Web Utility Conversion & SEO: GA4 Bot Filtering, In-App Clipboard Fallback & Foreign-Host 404 Guard","/en/blog/20261119-web-utility-telemetry-inapp-clipboard-host-guard","en/blog/20261119-Web-Utility-Telemetry-InApp-Clipboard-Host-Guard",1796290674305]