Skip to content

[feature] Improved auto-generated connectors and cables #184

@17o2

Description

@17o2

From the syntax description:

If autogenerate: true is set, the connector will not be generated at first. When defining the connections section (see below), every time the connector is mentioned, a new instance with an auto-incremented designator is generated and attached.

Since the auto-incremented and auto-assigned designator is not known to the user, one instance of the connector can not be referenced again outside the point of creation. The autogenerate: true option is therefore only useful for terminals with only one wire attached, or splices with exactly one wire going in, and one wire going out. If more wires are to be attached (e.g. for a three-way splice, or a crimp where multiple wires are joined), a separate connector with autogenerate: false and a user-defined, unique designator needs to be used.

An idea to remove the restriction of not knowing the designator of auto-generated connectors and not being able to reference them at a later point, would be to add a new syntax feature to allow the user to assign designators to auto-generated connectors.

Proposed syntax:

X.X1

[Edit 2020-10-22: changed from -> to . to distinguish from arrows proposed in #134]

This would generate a new instance of component X and assign it the X1 designator.
This is just an idea, an other possible alternatives come to mind:

  • X.X1
  • X->X1 (possible confusion with arrow notation discussed in [feature] Connector-Connector & Connector-Ferrule mating #134)
  • X:X1 (seems to be legal YAML, even when used as dict key X:X1: [1-4] but probably risky/confusing)
  • X$X1
  • X1(X)
  • X1@X
  • and many more
    The following example takes this a step further, and proposes auto-generating cables as well.

Example for a Y-splice, reusing connectors, ferrules and cables through auto-generation:

connectors:
  X:
    autogenerate: true
    pincount: 4

  F:
    autogenerate: true
    style: simple
    type: ferrule

cables:
  C:
    autogenerate: true
    wirecount: 4
    color_code: DIN

connections:
  -
    - X.X2: [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]

refautogen

The idea is to make the new syntax work in additon to the current one, which generates unknown, auto-incremented designators not exposed to the user, since that should be good enough for simple cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions