{
 "commands": [
  {
   "command": "parameters.add",
   "params": {
    "name": "open",
    "expression": "50 mm",
    "comment": "max jaw opening (pad face to anvil), 20..100"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "throat",
    "expression": "40 mm",
    "comment": "throat depth: screw axis to inside of spine, 25..80"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "T",
    "expression": "12 mm",
    "comment": "frame thickness (print height), 10..20"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "arm",
    "expression": "14 mm",
    "comment": "frame arm / spine width in the C plane, 12..20"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "flange",
    "expression": "3 mm",
    "comment": "I-beam flange width around the pockets, 2..4"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "web",
    "expression": "4 mm",
    "comment": "I-beam web thickness, 3..T-4"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "Ro",
    "expression": "12 mm",
    "comment": "outer corner radius of the C"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "Ri",
    "expression": "6 mm",
    "comment": "inner (throat) corner radius"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "Re",
    "expression": "5 mm",
    "comment": "arm-end corner radius"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "bossR",
    "expression": "12 mm",
    "comment": "half-length of the solid boss/anvil block around the screw axis"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "padD",
    "expression": "22 mm",
    "comment": "swivel pad diameter"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "padH",
    "expression": "14 mm",
    "comment": "swivel pad height"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "gap",
    "expression": "4 mm",
    "comment": "pad-to-frame gap at full opening"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "hubD",
    "expression": "16 mm",
    "comment": "screw head (hub) diameter"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "hubH",
    "expression": "14 mm",
    "comment": "screw head height"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "barD",
    "expression": "6 mm",
    "comment": "T-handle bar diameter"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "barL",
    "expression": "75 mm",
    "comment": "T-handle bar length"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "clr",
    "expression": "0.2 mm",
    "comment": "radial clearance for the T-bar cross hole"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "yti",
    "expression": "open + padH + gap",
    "comment": "y of the top arm's inner face (derived)"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "Ls",
    "expression": "yti + arm + 1 mm - padH - 1.5 mm",
    "comment": "threaded shaft length (derived)"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "SX",
    "expression": "throat + bossR + 23 mm",
    "comment": "print-layout X of the loose parts (derived)"
   }
  },
  {
   "command": "sketch.create",
   "params": {
    "plane": "XY",
    "name": "FrameSketch"
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "-arm",
      "-arm"
     ],
     [
      "throat + bossR",
      "-arm"
     ],
     [
      "throat + bossR",
      "0"
     ],
     [
      0,
      0
     ],
     [
      "0",
      "yti"
     ],
     [
      "throat + bossR",
      "yti"
     ],
     [
      "throat + bossR",
      "yti + arm"
     ],
     [
      "-arm",
      "yti + arm"
     ]
    ],
    "closed": true
   }
  },
  {
   "command": "sketch.finish",
   "params": {}
  },
  {
   "command": "solid.extrude",
   "params": {
    "distance": "T",
    "name": "FrameBlank",
    "body_name": "Frame"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      -14,
      -14,
      6
     ],
     [
      -14,
      82,
      6
     ]
    ],
    "radius": "Ro",
    "name": "OuterCorners"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      0,
      0,
      6
     ],
     [
      0,
      68,
      6
     ]
    ],
    "radius": "Ri",
    "name": "InnerCorners"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      52,
      -14,
      6
     ],
     [
      52,
      0,
      6
     ],
     [
      52,
      68,
      6
     ],
     [
      52,
      82,
      6
     ]
    ],
    "radius": "Re",
    "name": "ArmEnds"
   }
  },
  {
   "command": "sketch.create",
   "params": {
    "plane": "XY",
    "name": "PocketTopSk",
    "offset": "T + 1 mm"
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "throat - bossR - 5 mm",
     "-arm + flange + 3 mm"
    ],
    "start": [
     "throat - bossR - 5 mm",
     "-arm + flange"
    ],
    "end": [
     "throat - bossR - 2 mm",
     "-arm + flange + 3 mm"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "throat - bossR - 2 mm",
      "-arm + flange + 3 mm"
     ],
     [
      "throat - bossR - 2 mm",
      "-flange - 3 mm"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "throat - bossR - 5 mm",
     "-flange - 3 mm"
    ],
    "start": [
     "throat - bossR - 2 mm",
     "-flange - 3 mm"
    ],
    "end": [
     "throat - bossR - 5 mm",
     "-flange"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "throat - bossR - 5 mm",
      "-flange"
     ],
     [
      "Ri",
      "-flange"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "Ri",
     "Ri"
    ],
    "start": [
     "-flange",
     "Ri"
    ],
    "end": [
     "Ri",
     "-flange"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "-flange",
      "Ri"
     ],
     [
      "-flange",
      "yti - Ri"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "Ri",
     "yti - Ri"
    ],
    "start": [
     "Ri",
     "yti + flange"
    ],
    "end": [
     "-flange",
     "yti - Ri"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "Ri",
      "yti + flange"
     ],
     [
      "throat - bossR - 5 mm",
      "yti + flange"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "throat - bossR - 5 mm",
     "yti + flange + 3 mm"
    ],
    "start": [
     "throat - bossR - 5 mm",
     "yti + flange"
    ],
    "end": [
     "throat - bossR - 2 mm",
     "yti + flange + 3 mm"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "throat - bossR - 2 mm",
      "yti + flange + 3 mm"
     ],
     [
      "throat - bossR - 2 mm",
      "yti + arm - flange - 3 mm"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "throat - bossR - 5 mm",
     "yti + arm - flange - 3 mm"
    ],
    "start": [
     "throat - bossR - 2 mm",
     "yti + arm - flange - 3 mm"
    ],
    "end": [
     "throat - bossR - 5 mm",
     "yti + arm - flange"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "throat - bossR - 5 mm",
      "yti + arm - flange"
     ],
     [
      "-arm + Ro",
      "yti + arm - flange"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "-arm + Ro",
     "yti + arm - Ro"
    ],
    "start": [
     "-arm + Ro",
     "yti + arm - flange"
    ],
    "end": [
     "-arm + flange",
     "yti + arm - Ro"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "-arm + flange",
      "yti + arm - Ro"
     ],
     [
      "-arm + flange",
      "-arm + Ro"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "-arm + Ro",
     "-arm + Ro"
    ],
    "start": [
     "-arm + flange",
     "-arm + Ro"
    ],
    "end": [
     "-arm + Ro",
     "-arm + flange"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "-arm + Ro",
      "-arm + flange"
     ],
     [
      "throat - bossR - 5 mm",
      "-arm + flange"
     ]
    ]
   }
  },
  {
   "command": "sketch.finish",
   "params": {}
  },
  {
   "command": "solid.extrude",
   "params": {
    "distance": "(T - web)/2 + 1 mm",
    "direction": "negative",
    "operation": "cut",
    "targets": [
     "Frame"
    ],
    "name": "PocketTop"
   }
  },
  {
   "command": "sketch.create",
   "params": {
    "plane": "XY",
    "name": "PocketBotSk",
    "offset": "-1 mm"
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "throat - bossR - 5 mm",
     "-arm + flange + 3 mm"
    ],
    "start": [
     "throat - bossR - 5 mm",
     "-arm + flange"
    ],
    "end": [
     "throat - bossR - 2 mm",
     "-arm + flange + 3 mm"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "throat - bossR - 2 mm",
      "-arm + flange + 3 mm"
     ],
     [
      "throat - bossR - 2 mm",
      "-flange - 3 mm"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "throat - bossR - 5 mm",
     "-flange - 3 mm"
    ],
    "start": [
     "throat - bossR - 2 mm",
     "-flange - 3 mm"
    ],
    "end": [
     "throat - bossR - 5 mm",
     "-flange"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "throat - bossR - 5 mm",
      "-flange"
     ],
     [
      "Ri",
      "-flange"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "Ri",
     "Ri"
    ],
    "start": [
     "-flange",
     "Ri"
    ],
    "end": [
     "Ri",
     "-flange"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "-flange",
      "Ri"
     ],
     [
      "-flange",
      "yti - Ri"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "Ri",
     "yti - Ri"
    ],
    "start": [
     "Ri",
     "yti + flange"
    ],
    "end": [
     "-flange",
     "yti - Ri"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "Ri",
      "yti + flange"
     ],
     [
      "throat - bossR - 5 mm",
      "yti + flange"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "throat - bossR - 5 mm",
     "yti + flange + 3 mm"
    ],
    "start": [
     "throat - bossR - 5 mm",
     "yti + flange"
    ],
    "end": [
     "throat - bossR - 2 mm",
     "yti + flange + 3 mm"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "throat - bossR - 2 mm",
      "yti + flange + 3 mm"
     ],
     [
      "throat - bossR - 2 mm",
      "yti + arm - flange - 3 mm"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "throat - bossR - 5 mm",
     "yti + arm - flange - 3 mm"
    ],
    "start": [
     "throat - bossR - 2 mm",
     "yti + arm - flange - 3 mm"
    ],
    "end": [
     "throat - bossR - 5 mm",
     "yti + arm - flange"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "throat - bossR - 5 mm",
      "yti + arm - flange"
     ],
     [
      "-arm + Ro",
      "yti + arm - flange"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "-arm + Ro",
     "yti + arm - Ro"
    ],
    "start": [
     "-arm + Ro",
     "yti + arm - flange"
    ],
    "end": [
     "-arm + flange",
     "yti + arm - Ro"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "-arm + flange",
      "yti + arm - Ro"
     ],
     [
      "-arm + flange",
      "-arm + Ro"
     ]
    ]
   }
  },
  {
   "command": "sketch.arc.center_point",
   "params": {
    "center": [
     "-arm + Ro",
     "-arm + Ro"
    ],
    "start": [
     "-arm + flange",
     "-arm + Ro"
    ],
    "end": [
     "-arm + Ro",
     "-arm + flange"
    ]
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "-arm + Ro",
      "-arm + flange"
     ],
     [
      "throat - bossR - 5 mm",
      "-arm + flange"
     ]
    ]
   }
  },
  {
   "command": "sketch.finish",
   "params": {}
  },
  {
   "command": "solid.extrude",
   "params": {
    "distance": "(T - web)/2 + 1 mm",
    "direction": "positive",
    "operation": "cut",
    "targets": [
     "Frame"
    ],
    "name": "PocketBot"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      20,
      -11,
      8
     ],
     [
      20,
      -11,
      4
     ]
    ],
    "radius": 1.5,
    "name": "WebRoots"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      20,
      -11,
      12
     ],
     [
      20,
      -11,
      0
     ]
    ],
    "radius": 0.8,
    "name": "FlangeInnerRounds"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      20,
      -14,
      12
     ],
     [
      20,
      -14,
      0
     ]
    ],
    "radius": 1.5,
    "name": "FlangeOuterRounds"
   }
  },
  {
   "command": "solid.cylinder",
   "params": {
    "diameter": "6.8 mm",
    "height": "arm + 2 mm",
    "base": [
     "throat",
     "yti - 1 mm",
     "T/2"
    ],
    "axis": "Y",
    "operation": "cut",
    "targets": [
     "Frame"
    ],
    "name": "ScrewBore"
   }
  },
  {
   "command": "solid.thread",
   "params": {
    "face": [
     43.4,
     75,
     6
    ],
    "designation": "M8",
    "modeled": true,
    "name": "FrameThread"
   }
  },
  {
   "command": "solid.cylinder",
   "params": {
    "diameter": "hubD",
    "height": "hubH",
    "base": [
     "SX",
     0,
     0
    ],
    "operation": "new",
    "body_name": "Screw",
    "name": "Hub"
   }
  },
  {
   "command": "solid.cylinder",
   "params": {
    "diameter": "8 mm",
    "height": "Ls + 1 mm",
    "base": [
     "SX",
     0,
     "hubH - 1 mm"
    ],
    "operation": "join",
    "targets": [
     "Screw"
    ],
    "name": "Shaft"
   }
  },
  {
   "command": "solid.cylinder",
   "params": {
    "diameter": "5 mm",
    "height": "8.5 mm",
    "base": [
     "SX",
     0,
     "hubH + Ls - 0.5 mm"
    ],
    "operation": "join",
    "targets": [
     "Screw"
    ],
    "name": "Neck"
   }
  },
  {
   "command": "solid.sphere",
   "params": {
    "diameter": "7.5 mm",
    "center": [
     "SX",
     0,
     "hubH + Ls + 7.5 mm"
    ],
    "operation": "join",
    "targets": [
     "Screw"
    ],
    "name": "Ball"
   }
  },
  {
   "command": "solid.cylinder",
   "params": {
    "diameter": "barD + 2*clr",
    "height": "hubD + 2 mm",
    "base": [
     "SX - hubD/2 - 1 mm",
     0,
     "hubH/2"
    ],
    "axis": "X",
    "operation": "cut",
    "targets": [
     "Screw"
    ],
    "name": "CrossHole"
   }
  },
  {
   "command": "solid.thread",
   "params": {
    "face": [
     79,
     0,
     50
    ],
    "designation": "M8",
    "modeled": true,
    "name": "ScrewThread"
   }
  },
  {
   "command": "solid.cylinder",
   "params": {
    "diameter": "padD",
    "height": "padH",
    "base": [
     "SX",
     30,
     0
    ],
    "operation": "new",
    "body_name": "Pad",
    "name": "PadDisc"
   }
  },
  {
   "command": "solid.sphere",
   "params": {
    "diameter": "8 mm",
    "center": [
     "SX",
     30,
     "padH - 6 mm"
    ],
    "operation": "cut",
    "targets": [
     "Pad"
    ],
    "name": "BallSocket"
   }
  },
  {
   "command": "solid.cylinder",
   "params": {
    "diameter": "6.9 mm",
    "height": "5 mm",
    "base": [
     "SX",
     30,
     "padH - 4 mm"
    ],
    "operation": "cut",
    "targets": [
     "Pad"
    ],
    "name": "SnapEntry"
   }
  },
  {
   "command": "solid.cylinder",
   "params": {
    "diameter": "barD + 5 mm",
    "height": "5 mm",
    "base": [
     "SX",
     58,
     0
    ],
    "operation": "new",
    "body_name": "THandle",
    "name": "Knob"
   }
  },
  {
   "command": "solid.cylinder",
   "params": {
    "diameter": "barD",
    "height": "barL",
    "base": [
     "SX",
     58,
     "4.5 mm"
    ],
    "operation": "join",
    "targets": [
     "THandle"
    ],
    "name": "Bar"
   }
  },
  {
   "command": "appearance.assign",
   "params": {
    "bodies": [
     "Frame"
    ],
    "color": "#1f5fbf"
   }
  },
  {
   "command": "appearance.assign",
   "params": {
    "bodies": [
     "Screw"
    ],
    "color": "#9a9ea6"
   }
  },
  {
   "command": "appearance.assign",
   "params": {
    "bodies": [
     "Pad"
    ],
    "color": "#f08a1c"
   }
  },
  {
   "command": "appearance.assign",
   "params": {
    "bodies": [
     "THandle"
    ],
    "color": "#d22b2b"
   }
  }
 ]
}