1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-07 16:06:31 +02:00

Cables can now have a list of wire colours.

Added a constructor for cables.
This commit is contained in:
Chris Palmer
2022-02-15 21:51:09 +00:00
parent 50e23e5f81
commit 0e2778e13d
2 changed files with 4 additions and 0 deletions

View File

@@ -4391,12 +4391,14 @@ Just a BOM entry at the moment and cable bundle size functions for holes, plus c
### Functions
| Function | Description |
|:--- |:--- |
| `cable(wires, size, colours, ribbon = false)` | Cable constructor |
| `cable_bundle(cable)` | Arrangement of a bundle in a flat cable clip |
| `cable_bundle_positions(cable)` | Positions of wires in a bundle to go through a cable strip |
| `cable_height(cable)` | Height in flat clip |
| `cable_is_ribbon(cable)` | Is a ribbon cable? |
| `cable_radius(cable)` | Radius of a bundle of wires, see <http://mathworld.wolfram.com/CirclePacking.html>. |
| `cable_width(cable)` | Width in flat clip |
| `cable_wire_colours(cable)` | Individual wire colours |
| `cable_wire_size(cable)` | Size of each wire in a bundle |
| `cable_wires(cable)` | Number of wires in a bundle |
| `wire_hole_radius(cable)` | Radius of a hole to accept a bundle of wires, rounded up to standard metric drill size |

View File

@@ -35,6 +35,8 @@ module ribbon_cable(ways, length) //! Add ribbon cable to the
function cable_wires(cable) = cable[0]; //! Number of wires in a bundle
function cable_wire_size(cable) = cable[1]; //! Size of each wire in a bundle
function cable_is_ribbon(cable) = len(cable) > 2 && cable[2]; //! Is a ribbon cable?
function cable_wire_colours(cable) = assert(len(cable[3]) == cable_wires(cable)) cable[3]; //! Individual wire colours
function cable(wires, size, colours, ribbon = false) = [wires, size, ribbon, colours]; //! Cable constructor
// numbers from http://mathworld.wolfram.com/CirclePacking.html
function cable_radius(cable) = [0, 1, 2, 2.15, 2.41, 2.7, 3, 3, 3.3][cable_wires(cable)] * cable_wire_size(cable) / 2; //! Radius of a bundle of wires, see <http://mathworld.wolfram.com/CirclePacking.html>.