Re: gEDA-user: PCB - How To Find A Component?

2009-02-20 Thread Kai-Martin Knaak
On Tue, 17 Feb 2009 20:50:08 +0100, Bert Timmerman wrote:

> The final version of the FindElement plug-in is to be found here:
> 
> http://www.xs4all.nl/~ljh4timm/downloads/findelement.c

Thanks to the explicit comments in the header I had no trouble installing 
the plugin. It works fine. Any chance, that this action is going to enter 
the main source tree?

During compile time I got these warnings:

findelement.c:93: warning: initialization from incompatible pointer type
findelement.c:94: warning: initialization from incompatible pointer type

---<(kaimartin)>---
-- 
Kai-Martin Knaak
http://lilalaser.de/blog



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-17 Thread Bert Timmerman
Hi all,

On Mon, 2009-02-16 at 20:23 -0500, DJ Delorie wrote:
> > Maybe I'm overlooking something very obvious and better should restart
> > tomorrow morning after some coffee.
> 
> Close!  Elements don't always have names.  You also didn't check for
> missing arguments.  Try this bit of code:
> 
> 
> if (argc == 0 || strcasecmp (argv[0], "") == 0)
> {
> Message ("WARNING: in FindElement the argument should be a 
> non-empty string value.\n");
> return 0;
> }
> else
> {
> 
> SET_FLAG (NAMEONPCBFLAG, PCB);
> ELEMENT_LOOP(PCB->Data);
> {
> if (NAMEONPCB_NAME(element)
>   && strcmp (argv[0], NAMEONPCB_NAME(element)) == 0)
> {
> 

Thanks DJ ;-)

The final version of the FindElement plug-in is to be found here:

http://www.xs4all.nl/~ljh4timm/downloads/findelement.c

Kind regards,

Bert Timmerman.





___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-16 Thread DJ Delorie

> Maybe I'm overlooking something very obvious and better should restart
> tomorrow morning after some coffee.

Close!  Elements don't always have names.  You also didn't check for
missing arguments.  Try this bit of code:


if (argc == 0 || strcasecmp (argv[0], "") == 0)
{
Message ("WARNING: in FindElement the argument should be a 
non-empty string value.\n");
return 0;
}
else
{

SET_FLAG (NAMEONPCBFLAG, PCB);
ELEMENT_LOOP(PCB->Data);
{
if (NAMEONPCB_NAME(element)
&& strcmp (argv[0], NAMEONPCB_NAME(element)) == 0)
{


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-16 Thread Bert Timmerman
Hi all,

On Fri, 2009-02-13 at 05:53 -0500, gene wrote:
> > *Scrolling* to the selected part would be easier, and could be done as
> > a plugin.  Compare with my findrat plugin:
> > 
> >   http://www.delorie.com/pcb/findrat.c
> 
> > 
> 
> I don't even know where to begin :(  How do the plugins get compiled and 
>   executed?  Is there some docs somewhere?
> 
> gene
> 
> I tried to get a plug-in together using findrat.c (by DJ) as a template.

I does compile with some warnings and then segfaults when run.

gdb says the culprit lives in line 71, near the strcmp () call.

Maybe I'm overlooking something very obvious and better should restart
tomorrow morning after some coffee.

Anyway I think I would like my attempt sofar.

Kind regards,

Bert Timmerman. 

/*!
 * \file findelement.c
 * \author Copyright (C) 2009 by Bert Timmerman 
 * \brief Plug-in for PCB to find the specified element.
 *
 * Function to look up the specified PCB element on the screen.\n
 * \n
 * Compile like this:\n
 * \n
 * gcc -Ipath/to/pcb/src -Ipath/to/pcb -O2 -shared findelement.c -o findelement.so
 * \n\n
 * The resulting findelement.so file should go in $HOME/.pcb/plugins/\n
 * \n
 * \warning Be very strict in compiling this plug-in against the exact pcb
 * sources you compiled/installed the pcb executable (i.e. src/pcb) with.\n
 *
 * Usage: FindElement(Refdes)\n
 * \n
 * If no argument is passed, no action is carried out.\n
 *
 * 
 * This program is free software; you can redistribute it and/or modify\n
 * it under the terms of the GNU General Public License as published by\n
 * the Free Software Foundation; either version 2 of the License, or\n
 * (at your option) any later version.\n
 * \n
 * This program is distributed in the hope that it will be useful,\n
 * but WITHOUT ANY WARRANTY; without even the implied warranty of\n
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.\n
 * \n
 * You should have received a copy of the GNU General Public License\n
 * along with this program; if not, write to:\n
 * the Free Software Foundation, Inc.,\n
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n
 */


#include 
#include 

#include "global.h"
#include "data.h"
#include "hid.h"
#include "misc.h"
#include "create.h"
#include "rtree.h"
#include "undo.h"
#include "set.h"

/*!
 * \brief Find the specified element.
 *
 * Usage: FindElement(Refdes)\n
 * If no argument is passed, no action is carried out.
 */
static int
find_element (int argc, char **argv)
{
if (argc > 0 && strcasecmp (argv[0], "") == 0)
{
Message ("WARNING: in FindElement the argument should be a non-empty string value.\n");
return 0;
}
else
{

SET_FLAG (NAMEONPCBFLAG, PCB);
ELEMENT_LOOP(PCB->Data);
{
if (strcmp (argv[0], NAMEONPCB_NAME(element)) == 0)
{
gui->set_crosshair
(
element->MarkX,
element->MarkY,
HID_SC_PAN_VIEWPORT
);
}
}
END_LOOP;
gui->invalidate_all ();
IncrementUndoSerialNumber ();
return 0;
};
}


static HID_Action findelement_action_list[] =
{
{"FindElement", NULL, find_element, "Find the specified element", NULL},
{"FE", NULL, find_element, "Find the specified element", NULL}
};


REGISTER_ACTIONS (findelement_action_list)


void
pcb_plugin_init()
{
register_findelement_action_list();
}

/* EOF */


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-14 Thread gene
I'm not sure if anyone is interested, but I have a first cut of program 
to move stuff around on the board.  It executes directly on the .pcb 
file so it's not a plugin.  Also, it's in java.

Here's what it does:

1) Selects all the parts that begin with a certain label, e.g. S6/S307 
will find all parts S6/S307*
2) The parts are piled all on top of each other at some location 
specified on command line.
3) Optionally can move the labels off the top of the parts.
4) Optionally can reset the position of all parts back to a single 
location (currently near the origin).

Here's how I'm using it:
I run it multiple times for each hierarchical section.  Each time, 
placing the stack of parts in a different location.  Then, I load up 
PCB.  For each pile, I select it, then choose "disperse selected" which 
arranges them at the top of the display area.  I can then easily work 
with them by moving the group somewhere useful.  I repeat the process 
for each of the piles.

seems ok so far, but I just finished it so it may still have bugs.

regards

gene


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-13 Thread DJ Delorie

> I don't even know where to begin :( How do the plugins get compiled
> and executed?  Is there some docs somewhere?

See http://www.delorie.com/pcb/boardflip.c

I'll update findrat similarly.


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-13 Thread gene

> *Scrolling* to the selected part would be easier, and could be done as
> a plugin.  Compare with my findrat plugin:
> 
>   http://www.delorie.com/pcb/findrat.c

> 

I don't even know where to begin :(  How do the plugins get compiled and 
  executed?  Is there some docs somewhere?

gene


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-12 Thread Bdale Garbee
On Thu, 2009-02-12 at 11:10 -0800, Ben Jackson wrote:

> What I really want to do is implement my "tetris" plugin idea which feeds
> you the elements in a "natural" order for you to place.

Oohhh   ;-)

Bdale



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-12 Thread Ben Jackson
On Thu, Feb 12, 2009 at 02:35:51AM -0500, gene wrote:
> I have a large board, around 3000 components.  It's hierarchical so the 
> refdes's are long and sometimes obscures the little parts.

First off, if you are placing that many components you'll want to make
sure your elements have the refdes's in the right location to begin with.
I put up with elements with text "over" the element when I do a ~50 element
board, but it would be a lot easier to fix it in the element for a ~3000
element board!

> devices are 0603, so they are pretty small in a large sea of dispersed 
> parts.

If you haven't tried it already, get my Smart Disperse plugin (it's linked
from gedasymbols).  It's like DisperseElements() but it uses the netlist
as a hint.  So if you have an LED with a series resistor, they will almost
certainly be right next to each other.  With 3000 parts you might even
try tweaking my plugin's sort function to meet your needs.  It could easily
be made to obey hierarchy directly (rather than inferred by the netlist) --
I just didn't think of it.

What I really want to do is implement my "tetris" plugin idea which feeds
you the elements in a "natural" order for you to place.

-- 
Ben Jackson AD7GD

http://www.ben.com/


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-12 Thread DJ Delorie

> I can't find a setting for 'zoom selected', which would be really
> good for zeroing on the selected part.

Adding that wouldn't be too hard, but you'd have to do it inside the
GUI hids.

*Scrolling* to the selected part would be easier, and could be done as
a plugin.  Compare with my findrat plugin:

  http://www.delorie.com/pcb/findrat.c


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-12 Thread John Griessen
gene wrote:
> Peter Clifton wrote:
>> PCB has a (IMO mis-)feature, where if you click on a net / pin in the
>> netlist window, it will jump your mouse pointer to the pin location.
.
.
.
So, what if I:
> 1) Go find all Element lines containing the substring "S6/S307"
> 2) Edit the location attribute so that they all get placed in one easy 
> to find location.

This sounds good.  Only, I'm not sure how to change the location  easily.
Looking at gsch2pcb would give clues.   Another approach is to look for pcb 
action commands
that could move parts around based on selection by substring "S6/S307".

Peter probably thought like me at first, "in a mostly completed
layout".

John
-- 
Ecosensory   Austin TX


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-12 Thread gene
Peter Clifton wrote:
> PCB has a (IMO mis-)feature, where if you click on a net / pin in the
> netlist window, it will jump your mouse pointer to the pin location.
> 
> Perhaps (if you know what net your desired component is on), you could
> find it in the netlist window and jump to it that way.
> 
> The most recent PCB version sorts its netlist window into a tree, based
> on "/" characters in the netnames, so perhaps that helps further with
> finding things in the hierarchical design.
> 
Hi Peter,

I just had a thought.  Maybe I can script it.  Here's one line from the 
.pcb file:

Element["" "0805" "S6/S307/C210" "0.1_uF" 3485000 208 -3150 -3150 0 
100 ""]


So, what if I:
1) Go find all Element lines containing the substring "S6/S307"
2) Edit the location attribute so that they all get placed in one easy 
to find location. That is, all on top of each other.
3) Open PCB, select the pile of parts, and use 'disperse selected'.  I 
could also just manually drag all these parts off the pile.  Or, the 
script could simply separate them all.

Since I used a hierarchy, I can use this scheme multiple times by 
searching on substrings to get the groups of parts that I want.

This sounds pretty straight forward to me, in principle, unless I 
misunderstand the file format.  What do you think?

gene


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


Re: gEDA-user: PCB - How To Find A Component?

2009-02-12 Thread Peter Clifton
On Thu, 2009-02-12 at 02:35 -0500, gene wrote:
> I have a large board, around 3000 components.  It's hierarchical so the 
> refdes's are long and sometimes obscures the little parts.  Some of the 
> devices are 0603, so they are pretty small in a large sea of dispersed 
> parts.  I can't easily find a particular part.  I've tried the 'select 
> by name', which works fine on large parts, but those small 0603's are 
> impossible to locate.  Any ideas?  I can't find a setting for 'zoom 
> selected', which would be really good for zeroing on the selected part.

PCB has a (IMO mis-)feature, where if you click on a net / pin in the
netlist window, it will jump your mouse pointer to the pin location.

Perhaps (if you know what net your desired component is on), you could
find it in the netlist window and jump to it that way.

The most recent PCB version sorts its netlist window into a tree, based
on "/" characters in the netnames, so perhaps that helps further with
finding things in the hierarchical design.

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)



___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user


gEDA-user: PCB - How To Find A Component?

2009-02-11 Thread gene
I have a large board, around 3000 components.  It's hierarchical so the 
refdes's are long and sometimes obscures the little parts.  Some of the 
devices are 0603, so they are pretty small in a large sea of dispersed 
parts.  I can't easily find a particular part.  I've tried the 'select 
by name', which works fine on large parts, but those small 0603's are 
impossible to locate.  Any ideas?  I can't find a setting for 'zoom 
selected', which would be really good for zeroing on the selected part.

gene


___
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user