Replies: 9 comments 4 replies
-
Looks great |
Beta Was this translation helpful? Give feedback.
-
That's so good!! |
Beta Was this translation helpful? Give feedback.
-
Looks interesting. Happy to help in whatever form. I have both a RPI 4b and amd64 hardware to run bCNC on. These interface to a grbl 1.1g and to a 32 bit teensy GrblHAL controller. |
Beta Was this translation helpful? Give feedback.
-
I'd be happy to help with development also, it looks great. |
Beta Was this translation helpful? Give feedback.
-
Not much updates, I've been looking into the world of material simulation to see how plausible it would be to simulate stock during simulation. It's a very interesting thing, that would make bCNC way more useful, but it does incur a lot of library dependencies maybe not worth it. I'd also love to have some commentary on the OP from @Harvie |
Beta Was this translation helpful? Give feedback.
-
Dear @infnorm I had a look at PySide2 & PySide6 and integration with PyOpenGL. I have a few questions / remarks :
Thanks for your works, |
Beta Was this translation helpful? Give feedback.
-
Some considerations - libfxfrw - Path In Freecad SW , they forbid this, because it generates errors when making offset. - eq # -----------------------------------------------------------------------------
# Compare two Vectors if they are the same
# -----------------------------------------------------------------------------
def eq(A, B, acc=EPS):
if A is None or B is None:
return False
d2 = (A[0] - B[0]) ** 2 + (A[1] - B[1]) ** 2
err = (
acc * acc * ((abs(A[0]) + abs(B[0])) ** 2
+ (abs(A[1]) + abs(B[1])) ** 2 + 1.0)
)
return d2 < err Why does it return d2<err ? |
Beta Was this translation helpful? Give feedback.
-
This is great. I'd love to help and test. |
Beta Was this translation helpful? Give feedback.
-
This great. I'd also like to help testing - running bCNC on RPi3B+ and OPi Plus (older H3 hw running with armbian bookworm) |
Beta Was this translation helpful? Give feedback.
-
I've been experimenting with some relatively major changes to bCNC.
I have loved the functionality in bCNC, the combination of CAM, the ability to run on modest RPI hardware, and its reliability. However, I wanted to improve the performance, visualization, etc.
C++ Parsing
By rewriting CNC and GCode classes mostly in C++, I was able to get a significnant speedup
9.5MB gcode takes 7.9s to read/generation motion paths for with Python code and only 0.22s to read in C++ for a 35x speedup. A key difficulty here is supporting complicated expressions. My solution here is to observe that most of the time gcode has no expressions, so just make that fast and in C++. If there is a construct that uses python expressions, just call back into python to do those lines. This seems like a good solution, because you pay for what you use. Python expression laced gcode will never be super fast, but hoepfully there will only be some of it.
A major point with this change is that the way the data is handled has to be made much more efficient. Blocks consist of strings, until you open them in the editor and then they are split into newlines. the C++ gcode simulation spits out a numpy array of a point per row which can be drawn as line segments. The name of the game is minimizing the amount of looping in Python. Even with a 10MB file, the GUI stays responsive when you don't try to edit everything at once.
OpenGL visualization
I wrote a OpenGL visualizer that allows selection, quick drawing, tumbling of camera. This works in Raspberry Pi 3b and above, Linux, Windows and MacOS. It is in particular very difficult to get this working on Raspberry PI, because of its ancient OpenGL implementation, so I carefully avoided newer features. This precludes the use of things like ModernGL though.
Rewritten UI in Qt
Qt is much faster than Tk and pretty well supported (tcl/tk is one of the slowest scripting languages because it converts every value to a string and back). It's available on every platform (I targeted PySide2 because that was available on RPI). Furthermore, it allows things like dockable widgets, dark/light themes, etc. This is potentially a lot of work. It may be possible to make bCNC support multiple GUI frontends, but I don't know that this is a great idea. My thought is to centralized commands and events in a gui agnostic way to enable this, but that also makes things work much better in general.
I considered several options here
I think the Qt GUI behaves pretty well. It doesn't look particularly modern, but that is possible to tweak with Qt styles (i.e. get a flatter look. Right now it adheres to each platform's native look mostly.
What works what doesn't.
Works
Doesn't work
I'm not sure the best way to handle this change, and I'm not yet ready to share the code, but I wanted start a discuss here at this time at least, before I went any further.
Demo videos
OpenGL canvas and running connected to GRBL
https://youtu.be/W-3MoK6CjaU
Demo of loading a 10MB file almost instantly
https://youtu.be/1qp6bpoK3oM
GCode editing
https://youtu.be/R1hdidhtygs
OpenGL canvas selection
https://youtu.be/y36fjpcXJTU
Screenshot
Beta Was this translation helpful? Give feedback.
All reactions