MCAD co-design

Enclosures, height envelopes, 3D clearance checks and the IDX round trip.

The MCAD tab of the board editor (and edsnx mcad …) checks the board against its enclosure and exchanges changes with the mechanical designer. Everything is stored next to the board in <board>.kicad_mcad.json (reference solids, height envelopes, mounting bosses) and <board>.kicad_idx.json (the IDX history); board ANA-5.

The OCCT add-on. Reading and writing STEP needs OpenCASCADE, which ships separately to keep this extension small: install SoftForge OCCT (soft-forge.softforge-occt, a VSIX built with npm run package:occt). Without it you can still use .glb enclosures (FreeCAD or kicad-cli pcb export glb), DXF outlines, IDX, the clearance check and DRC; STEP buttons say how to install the add-on. The edsnx CLI finds an installed add-on (or the folder in EDSNX_OCCT_ADDON).

Reference solids. Import STEP adds an enclosure (or a battery or any mechanical part): a STEP is tessellated once into .softforge/mcad/ (ignored by git), a .glb is used as is. Solids are drawn translucent in 3D and as their top-view bounds in 2D. Each row has visibility, opacity, position and rotation in the MCAD frame (mm, z up, y = −KiCad y, z = 0 on the bottom face of the board); Place Reference Solid (the move button) drops the solid where you click, R turns it by 90°. Detect bosses reads the enclosure’s vertical cylinders as mounting bosses.

Board outline and STEP export. Outline from STEP (or edsnx mcad outline --file enclosure.dxf) replaces the Edge.Cuts outline with the largest loop of a DXF or of the STEP’s top face (inner loops become cut-outs) in one undo step. Export STEP writes the board with its holes and every part’s STEP model as one assembly; parts without a STEP model are listed.

3D clearance. Run clearance (and every DRC run, live) checks each part body — its 3D model’s triangles when the 3D view has loaded it (2.1.0; edsnx mcad clearance --models board.glb uses the parts of a kicad-cli pcb export glb), otherwise courtyard × height from the Height field or the package — against the solids, the solids against the board, and the bosses against the mounting holes. With model meshes a part collides only where its faces cross the solid’s, and the gap is the true distance between the meshes (a tall, thin part next to a rib is not flagged by its bounding box). A part completely inside a closed solid — no face touching, e.g. sunk into a boss — is a collision too (“completely inside”); solids that are not a closed surface cannot tell inside from outside and are listed in the panel’s warnings. Collisions are red in 3D and on the canvas and DRC reports them: mcad_collision (error), mcad_enclosure_clearance (closer than the minimum clearance, warning), mcad_height_envelope and mcad_mounting_hole_mismatch (warnings). The panel lists each hit with its depth or gap; click one to select the part. As requirement adds a Mechanical requirement that the minimum clearance stays above the limit, so it shows in Requirements and in edsnx solve.

Height envelopes. Areas where parts must stay low (under a display, a lid rib, a battery): Draw Height Envelope — drag a rectangle or click a polygon and press Enter — then set the side and the maximum height in the panel. Parts on that side overlapping the area and taller than the limit are flagged.

IDX exchange. Export IDX writes an IDX 3.0 baseline for the MCAD tool (outline, holes, keep-outs, components with heights, envelopes as height keep-outs). Import IDX reads the file the MCAD tool sends back — a baseline or proposed changes — and compares it with the current board: the review dialog lists each change (“J2 moved 2 mm”, “New keepout”, “Height limit 6 mm”) with Accept / Reject and a comment. Apply accepted edits the board in one undo step (outline, part moves and rotations, heights, keep-outs, envelopes, bosses); Send response writes the response IDX with each change accepted or rejected for the MCAD tool to merge. The history in the panel keeps every exchange.

IDX carries the exact geometry (2.1.0): the board outline and cut-outs keep their Edge.Cuts lines, arcs and circles, and every IDX curve the MCAD tool sends is read — lines, three-point and angle arcs, circles (centre or three points), ellipses, B-splines (rational, any degree) and composite curves — with a polyline within 0.01 mm for the checks. Accepted outlines come back as Edge.Cuts lines, arcs and circles (ellipses and splines as their polyline). The export also carries the stack-up as IDX layers (copper, dielectric, mask, silkscreen with their z range), copper zones as FILLED_AREA items and each component’s 3D model (file, offset, rotation, scale). A curve re-tessellated by the MCAD tool within 0.02 mm is not a change.

Live MCAD link. Link folder… in the IDX section (or Electronics Designer: MCAD link, edsnx mcad link --folder share/) connects the board to a folder shared with the MCAD tool. The baseline IDX goes there (<board>-ecad-baseline.idx); the editor then watches the folder: an IDX proposal dropped there opens the review dialog, a STEP or glb with the name of a reference solid offers to update it (another name: to add it). Apply accepted applies and writes the response into the folder (<board>-ecad-response-<time>.idx), Send response answers without applying; edsnx mcad link respond --reject rejects a whole proposal. Each file is proposed once per change; files being copied are picked up when they stop changing. Unlink stops watching.

Solid booleans. edsnx mcad boolean --a s1 --b s2 --op subtract (union, subtract, intersect) combines two reference solids into one, e.g. to cut a connector opening out of an enclosure before the clearance check. With the OCCT add-on and both solids from STEP files the boolean runs on the exact geometry (B-rep, tolerance about 1e-7 mm) and is meshed once; otherwise the extension combines the meshes (constructive solid geometry on the triangles). Mesh booleans are exact on flat faces but keep the tessellation’s chord error on curved ones: a 6 mm hole through a 20 × 20 × 10 mm block comes out 0.03 % too small in volume at the default mesh quality, where OCCT is exact to 1e-14.

sh
edsnx mcad import-step board.kicad_pcb --file enclosure.step --detect-bosses
edsnx mcad clearance board.kicad_pcb
edsnx mcad idx export board.kicad_pcb --out board.idx
edsnx mcad idx import board.kicad_pcb --file from-mcad.idx
edsnx mcad idx decide board.kicad_pcb --accept component:J2 --reject keepout:K1
edsnx mcad idx apply board.kicad_pcb && edsnx mcad idx respond board.kicad_pcb --out response.idx
edsnx mcad link board.kicad_pcb --folder //server/mcad/board       # the live link
edsnx mcad link scan board.kicad_pcb && edsnx mcad link respond board.kicad_pcb --apply
edsnx mcad clearance board.kicad_pcb --models board.glb             # bodies from the 3D models
edsnx mcad boolean board.kicad_pcb --a s1 --b s2 --op subtract --hide-b

The sample project has an enclosure (enclosure.glb, 1.5 mm above the headers) and a 6 mm envelope under the display; lower the envelope to 4 mm and the timer (5.1 mm) is flagged.

Documentation for Electronics Designer 2.3.60.