Open dirkvdb2 opened 1 month ago
@dirkvdb2
If you'd like to take a stab at adding this feature, I'd be happy to answer questions/offer advice, but currently I'm away at college without a personal CNC machine and a bit busy with other projects.
I definitely agree that this should be doable. I even already wrote a different plugin that handles just translation/cloning https://plugins.octoprint.org/plugins/translatemodel/
The difficulty in doing this well really would come down to the interactive/UX design of jogging and sending those values to octoprint or a script and then properly parsing and modifying Gcode the same way your CNC will.
I would suggest you first check that your CNC machine supports offset, scaling and rotation commands--Gcodes like G52
, G54
, or G92
tend to be pretty common and are how professional CNC machines handle running the same operations across multiple parts or adjusting offsets to ensure tolerance.
If you have access to the source code of your CNC machine's firmware, then I would suggest that as a safer avenue to this functionality. While a Gcode parser is much easier to write and test, it is always guessing what the CNC machine will do with the commands; whereas, the firmware itself actually knows where it is and what it's doing.
Thank youi, will, for your quick and positive answer.
Although I dont have the programming skills to accomplish anything myself, I looked though quite a bit of info on the internet and I was really surprised there is so little.
Of course, most 3D manufacturing machines (laser, CNC, 3D printers) dont typically need to align there jobs with w workpiece (laser ‘etching’ being an exception), so I understand it is not fundamental.
On the other hand, I am pretty sure there would be a lot of use for it when readily available.
What I have in mind as my application of most interest is to align laser/CNC exposure of milling, together with drilling of holes, in double sided PCBs.
The nice work that you already did, indeed, comes very, very close – closest of anything else I found available.
These may be interesting to have a look at as far as practical setup of hardware is concerned
How to Find Part Edges on Desktop CNC Fast with An Affordable Microscope - The White Owls
Zeroing a CNC | Beatty Robotics (beatty-robotics.com)
What I had in mind as underlying software model would be coordinate-system agnostic an as such would avoid any uncertainty about what coordinate system the CNC/laser.printer is using.
The only assumption it would make is that the coordinates that arte raed as the current position would be valid fo a ‘move to’.
The idea is to make the toolhead move a a position with a fiduciual record the (X,Y) coordinates and then jog to the correct position.
The digital microscope (actually a very cheap webcam!) would have an (X,Y) offset to the toolhead, but that would be calibrated away as well.
So basically, the workflow would be like this:
Make a small ‘feature’ with laser, drill or 3D printer on a sacrificial surface and record the (Xi1, Yi1) coordinate (‘i’ for real)
Find it by jogging to it with the microscope and record (Xm1, Ym1) (‘m’ for measured)
(for accuracy: repeat (1..2) a few times
Calculate offset toolhead vs microscope crosshairs (Xd, Yd) for this particular toolhead
Then, with the workpiece in place:
Move crosshairs to fiducial 1 on workpiece
Calculate toolhead coordinates with offsets determined in (4)
Enter (type or read from file) the intended coordinate of the fiducial
(repeat 5..6 for the other fiducials, total could be 1..n)
Allow user to choose between
Simple 2D translations only (minimum one fiducial needed)
Translations and rotation (minimum of 2 fiducials needed)
Translations, rotation, scaling (minimum of 2 fiducials needed)
Calculate 4 elements of 2X2 translation matrix that will be used to ‘correct’ the intercepted move instructions
I am sorry that I cant contribute in the actual programming, but I hope that the above is helpfull.
If you require more help apart from the actual programming, please let me know!
Dirk
From: Will MacCormack @.> Sent: Saturday, 13 July 2024 22:10 To: Willmac16/OctoPrint-GcodeLeveling @.> Cc: dirkvdb2 @.>; Mention @.> Subject: Re: [Willmac16/OctoPrint-GcodeLeveling] Easy ? to add workpiece registration to electronically correct misalignment (and optionally scaling) in the XY plane (Issue #19)
@.***(https://github.com/dirkvdb2)
If you'd like to take a stab at adding this feature, I'd be happy to answer questions/offer advice, but currently I'm away at college without a personal CNC machine and a bit busy with other projects.
I definitely agree that this should be doable. I even already wrote a different plugin that handles just translation/cloning https://plugins.octoprint.org/plugins/translatemodel/
The difficulty in doing this well really would come down to the interactive/UX design of jogging and sending those values to octoprint or a script and then properly parsing and modifying Gcode the same way your CNC will.
I would suggest you first check that your CNC machine supports offset, scaling and rotation commands--Gcodes like G52, G54, or G92 tend to be pretty common and are how professional CNC machines handle running the same operations across multiple parts or adjusting offsets to ensure tolerance.
If you have access to the source code of your CNC machine's firmware, then I would suggest that as a safer avenue to this functionality. While a Gcode parser is much easier to write and test, it is always guessing what the CNC machine will do with the commands; whereas, the firmware itself actually knows where it is and what it's doing.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>DD CNCD printers)
There are no tools in many low-end CNC machines to accurately position a milling or laser plan relative the workpiece. This would be required eg. to work with a DIY PCB that has holes already drilled and need to be laser exposed, or to place a mill or laser plan in some existing feature of the workpiece.
A solution would be to allow calibrated transformation of (X, Y) cordinate into a new coordinate system based on two known workpiece-referenced tool positions (eg. fiducials). The current plugin corrects already the Z-coordinate, could perhaps easily be extended to allow calibration based on two known (X1,Y1) and (X2,Y2) points. A practical mechanism could be to move the tool to a known position, register that, than jog to the correct position and register that as well. . Repend for a second point far away from the first point. This is sufficient to calculate the four elements of a transformation matrix,
A further enhancement could be to allow multiple redundant calibrating positions and do a least squares approximation, with X-scaling, Y-scaling on/off (In some instances scaling (X, Y, both) could be useful, in other (like PCB exposure or milling) absolutely not).
Describe alternatives you've considered Mechanically repositioning the workpiece is very cumbersome and inaccurate, and does not allow for scaling.
Additional context Add any other context or screenshots about the feature request here.