main
Drew Owens 0.10.10 source 66cb2da 5d ago
{
  "title": "LEGO 2x4 brick",
  "about": "The brick Michael built in issue #1 (adom/solidworks-bridge#1) with 19 boss extrudes and 3 cuts, in 4 features with the 0.10.0 DSL. Run it with swx_run_script {\"script\": <this file's script>}.",
  "dimensionsMm": {
    "length": 31.8,
    "width": 15.8,
    "height": 11.3,
    "bodyHeight": 9.6,
    "stud": {
      "diameter": 4.8,
      "height": 1.7,
      "pitch": 8.0
    },
    "wall": 1.2,
    "top": 1.0,
    "tube": {
      "outerDiameter": 6.51,
      "innerDiameter": 4.8
    }
  },
  "features": [
    "Boss-Extrude1: the 31.8 x 15.8 x 9.6 block",
    "Cut-Extrude1: the hollow underside (walls 1.2, top 1.0), cut UP from Top Plane",
    "Boss-Extrude2: three tubes from ONE sketch of three concentric circle pairs",
    "Boss-Extrude3: eight studs on a plane offset 9.6 mm above Top Plane"
  ],
  "expected": {
    "bboxMm": {
      "min": [
        -15.9,
        0.0,
        -7.9
      ],
      "max": [
        15.9,
        11.3,
        7.9
      ]
    },
    "volumeMm3": "2073.3615 = block 4823.424 - hollow 3388.056 + tubes 391.894 + studs 246.100 \u2014 the same 2073.3615208 mm\u00b3 SOLIDWORKS 2021 measured for Michael's 22-feature brick (issue #2's volumeM3 2.0733615208e-6)",
    "status": "MEASURED on SOLIDWORKS 2026 (2026-10-14, bridge 0.10.3+) and SOLIDWORKS 2021 (2026-10-15, bridge 0.10.9, community run by Michael, issue #1): identical numbers"
  },
  "conventions": "Top Plane: sketch +x = model +X, sketch +y = model -Z; an extrude goes +Y (the plane's normal), a cut goes -Y unless reverse:true. The brick is symmetric, so the -Z mapping does not change it. The material comes BEFORE the appearance: applying a material wipes a part's appearance (SOLIDWORKS behaviour; since 0.10.2 the bridge re-applies a colour set earlier in the same script, but this order needs nothing re-applied).",
  "script": [
    {
      "op": "new_part"
    },
    {
      "op": "sketch_rect",
      "plane": "Top Plane",
      "widthMm": 31.8,
      "heightMm": 15.8,
      "anchor": "center"
    },
    {
      "op": "extrude",
      "depthMm": 9.6
    },
    {
      "op": "sketch_rect",
      "plane": "Top Plane",
      "widthMm": 29.4,
      "heightMm": 13.4,
      "anchor": "center"
    },
    {
      "op": "cut",
      "depthMm": 8.6,
      "reverse": true
    },
    {
      "op": "sketch",
      "plane": "Top Plane",
      "entities": [
        {
          "circle": {
            "centerMm": [
              -8,
              0
            ],
            "diameterMm": 6.51
          }
        },
        {
          "circle": {
            "centerMm": [
              -8,
              0
            ],
            "diameterMm": 4.8
          }
        },
        {
          "circle": {
            "centerMm": [
              0,
              0
            ],
            "diameterMm": 6.51
          }
        },
        {
          "circle": {
            "centerMm": [
              0,
              0
            ],
            "diameterMm": 4.8
          }
        },
        {
          "circle": {
            "centerMm": [
              8,
              0
            ],
            "diameterMm": 6.51
          }
        },
        {
          "circle": {
            "centerMm": [
              8,
              0
            ],
            "diameterMm": 4.8
          }
        }
      ]
    },
    {
      "op": "extrude",
      "depthMm": 8.6
    },
    {
      "op": "sketch",
      "plane": {
        "offsetFrom": "Top Plane",
        "offsetMm": 9.6
      },
      "entities": [
        {
          "circle": {
            "centerMm": [
              -12,
              -4
            ],
            "diameterMm": 4.8
          }
        },
        {
          "circle": {
            "centerMm": [
              -12,
              4
            ],
            "diameterMm": 4.8
          }
        },
        {
          "circle": {
            "centerMm": [
              -4,
              -4
            ],
            "diameterMm": 4.8
          }
        },
        {
          "circle": {
            "centerMm": [
              -4,
              4
            ],
            "diameterMm": 4.8
          }
        },
        {
          "circle": {
            "centerMm": [
              4,
              -4
            ],
            "diameterMm": 4.8
          }
        },
        {
          "circle": {
            "centerMm": [
              4,
              4
            ],
            "diameterMm": 4.8
          }
        },
        {
          "circle": {
            "centerMm": [
              12,
              -4
            ],
            "diameterMm": 4.8
          }
        },
        {
          "circle": {
            "centerMm": [
              12,
              4
            ],
            "diameterMm": 4.8
          }
        }
      ]
    },
    {
      "op": "extrude",
      "depthMm": 1.7
    },
    {
      "op": "set_material",
      "name": "ABS"
    },
    {
      "op": "set_appearance",
      "rgb": [
        200,
        0,
        0
      ]
    },
    {
      "op": "set_prop",
      "name": "Description",
      "value": "LEGO 2x4 brick"
    }
  ]
}