Closed GoogleCodeExporter closed 8 years ago
I've started on an idea where an operator can select a single piece of graphics
and
then add a 'CorrelationTool' tool. The CorrelationTool object searches the
whole
graphics file for graphical elements that 'look' like the one selected. It's
not
ready yet and there are some fundamental problems with my existing design. My
motivation was to generate a drilling cycle for all holes in a PCB. I took a
JPG
image of a PCB and used Inkscape to perform an edge detection algorithm to it.
This
produced a vector representation of the outlines on the board. We can use the
Inkscape GCode plugin to generate the GCode to perform the isolation routing
but I
also wanted to drill the holes.
I can import the vector file into HeeksCNC and it has small circular sketches
surrounding the holes in the centre of the pads. I wanted to select one of
these
small sketches and have it search for other sketch elements that are of a
similar
size (there is a 'scaling factor' option) and that also look alike. My
existing idea
is to check the size by comparing bounding boxes. If we can scale up or down
by no
more than some configurable amount then we could consider it of a similar size.
I
then draw lines from the centre of the bounding box out in 10 different
directions
(the number being configurable). I record the distances from the centre point
to the
intersection point for each line. I then compare these lists of distance
values for
both the reference and sample objects to decide if they're similar.
I was hoping that this 'CorrelationTool' object could exist by itself as a
long-lived
'selection' feature. I can then select a CuttingTool object as well as this one
before adding a DrillingCycle object. The DrillingCycle object would simply
ask the
CorrelationTool 'where' it had location points. At this time of 'asking', the
CorrelationTool would search again.
As I said, I am having trouble with it and it may not even 'get off the ground'
It's
just 'food for thought'
Original comment by David.Ni...@gmail.com
on 18 Jun 2009 at 11:50
This idea of asking one object 'where' its locations are is something I've done
a bit
of now and I was wondering if we should extend the idea. I have replicated it
in a
few classes now and I was wondering if we wanted to standardize on one method
and add
it to the COp class for other operations classes to inherit. Again, I'm just
typing
out loud.
Original comment by David.Ni...@gmail.com
on 18 Jun 2009 at 11:54
To me, coming from an end-user perspective, the relationship between sketches
and
operations is intuitive. I don't know how other users use multiple sketches in
a
drawing, but I think it would be sufficient to use the CorrelationTool to
select the
entities, then 'make sketch' with the selection so that the operation can be
applied
to the sketch. My $02.
Original comment by shopinth...@gmail.com
on 19 Jun 2009 at 2:25
I think you're right. The CorrelationTool module should really provide a
'select
similar' feature in the same way as many applications have a 'select all'
feature.
Once selected, an operation can be selected so as to apply that operation to all
selected objects. This mechanism may work around one of the problems that I
have.
If the scanning process is transient then I won't have the save/restore problem
I
currently have.
The problem is that I haven't been looking at the CAD part of the source very
much.
I will probably need to look at the 'select' functionality that's already there.
I will see how I go.
Original comment by David.Ni...@gmail.com
on 19 Jun 2009 at 3:08
I've finished my work on this. I moved the CorrelationTool class into HeeksCAD
instead and invoked it when the SHIFT key is depressed during the select mode
functionality. i.e. in the same way as one would use the CONTROL key to select
one
more object at a time, this function allows one to press the SHIFT key before
selecting an object. In this case it selects all objects that 'look like' this
one.
With these selections, it's a matter of adding a cutting tool to the selection and
then adding a drilling cycle.
Not all basic element types have the Intersects() method enabled for them
(BSplines
for example). To this end, the CorrelationTool will select based on size alone
rather than size and shape.
In any case I'm going to leave it where it is for now.
Original comment by David.Ni...@gmail.com
on 24 Jun 2009 at 9:02
Original issue reported on code.google.com by
shopinth...@gmail.com
on 18 Jun 2009 at 10:37