build_layout
Builds a flat closed XTrackCAD loop from ordered catalogue part numbers, validates gaps, angles, crossings and overlaps, centres it on a board, and exports a unique .xtc layout file.
Instructions
Build a flat closed loop from an ordered list of catalogue part numbers.
Python attaches endpoint 0 to the previous endpoint 1. All curves turn left. Example oval: six 24130, one 24188, six 24130, one 24188. Centres the result on the board with a fixed 50 mm centreline edge margin. Rejects gaps >0.1 mm, angle errors >0.1 degrees, crossings and overlaps. On failure returns measured errors and writes nothing. On success creates a unique .xtc in this project's layouts/ and returns its path and parts list. Does not open XTrackCAD or check rolling-stock clearance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parts | Yes | ||
| width_mm | No | ||
| height_mm | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||