OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Find best match for coordinate array vs vector array

  • Thread starter Thread starter Nate
  • Start date Start date
N

Nate

Guest
I am working on matching a scanned part to an AutoCAD dxf file, for a CNC-type machine. Currently working with Python. I'm only matching the side profile of the top of the part, meaning I only have a single curved/shaped line I need to match, not a complex 3D object. Example snip from a CAD file shown below.

Example Tool Path

For the CAD data, I'm using ezdxf to extract the polyline into a set of segments or vectors like below:

Code:
POLYLINE(#100):
  LINE(#141):
    START:       (0.0, 0.0, 0.0)
    END:         (0.056535, -0.097921, 0.0)
  ARC(#142):
    START:       (0.001108999999999985, -0.340083, 0.0)
    END:         (0.056535, -0.09792100000000001, 0.0)
    CENTER:      (-0.10151504858169047, -0.18917047707448414, 0.0)
    RADIUS:      0.18250009567954073
    START ANGLE: -55.783380656799125
    END ANGLE:   29.99979308784541
  ARC(#143):
    START:       (-0.014502999999999988, -0.34987999999999997, 0.0)
    END:         (0.0011089999999999989, -0.340083, 0.0)
    CENTER:      (-0.13975611047144998, -0.1329452814963482, 0.0)
    RADIUS:      0.25049753247294054
    START ANGLE: -59.998852627682936
    END ANGLE:   -55.78212995237357
  ARC(#144):
    etc....

The scanned data will be an array of thousands X/Y coordinates that traces the same 2D line. I need to be able to find the best matching CAD file, and be able to correctly "overlap" the two arrays. The CAD file is the tool path I will need to cut, and I need to automatically detect the start location.

I'm considering using OpenCV's match feature:(https://docs.opencv.org/4.x/d5/d45/tutorial_py_contours_more_functions.html#autotoc_md1357) However, this means I would need to take each data set, generate an SVG vector file, convert it to a PNG file, import to OpenCV and then perform the manipulations. Is there a more straight forward way to do this that I'm overlooking?

Thanks!
<p>I am working on matching a scanned part to an AutoCAD dxf file, for a CNC-type machine. Currently working with Python. I'm only matching the side profile of the top of the part, meaning I only have a single curved/shaped line I need to match, not a complex 3D object. Example snip from a CAD file shown below.</p>
<p><a href="https://i.sstatic.net/gSGcfYIz.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gSGcfYIz.png" alt="Example Tool Path" /></a></p>
<p>For the CAD data, I'm using ezdxf to extract the polyline into a set of segments or vectors like below:</p>
<pre><code>POLYLINE(#100):
LINE(#141):
START: (0.0, 0.0, 0.0)
END: (0.056535, -0.097921, 0.0)
ARC(#142):
START: (0.001108999999999985, -0.340083, 0.0)
END: (0.056535, -0.09792100000000001, 0.0)
CENTER: (-0.10151504858169047, -0.18917047707448414, 0.0)
RADIUS: 0.18250009567954073
START ANGLE: -55.783380656799125
END ANGLE: 29.99979308784541
ARC(#143):
START: (-0.014502999999999988, -0.34987999999999997, 0.0)
END: (0.0011089999999999989, -0.340083, 0.0)
CENTER: (-0.13975611047144998, -0.1329452814963482, 0.0)
RADIUS: 0.25049753247294054
START ANGLE: -59.998852627682936
END ANGLE: -55.78212995237357
ARC(#144):
etc....
</code></pre>
<p>The scanned data will be an array of thousands X/Y coordinates that traces the same 2D line. I need to be able to find the best matching CAD file, and be able to correctly "overlap" the two arrays. The CAD file is the tool path I will need to cut, and I need to automatically detect the start location.</p>
<p>I'm considering using OpenCV's match feature:(<a href="https://docs.opencv.org/4.x/d5/d45/tutorial_py_contours_more_functions.html#autotoc_md1357" rel="nofollow noreferrer">https://docs.opencv.org/4.x/d5/d45/tutorial_py_contours_more_functions.html#autotoc_md1357</a>)
However, this means I would need to take each data set, generate an SVG vector file, convert it to a PNG file, import to OpenCV and then perform the manipulations. Is there a more straight forward way to do this that I'm overlooking?</p>
<p>Thanks!</p>
 

Latest posts

I
Replies
0
Views
1
impact christian
I
Top