Skip to content
SjoerdOptLand edited this page Oct 24, 2012 · 8 revisions

A real PCB design can be seen as the successful propagation of design constraints.

With traditional PCB design tools, these design constraints exist only in the mind of the designer. The designer must manually propagate and check the design constraints.

For example, connector J1 should be flush with the PCB border, then connected by a 50Ω trace to connector J2, that should be flush with the opposing PCB border. When changing the PCB outline, he must manually move the connectors to remain flush with the PCB border.

This is annoying while playing around with design alternatives, and error-prone for a multitude of more complex design constraints. To make PCB design more fun and less error-prone, PyPCB strives to provide a language to express some of the design constraints that exist in the designer's mind.

Constraint propagation as callables

Why not by calling order of draw functions: because calling order may serve for layering or object-oriented separation of concerns.

Lazy evaluation under Python:

  • Everything is callable and returns a guaranteed-deeply-evaluated (concrete) version of itself.
  • Functions that may return something lazy can be decorated with @resultMayBeLazy, which guarantees that the return value is concrete.

Data structures

Whenever storing a determined locus, we uniquely define the locus.

For example, a line could be defined by two points that the line goes through: (0,0),(1,1). However, (-1,-1),(2,2) describes the same line. Checking two lines for equality thus is harder than just comparing the defining points; this data structure over-defines lines. The x-intercept and y-intercept forms are better, but there is not one form that describes horizontal as well as vertical lines.

Alternatively, we could use the homogeneous form px + qy + r = 0, A = [p,q,r], where norm( A )=1 and c>=0.

Clone this wiki locally