aM,
There are basically two options for what you want to do:
1) manipulate the netlist elements directly
2) transform an entire "layer", and then optionally merge it with
another layer later
I'm not quite clear which would work better for you, but I'll quickly
explain both
The netlist elements are almost direct mappings to the RS274X spec,
so it can be a little unintuitive. You can kind of think of each
element as either a) a draw operation (line, arc, etc) or b) a flash
operation. To move the "pen" between points, you just draw a line from
the current position to where you want to go, but turn the pen "off"
(this is the aperture_state property of the gerbv_net struct). So, I'm
guessing the element you're looking at is probably just moving the pen
from y=0 to y=8.828 mils with the aperture_state == OFF. For certain
operations such as flashed shapes (like circular and rectangular pads),
the start and stop points will be the same, since the pen isn't moving
during a flash.
If you want to move a netlist section around, you basically just
need to translate all the start and stop coordinates by the translation
amount. If you have any drawn arcs, you'll also need to translate the
center point coordinates in the cirseg property of the gerbv_net struct.
If you want to move everything inside a layer (or file), then it's
much easier. Just change the translate properties in the
gerbv_user_transformation_t struct associated with the
gerbv_fileinfo_t. The renderer will then transform the layer display
when refreshed. This is very easy if you want to
transform/rotate/scale everything inside a layer. If you want to merge
it with another later layer, it will keep the user-modified
transformation and merge it into the correct spot.
Hope this helps--
Julian
On 09/07/2010 12:46 PM, a m wrote:
Hello,
I'd like to be able to read a component from gerber files, find its
centroid, and be able to move it around on top of an existing pcb layout.
Basically, say i'm viewing solder and silk masks for a large circuit.
I want to read in the gerber to some single component and be able to
'display' it so that i can see how it fits in a given area, to see
what's around it, etc.
My approach so far has to been to use some tool to export individual
packages (e.g. SOT23, 0603, etc) to individual sets of gerber files
containing only that component, then read these in and try to display
them on top of some loaded pcb layout. I'm building on top of the GUI
in doc/example-code/example6.c. I've found that i can 'move' these
components around by adjusting their netlist. Hover, I dont quite
understand how a netlist is populated well enough to do this moving
with precision.
Ideally, i'd be able to find the centoid, or some corner of this
component, then be able to place it in any specified location on my
PCB by adjusting the component's netlist appropriately.
Below, i've printed out the netlist for the solder layer of a
component. It has 3 solder pads. I dont understand how to make sense
of "netlist [1] variables" below.
What does it mean that start_y is 0, while stop_y is 8.826?
This is a relatively small component consisting of 3 little solder
pads... so what can be 8.8 units long?
Next mystery is netlist [3] where a component's start_x and stop_x are
equal.
The boundingBoxes seem to look more reasonable.
Printing netlist [0] variables:
start_x: 0
start_y: 0
stop_x: 0
stop_y: 0
boundingBox.left: 0
boundingBox.right: 0
boundingBox.bottom: 0
boundingBox.top: 0
aperture: 0
label: 0
Printing netlist [1] variables:
start_x: 0
start_y: 0
stop_x: 0.821
stop_y: 8.862
boundingBox.left: 0.8035
boundingBox.right: 0.8385
boundingBox.bottom: 8.846
boundingBox.top: 8.878
aperture: 16
label: 0
Printing netlist [2] variables:
start_x: 0.821
start_y: 8.862
stop_x: 0.9
stop_y: 8.825
boundingBox.left: 0.8825
boundingBox.right: 0.9175
boundingBox.bottom: 8.809
boundingBox.top: 8.841
aperture: 16
label: 0
Printing netlist [3] variables:
start_x: 0.9
start_y: 8.825
stop_x: 0.9
stop_y: 8.9
boundingBox.left: 0.8825
boundingBox.right: 0.9175
boundingBox.bottom: 8.884
boundingBox.top: 8.916
aperture: 16
label: 0
Is there a better way to achieve my objectives or is there an
explanation of netlist logic that i can be pointed to?
thanks,
aM
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Gerbv-devel mailing list
Gerbv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gerbv-devel
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Gerbv-devel mailing list
Gerbv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gerbv-devel