{
  "schema": "vextor.vxl.v1",
  "id": "clamp_frame",
  "units": {"angle": "deg", "length": "mm"},
  "lets": [
    {"id": "roll", "expr": "17mm + sqrt(7^2 - 6.5^2)*1mm"},
    {"id": "tangent_x", "expr": "17mm + 5*(roll-17mm)/7"},
    {"id": "tangent_z", "expr": "16.5mm - 5mm*6.5/7"}
  ],
  "profiles": [
    {"id": "c_outline", "path": {"from": ["2", "0"], "segments": [{"line": ["68", "0"]}, {"arc": {"center": ["68", "2"], "dir": "ccw", "to": ["70", "2"]}}, {"line": ["70", "12"]}, {"line": ["roll", "12"]}, {"arc": {"center": ["roll", "10"], "dir": "ccw", "to": ["tangent_x", "tangent_z"]}}, {"arc": {"center": ["17", "16.5"], "dir": "cw", "to": ["12", "16.5"]}}, {"line": ["12", "73.5"]}, {"arc": {"center": ["17", "73.5"], "dir": "cw", "to": ["tangent_x", "90mm-tangent_z"]}}, {"arc": {"center": ["roll", "80"], "dir": "ccw", "to": ["roll", "78"]}}, {"line": ["70", "78"]}, {"line": ["70", "88"]}, {"arc": {"center": ["68", "88"], "dir": "ccw", "to": ["68", "90"]}}, {"line": ["2", "90"]}, {"arc": {"center": ["2", "88"], "dir": "ccw", "to": ["0", "88"]}}, {"line": ["0", "2"]}, {"arc": {"center": ["2", "2"], "dir": "ccw", "to": ["2", "0"]}}]}}
  ],
  "parts": [
    {
      "id": "frame",
      "deliver": "body",
      "rep": "mesh",
      "role": "deliverable",
      "steps": [
        {"id": "frame_profile", "op": "extrude", "bind": "blank", "at": "0", "length": "24", "plane": "xz", "profile": {"profile": "c_outline"}, "toward": "+y"},
        {"id": "frame_mesh", "op": "tessellate", "rep": "mesh", "bind": "body", "source": "blank", "deflection": "0.02"},
        {"id": "outer_envelope", "op": "box", "bind": "outer_envelope", "size": ["70", "24", "90"]},
        {"id": "outer_rounds", "op": "fillet", "target": "outer_envelope", "edges": {"expect": "12", "select": {"any_of": [{"edge": ["outer_envelope.+x", "outer_envelope.+y"]}, {"edge": ["outer_envelope.+x", "outer_envelope.-y"]}, {"edge": ["outer_envelope.-x", "outer_envelope.+y"]}, {"edge": ["outer_envelope.-x", "outer_envelope.-y"]}, {"edge": ["outer_envelope.+x", "outer_envelope.+z"]}, {"edge": ["outer_envelope.+x", "outer_envelope.-z"]}, {"edge": ["outer_envelope.-x", "outer_envelope.+z"]}, {"edge": ["outer_envelope.-x", "outer_envelope.-z"]}, {"edge": ["outer_envelope.+y", "outer_envelope.+z"]}, {"edge": ["outer_envelope.+y", "outer_envelope.-z"]}, {"edge": ["outer_envelope.-y", "outer_envelope.+z"]}, {"edge": ["outer_envelope.-y", "outer_envelope.-z"]}]}}, "radius": "2"},
        {"id": "outer_envelope_mesh", "op": "tessellate", "rep": "mesh", "bind": "rounded_envelope", "source": "outer_envelope", "deflection": "0.02"},
        {"id": "outer_envelope_intersection", "op": "intersect", "rep": "mesh", "target": "body", "tool": "rounded_envelope"},
        {"id": "thread_seat", "op": "cylinder", "bind": "thread_seat", "at": ["50", "12", "77"], "diameter": "12.8", "length": "14"},
        {"id": "seat_mesh", "op": "tessellate", "rep": "mesh", "bind": "thread_seat_tool", "source": "thread_seat", "deflection": "0.02"},
        {"id": "seat_cut", "op": "cut", "rep": "mesh", "target": "body", "tool": "thread_seat_tool"},
        {"id": "thread_source", "op": "thread", "bind": "thread_source", "at": ["0", "0", "-1.75"], "diameter": "12.3", "ends": "trimmed", "form": "internal", "hand": "right", "length": "14", "outer_diameter": "20", "pitch": "1.75", "starts": "1"},
        {"id": "thread_mesh", "op": "tessellate", "rep": "mesh", "bind": "thread", "source": "thread_source", "deflection": "0.02"},
        {"id": "thread_clip_blank", "op": "box", "bind": "thread_clip_blank", "at": ["-11", "-11", "0"], "size": ["22", "22", "12"]},
        {"id": "thread_clip_mesh", "op": "tessellate", "rep": "mesh", "bind": "thread_clip_tool", "source": "thread_clip_blank", "deflection": "0.02"},
        {"id": "thread_clip", "op": "intersect", "rep": "mesh", "target": "thread", "tool": "thread_clip_tool"},
        {"id": "thread_union", "op": "union", "rep": "mesh", "target": "body", "tool": "thread", "tool_place": {"translate": ["50", "12", "78"]}},
        {"id": "lower_lead", "op": "cone", "bind": "lower_lead", "at": ["50", "12", "77.95"], "base_diameter": "14", "length": "0.55", "top_diameter": "10.2"},
        {"id": "lower_lead_mesh", "op": "tessellate", "rep": "mesh", "bind": "lower_lead_tool", "source": "lower_lead", "deflection": "0.02"},
        {"id": "lower_lead_cut", "op": "cut", "rep": "mesh", "target": "body", "tool": "lower_lead_tool"},
        {"id": "upper_lead", "op": "cone", "bind": "upper_lead", "at": ["50", "12", "89.45"], "base_diameter": "10.2", "length": "0.55", "top_diameter": "14"},
        {"id": "upper_lead_mesh", "op": "tessellate", "rep": "mesh", "bind": "upper_lead_tool", "source": "upper_lead", "deflection": "0.02"},
        {"id": "upper_lead_cut", "op": "cut", "rep": "mesh", "target": "body", "tool": "upper_lead_tool"}
      ]
    }
  ],
  "requirements": [
    {"id": "frame_closed", "kind": "closed_delivered_mesh", "subject": "frame", "required": true},
    {"id": "frame_count", "kind": "component_count", "subject": "frame", "expect": "1", "required": true},
    {"id": "frame_clean", "kind": "self_intersection_free", "subject": "frame", "required": true}
  ]
}
