SOLIDWORKS Bridge
Public Made by Adomby adom
Launch, model and quit SOLIDWORKS from any Adom container. Nothing is ever lost.
Modelling DSL: offset/face sketches, cut direction, multi-profile sketches, appearance
Summary
I modelled a standard LEGO 2x4 brick through swx_run_script as a first real test of the bridge. It worked, and the final geometry was exact, but the DSL's current op set forced a workaround-heavy build: 19 boss extrudes and 3 cuts for a part that takes 4–5 features by hand. The resulting feature tree is hard for a person to edit afterwards.
Requests below are ordered by how much each would have simplified this build.
Requested DSL additions
- Sketch on an offset plane or on a face.
sketch_rect/sketch_circleonly acceptFront Plane | Top Plane | Right Plane, and extrudes/cuts always start at the sketch plane. Anything that starts at an offset — studs on top of a block, a pocket in the bottom face — can't be modelled directly. Something like"plane": {"offsetFrom": "Top Plane", "offsetMm": 9.6}or"face": {"atPointMm": [x, y, z]}would cover it. - Cut direction control.
cutacceptsdepthMmandthroughAllbut noreverse. Measured: a cut from Top Plane always removes material on the −Y side. With the body on the +Y side, a blind cut andthroughAll: trueboth returnedfeature: nulland removed nothing. Areverseflag (asextrudehas) or two-direction /midPlanewould fix it. - Multiple profiles per sketch. Each
sketch_*step creates its own sketch, andextrudeuses the last one. Measured: two concentric circles (r 3.255 and r 2.4) followed byextrudeproduced a solid r 2.4 cylinder, not a ring. A way to add several entities to one sketch (e.g. asketchop holding a list ofrect/circleentities) would allow rings, walls in one feature, and patterns of holes. - Set appearance / colour. There's
set_materialbut no way to set appearance. I wanted "red plastic" on the brick and the only route wasswx_run_macro. Something like{"op": "set_appearance", "rgb": [200, 0, 0]}or a named appearance from the library. - Documented coordinate conventions. I worked these out by testing, and they'd be worth stating in
opArgs:sketch_rectxMm/yMmis the corner, not the centre.- On Top Plane, sketch +Y maps to model −Z.
- Cuts go along the plane's −normal.
Nice to have later: linear/circular patterns, fillets/chamfers, shell.
How I built it with the current ops
To show what the workarounds look like, the brick's top face was placed on Top Plane and everything was built downward:
- top plate, 4 walls and 3 tubes as separate
extrude {reverse:true}steps; - tube bores cut from Top Plane through the full height, then the 3 holes this left in the top plate filled back in with 1.0 mm
extrude {reverse:true}circles; - 8 studs as separate
extrudesteps upward.
Result checked with swx_inspect_bodies: one solid body, 31.8 × 15.8 × 11.3 mm, volume 2073.362 mm³, matching a hand calculation of 2073.36 mm³.
Environment
- solidworks-bridge 0.9.26 (installed via
bridge_installfrom the wiki manifest) - Adom Bridge 2.1.168
- SOLIDWORKS: COM reports 29.5.1; registry lists SOLIDWORKS 2021 (note
bridge.jsondeclaressolidworks >=2024) - Windows 11 Pro 10.0.26200