pcb 4.1.1
An interactive printed circuit board layout editor.

smartdisperse.c File Reference

Smart dispersion of elements. More...

#include <stdio.h>
#include <math.h>
#include "config.h"
#include "global.h"
#include "data.h"
#include "hid.h"
#include "misc.h"
#include "create.h"
#include "rtree.h"
#include "undo.h"
#include "rats.h"
#include "error.h"
#include "move.h"
#include "draw.h"
#include "set.h"
Include dependency graph for smartdisperse.c:

Go to the source code of this file.

Defines

#define GAP   10000
#define ELEMENT_N(DATA, ELT)   ((ELT) - (DATA)->Element)
#define VISITED(ELT)   (visited[ELEMENT_N(PCB->Data, (ELT))])
#define IS_ELEMENT(CONN)   ((CONN)->type == PAD_TYPE || (CONN)->type == PIN_TYPE)
#define ARG(n)   (argc > (n) ? argv[n] : 0)

Functions

static void place (ElementType *element)
 Place one element.
static Coord padDX (ConnectionType *conn)
 Return the X location of a connection's pad or pin within its element.
static int padorder (ConnectionType *conna, ConnectionType *connb)
 Return true if ea,eb would be the best order, else eb,ea, based on pad loc.
static int smartdisperse (int argc, char **argv, Coord x, Coord y)
void hid_smartdisperse_init ()

Variables

static Coord minx
static Coord miny
static Coord maxx
static Coord maxy
static const char smartdisperse_syntax [] = "SmartDisperse([All|Selected])"
static HID_Action smartdisperse_action_list []

Detailed Description

Smart dispersion of elements.

Improve the initial dispersion of elements by choosing an order based on the netlist, rather than the arbitrary element order. This isn't the same as a global autoplace, it's more of a linear autoplace. It might make some useful local groupings. For example, you should not have to chase all over the board to find the resistor that goes with a given LED.


Copyright.


Author:
Copyright (C) 2007 Ben Jackson <ben@ben.com> based on teardrops.c by Copyright (C) 2006 DJ Delorie <dj@delorie.com> as well as the original action.c, and autoplace.c.

Licensed under the terms of the GNU General Public License, version 2 or later.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Contact addresses for paper mail and Email: Harry Eaton, 6697 Buttonhole Ct, Columbia, MD 21044, USA haceaton@aplcomm.jhuapl.edu

Definition in file smartdisperse.c.


Define Documentation

#define ARG (   n)    (argc > (n) ? argv[n] : 0)

Definition at line 153 of file smartdisperse.c.

Referenced by smartdisperse().

#define ELEMENT_N (   DATA,
  ELT 
)    ((ELT) - (DATA)->Element)

Definition at line 149 of file smartdisperse.c.

#define GAP   10000

Definition at line 60 of file smartdisperse.c.

Referenced by ActionDisperseElements(), place(), and smartdisperse().

#define IS_ELEMENT (   CONN)    ((CONN)->type == PAD_TYPE || (CONN)->type == PIN_TYPE)

Definition at line 151 of file smartdisperse.c.

Referenced by smartdisperse().

#define VISITED (   ELT)    (visited[ELEMENT_N(PCB->Data, (ELT))])

Definition at line 150 of file smartdisperse.c.

Referenced by smartdisperse().


Function Documentation

void hid_smartdisperse_init ( )

Definition at line 312 of file smartdisperse.c.

static Coord padDX ( ConnectionType conn) [static]

Return the X location of a connection's pad or pin within its element.

Definition at line 122 of file smartdisperse.c.

References line, ConnectionType::ptr1, and ConnectionType::ptr2.

Referenced by padorder().

static int padorder ( ConnectionType conna,
ConnectionType connb 
) [static]

Return true if ea,eb would be the best order, else eb,ea, based on pad loc.

Definition at line 136 of file smartdisperse.c.

References padDX().

Referenced by smartdisperse().

Here is the call graph for this function:

static void place ( ElementType element) [static]

Place one element.

Must initialize statics above before calling for the first time.

This is taken almost entirely from ActionDisperseElements, with cleanup

Definition at line 74 of file smartdisperse.c.

References AddObjectToMoveUndoList(), PCBType::Data, GAP, PCBType::Grid, ElementType::MarkX, ElementType::MarkY, PCBType::MaxWidth, maxy, minx, miny, MoveElementLowLevel(), and PCB.

Referenced by smartdisperse().

Here is the call graph for this function:

static int smartdisperse ( int  argc,
char **  argv,
Coord  x,
Coord  y 
) [static]

Variable Documentation

Initial value:
{
  {"smartdisperse", NULL, smartdisperse, NULL, NULL}
}

Definition at line 304 of file smartdisperse.c.

const char smartdisperse_syntax[] = "SmartDisperse([All|Selected])" [static]

Definition at line 155 of file smartdisperse.c.