Add YAML code for user-provided examples

This commit is contained in:
Daniel Rojas 2020-10-24 12:27:23 +02:00
parent 88176dbd98
commit 82fcfbe71e
5 changed files with 155 additions and 46 deletions

View File

@ -1,58 +1,26 @@
# based on @stmaxed's example in #134
connectors:
JSTMALE: &JST_SM # use generic names here, assign designators at generation time
type: JST SM
X1: &X
type: Screw connector
subtype: male
color: GN
pincount: 4
pinlabels: [A, B, C, D]
JSTFEMALE:
<<: *JST_SM # easily create JSTMALE's matching connector
subtype: female
X4: # this connector is only used once, use fixed designator here already
type: Screw terminal connector
pincount: 4
color: GN
pinlabels: [W, X, Y, Z]
S:
# autogenerate: true should no longer be required with the new syntax
style: simple
type: Splice
color: CU
F:
style: simple
show_name: false
type: Ferrule
color: GY
cables:
CABLE:
wirecount: 4
color_code: DIN
length: 0.1
WIRE:
wirecount: 1
colors: [BK]
length: 0.1
W:
color: BK
colors: [BK, WH, BU, BN]
connections:
-
- JSTMALE.X1: [4-1] # use `.` syntax to generate a new instance of JSTMALE, named X1
- CABLE.W1: [1-4] # same syntax for cables
- [S., S., S.S1, S.] # splice W1 and W2 together; only wire #3 needs a user-defined designator
- CABLE.W2: [1-4]
- S. # test shorthand, auto-get required number of ferrules from context
- CABLE.W21: [1-4]
- JSTFEMALE.X2: [1-4]
# # - <=> # mate X2 and X3
-
- JSTMALE.X3: [1-4]
- CABLE.W3: [1-4]
- [F., F., F., F.]
# # - --> # insert ferrules into screw terminal connector
-
- X4: [2,1,4,3] # X4 does not require auto-generation, thus no `.` syntax here
-
- S1: [1] # reuse previously generated splice
# TODO: Make it work with `- F1` only, making pin 1 is implied
- WIRE.: [1] # We don't care about a simple wire's designator, auto-generate please!
# TODO: Make it work with `- W.W4: 1`, dropping the need for `[]`
- X2: [4]
- # ferrules + connector X1
- W.W1: [1-4]
- F.
- -->
- X1: [1-4]

25
test/test2.yml Normal file
View File

@ -0,0 +1,25 @@
# based on @MSBGit's example in #134
connectors:
X1: &dupont
type: Dupont 2.54mm
subtype: male
pincount: 5
color: BK
X2:
<<: *dupont
subtype: female
cables:
W:
category: bundle
colors: [RD, BK, BU, GN]
length: 0.2
connections:
-
- W.W1: [1-4]
- X1: [1-4]
- ==>
- X2: [1-4]
- W.W2: [1-4]

34
test/test3.yml Normal file
View File

@ -0,0 +1,34 @@
# expanding upon @stmaxed's example in #134
connectors:
X1: &X
type: Screw connector
subtype: male
color: GN
pincount: 4
pinlabels: [A, B, C, D]
X2:
<<: *X
subtype: female
F:
style: simple
show_name: false
type: Ferrule
color: GY
cables:
W:
color: BK
colors: [BK, WH, BU, BN]
connections:
- # ferrules + connector X1
- W.W1: [1-4]
- F.
- -->
- X1: [1-4]
- ==>
- X2: [1-4]
- <--
- F.
- W.W2: [1-4]

26
test/test4.yml Normal file
View File

@ -0,0 +1,26 @@
# based on @formatc1702's example in #184
connectors:
X:
pincount: 4
pinlabels: [A, B, C, D]
F:
style: simple
type: ferrule
cables:
C:
wirecount: 4
color_code: DIN
connections:
-
- X.X1: [1-4]
- C.C1: [1-4]
- [F.F1, F.F2, F.F3, F.F4] # generate new instances of F and assign designators
- C.C2: [1-4]
- X.X2: [1-4]
-
- [F1, F2, F3, F4] # use previously assigned designators
- C.C3: [1-4]
- X.X3: [1-4]

56
test/test9.yml Normal file
View File

@ -0,0 +1,56 @@
connectors:
JSTMALE: &JST_SM # use generic names here, assign designators at generation time
type: JST SM
subtype: male
pincount: 4
pinlabels: [A, B, C, D]
JSTFEMALE:
<<: *JST_SM # easily create JSTMALE's matching connector
subtype: female
X4: # this connector is only used once, use fixed designator here already
type: Screw terminal connector
pincount: 4
color: GN
pinlabels: [W, X, Y, Z]
S:
# autogenerate: true should no longer be required with the new syntax
style: simple
type: Splice
color: CU
F:
style: simple
type: Ferrule
color: GY
cables:
CABLE:
wirecount: 4
color_code: DIN
length: 0.1
WIRE:
wirecount: 1
colors: [BK]
length: 0.1
connections:
-
- JSTMALE.X1: [4-1] # use `.` syntax to generate a new instance of JSTMALE, named X1
- CABLE.W1: [1-4] # same syntax for cables
- [S., S., S.S1, S.] # splice W1 and W2 together; only wire #3 needs a user-defined designator
- CABLE.W2: [1-4]
- S. # test shorthand, auto-get required number of ferrules from context
- CABLE.W21: [1-4]
- JSTFEMALE.X2: [1-4]
- <=> # mate X2 and X3
- JSTMALE.X3: [1-4]
- CABLE.W3: [1-4]
- [F., F., F., F.]
- --> # insert ferrules into screw terminal connector
- X4: [2,1,4,3] # X4 does not require auto-generation, thus no `.` syntax here
-
- S1: [1] # reuse previously generated splice
# TODO: Make it work with `- F1` only, making pin 1 is implied
- WIRE.: [1] # We don't care about a simple wire's designator, auto-generate please!
# TODO: Make it work with `- W.W4: 1`, dropping the need for `[]`
- X2: [4]