{
 "commands": [
  {
   "command": "parameters.add",
   "params": {
    "name": "L",
    "expression": "60 mm",
    "comment": "overall length, 40-120"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "H",
    "expression": "36 mm",
    "comment": "overall height of the D (frame), 0.5-0.7 of L"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "T",
    "expression": "6 mm",
    "comment": "thickness (print height), 3-10"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "w",
    "expression": "6 mm",
    "comment": "frame bar width in plane, 3-9"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "g",
    "expression": "5 mm",
    "comment": "gate bar width in plane, 3-7"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "sw",
    "expression": "9 mm",
    "comment": "locking sleeve width in plane, > g"
   }
  },
  {
   "command": "parameters.add",
   "params": {
    "name": "groove",
    "expression": "1 mm",
    "comment": "depth of the gate seam grooves, < T/2"
   }
  },
  {
   "command": "sketch.create",
   "params": {
    "plane": "XY",
    "name": "OuterSketch"
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "0.0000*L - L/2",
      "0.0000*H - H/2"
     ],
     [
      "1.0000*L - L/2",
      "0.0000*H - H/2"
     ],
     [
      "1.0000*L - L/2",
      "0.7200*H - H/2"
     ],
     [
      "0.8000*L - L/2",
      "1.0000*H - H/2"
     ],
     [
      "0.1600*L - L/2",
      "0.8800*H - H/2"
     ],
     [
      "0.0000*L - L/2",
      "0.4000*H - H/2"
     ]
    ],
    "closed": true
   }
  },
  {
   "command": "sketch.finish",
   "params": {}
  },
  {
   "command": "solid.extrude",
   "params": {
    "distance": "T",
    "name": "Frame",
    "body_name": "Carabiner"
   }
  },
  {
   "command": "sketch.create",
   "params": {
    "plane": "XY",
    "name": "InnerSketch"
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "0.0000*L - L/2 + (1.00000)*w + (0.00000)*g",
      "0.0000*H - H/2 + (1.00000)*w + (0.00000)*g"
     ],
     [
      "1.0000*L - L/2 + (-1.00000)*w + (0.00000)*g",
      "0.0000*H - H/2 + (1.00000)*w + (0.00000)*g"
     ],
     [
      "1.0000*L - L/2 + (-1.00000)*w + (0.00000)*g",
      "0.7200*H - H/2 + (-0.46599)*w + (0.00000)*g"
     ],
     [
      "0.8000*L - L/2 + (-1.37111)*w + (1.05649)*g",
      "1.0000*H - H/2 + (-0.15425)*w + (-0.88745)*g"
     ],
     [
      "0.1600*L - L/2 + (1.22022)*w + (-0.59633)*g",
      "0.8800*H - H/2 + (0.13728)*w + (-1.07340)*g"
     ],
     [
      "0.0000*L - L/2 + (1.00000)*w + (0.00000)*g",
      "0.4000*H - H/2 + (-0.25913)*w + (0.00000)*g"
     ]
    ],
    "closed": true
   }
  },
  {
   "command": "sketch.finish",
   "params": {}
  },
  {
   "command": "solid.extrude",
   "params": {
    "distance": "T + 2",
    "start_offset": "-1",
    "operation": "cut",
    "name": "Opening"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      -30.0,
      -18.0,
      3.0
     ]
    ],
    "radius": 9.0,
    "name": "OuterR0"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      30.0,
      -18.0,
      3.0
     ]
    ],
    "radius": 8.0,
    "name": "OuterR1"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      30.0,
      7.92,
      3.0
     ]
    ],
    "radius": 10.0,
    "name": "OuterR2"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      18.0,
      18.0,
      3.0
     ]
    ],
    "radius": 7.0,
    "name": "OuterR3"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      -20.4,
      13.68,
      3.0
     ]
    ],
    "radius": 4.0,
    "name": "OuterR4"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      -30.0,
      -3.6,
      3.0
     ]
    ],
    "radius": 10.0,
    "name": "OuterR5"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      -24.0,
      -12.0,
      3.0
     ]
    ],
    "radius": 3.0,
    "name": "InnerR0"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      24.0,
      -12.0,
      3.0
     ]
    ],
    "radius": 2.0,
    "name": "InnerR1"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      24.0,
      5.124,
      3.0
     ]
    ],
    "radius": 4.0,
    "name": "InnerR2"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      15.056,
      12.637,
      3.0
     ]
    ],
    "radius": 2.0,
    "name": "InnerR3"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      -16.06,
      9.137,
      3.0
     ]
    ],
    "radius": 1.0,
    "name": "InnerR4"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      -24.0,
      -5.155,
      3.0
     ]
    ],
    "radius": 4.0,
    "name": "InnerR5"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      0,
      -18,
      6.0
     ]
    ],
    "radius": "1.5 mm",
    "name": "EdgeRound0"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      0,
      -18,
      0
     ]
    ],
    "radius": "1.5 mm",
    "name": "EdgeRound1"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      0,
      -12,
      6.0
     ]
    ],
    "radius": "1.5 mm",
    "name": "EdgeRound2"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      0,
      -12,
      0
     ]
    ],
    "radius": "1.5 mm",
    "name": "EdgeRound3"
   }
  },
  {
   "command": "sketch.create",
   "params": {
    "plane": "XY",
    "name": "SleeveSketch"
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "(-0.27600)*L + (0.05590)*g + (-0.05590)*sw",
      "(0.39200)*H + (-0.49687)*g + (0.49687)*sw"
     ],
     [
      "(0.10800)*L + (0.05590)*g + (-0.05590)*sw",
      "(0.46400)*H + (-0.49687)*g + (0.49687)*sw"
     ],
     [
      "(0.10800)*L + (0.05590)*g + (0.05590)*sw",
      "(0.46400)*H + (-0.49687)*g + (-0.49687)*sw"
     ],
     [
      "(-0.27600)*L + (0.05590)*g + (0.05590)*sw",
      "(0.39200)*H + (-0.49687)*g + (-0.49687)*sw"
     ]
    ],
    "closed": true
   }
  },
  {
   "command": "sketch.finish",
   "params": {}
  },
  {
   "command": "solid.extrude",
   "params": {
    "distance": "T",
    "operation": "join",
    "name": "Sleeve"
   }
  },
  {
   "command": "solid.fillet",
   "params": {
    "edges": [
     [
      -5.264,
      17.395,
      6.0
     ],
     [
      -5.264,
      17.395,
      0
     ],
     [
      -4.257,
      8.452,
      6.0
     ],
     [
      -4.257,
      8.452,
      0
     ]
    ],
    "radius": "1.5 mm",
    "name": "SleeveRound"
   }
  },
  {
   "command": "sketch.create",
   "params": {
    "plane": "XY",
    "offset": "T + 1",
    "name": "SeamSketch0"
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "(-0.32382)*L",
      "(0.42496)*H"
     ],
     [
      "(-0.31057)*L",
      "(0.42745)*H"
     ],
     [
      "(-0.29566)*L",
      "(0.20662)*H"
     ],
     [
      "(-0.30891)*L",
      "(0.20413)*H"
     ]
    ],
    "closed": true
   }
  },
  {
   "command": "sketch.finish",
   "params": {}
  },
  {
   "command": "solid.extrude",
   "params": {
    "distance": "groove + 1",
    "direction": "negative",
    "operation": "cut",
    "name": "Seam0"
   }
  },
  {
   "command": "sketch.create",
   "params": {
    "plane": "XY",
    "offset": "T + 1",
    "name": "SeamSketch1"
   }
  },
  {
   "command": "sketch.line",
   "params": {
    "points": [
     [
      "(0.22658)*L",
      "(0.52816)*H"
     ],
     [
      "(0.23983)*L",
      "(0.53065)*H"
     ],
     [
      "(0.25474)*L",
      "(0.30982)*H"
     ],
     [
      "(0.24149)*L",
      "(0.30733)*H"
     ]
    ],
    "closed": true
   }
  },
  {
   "command": "sketch.finish",
   "params": {}
  },
  {
   "command": "solid.extrude",
   "params": {
    "distance": "groove + 1",
    "direction": "negative",
    "operation": "cut",
    "name": "Seam1"
   }
  },
  {
   "command": "appearance.assign",
   "params": {
    "bodies": [
     "Carabiner"
    ],
    "color": "#b9bec4"
   }
  },
  {
   "command": "appearance.assign",
   "params": {
    "faces": [
     [
      -4.761,
      12.924,
      6.0
     ],
     [
      -4.761,
      12.924,
      0
     ],
     [
      -5.264,
      17.395,
      3.0
     ],
     [
      -5.214,
      16.959,
      5.561
     ],
     [
      -5.214,
      16.959,
      0.439
     ],
     [
      -4.257,
      8.452,
      3.0
     ],
     [
      -4.307,
      8.888,
      5.561
     ],
     [
      -4.307,
      8.888,
      0.439
     ],
     [
      -16.694,
      15.304,
      3.0
     ],
     [
      -15.867,
      7.951,
      3.0
     ],
     [
      6.346,
      17.896,
      3.0
     ],
     [
      7.173,
      10.543,
      3.0
     ]
    ],
    "color": "#222222"
   }
  }
 ]
}