Understanding the Fritzing object model for connectors and connections

This is mostly about Fritzing’s object model for connectors and parts.  It might be pertinent to other EDA tools.  I wrote this quickly. It could be wrong.  It is not a complete object model, for example it doesn’t discuss packages.

Audience

– Fritzing users (and users of other EDA apps.)

– makers of Fritzing parts

– Fritzing developers

About Object Models

Object modeling is a computer programming subject.  Object modeling is math.  It helps you think about the world.  There is truth to it that derives from the real world.

In this blog, I use CamelCase for class names, and lower case for less formal terms.  As is typical in object modeling, I often blur the distinction between an instance of an object and a class of object.

References

This is also discussed  in the developer docs for Fritzing part files.  Where they note that the schema ( i.e. the object model) is not yet formally documented.

FritzingConnector

(Fritzing docs usually just say ‘connector’).

A FritzingConnector is an object where you can make a Connection.  In other words, when using Fritzing, something to which you can drag a wire, or which connects two parts when you  drop one onto the other such that their connectors align or overlap.

The most common FritzingConnector is usually just called a pin.  ‘Pin’ commonly means a needle-like metal piece extending from a part.  But more generally, a FritzingConnector can be:

  • an SMD pad,
  • a female socket
  • an end of a wire.
  • a side of a via ( a depth-dimension ‘wire’ crossing between copper layers.)

A Connector of a FritzingPart has an attribute ‘id.’

Connection

A Connection is an association between exactly two FritzingConnectors.  A FritzingConnector can be in many Connections.

FritzingPart

(Fritzing docs usually just say ‘part’).

A FritzingPart comprises a set of FritzingConnectors ( and other things not discussed here.)  A FritzingConnector instance is owned by exactly only FritzingPart.

Connectors and representations

Fritzing has three different representations of a FritzingPart.  (Fritzing shows breadboard, schematic, or PCB views, where a view is a set of representations of parts.)  In other words, a FritzingPart has three SVG image files, one for each view.  The SVG image file is the representation.

A Connector of a FritzingPart SHOULD appear in each representation (more precisely, there should be some SVG element of the representation that is associated with the Connector.)

When you are using Fritzing to make connections and click the mouse somewhere, the Fritzing app determines which representation (which colored area) you clicked in and whether that area is the representation of some Connector, and thus can be connected to.

When you are creating a Fritzing part using Fritzing app’s Part Editor, there is a GUI action (point-and-click) that associates each Connector with its representation.  Fritzing associates the Connector.id with the SVG attribute named ‘id’ of some SVG element of the SVG file.

Implementation details: Fritzing does this in the XML file that specifies the FritzingPart.  Under the XML ‘connector’ element having an attribute id with the value of the Connector.id e.g. ‘connector0’, it creates another XML element such as:

<p svgId="connector0pad" layer="copper0" />

where ‘connector0pad’ is the id of the SVG element that represents the Connector.

FritzingConnectPart

FritzingConnectPart is a specialized subclass of FritzingPart: it has internal Connections.  Commonly, people use ‘connector’ to mean an electro-mechanical plug, such as on both ends of a cable.  If you think about it, a plug on such a cable has FritzingConnectors:

  • the prongs on the pluggable, business end of the plug
  • terminals hidden inside the plug where the wires of the cable are soldered or crimped

Again, what most people call a connector comprises many formal FritzingConnectors (as defined here in the context of Fritzing.)

A breadboard is a FritzingConnectPart.  A breadboard consists of many female FritzingConnectors, with subsets of them internally connected.

An adaptor is a FritzingConnectPart.  An adaptor is a component that adapts the footprint of one part to another footprint.  In other words, it has two sets of FritzingConnectors, internally connected, where each set of FritzingConnectors has a different footprint.

Wire

A Wire is a FritzingConnectPart.  It has exactly two FritzingConnectors.  It has an internal connection between the Connectors.  You can drag and drop each of the FritzingConnectors onto another FritzingConnector (such as the pin of a part) to make a Connection.

TODO more discussion here about ratsnest wires, connecting two wire ends, bending a wire, etc.

Most people don’t think of a wire as a part, they think of  ‘parts’ as ready-made components instead of something you cut.  Also, wires as they appear in Fritzing views have dynamic representations; most people think of ‘parts’ as having a fixed representation between design sessions.

Via

A Via is a FritzingConnectPart.  It has exactly two Connectors.  It has an internal connection between the Connectors (like a Wire.)  Each of the Connectors are in different copper layers.  Thus a  via helps to make a connection (the informal one, a network) between copper layers.  TODO more discussion.

Parts called ‘Connections’

Fritzing has a group of parts under the label ‘Connection’.  These are FritzingConnectParts.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s