Some problems of building a new GUI by qt

More
23 Nov 2012 16:10 #26874 by miaochengyu
I begin to learn LinuxCNC two weeks ago, I want to build a new GUI with QT.
I have already able to get status of the machine to shown on QT lable, and also able to start auto run by click a button on my widget. All these work is done via emcStatus and emcCommand buffers.
But some problems blocks me.
1,I want to show the graphic preview of G code, I try to fetch data from NML_INTERP_LIST after open file via "axis", but nothing got. How can I get the result after interp?
2,For a flame cutting machine, some times need run G code reverse. For example, a square code like:
G01 X10 Y0 // 1
G01 X0 Y10 // 2
G01 X-10 Y0 // 3
G01 X0 Y-10 // 4
I may pause the running on second line, and then run reverse (which is called step back) until to the middle of first line, while step back, the running of G code should also be blend, how to realize this goal?

Please Log in or Create an account to join the conversation.

More
24 Nov 2012 01:48 #26882 by ArcEye
Hi

I too am slowly writing a Qt GUI, but currently I am concentrating on writing a fully Qt C++ based interface library, using Qt data types to more easily integrate with it later.

I want to show the graphic preview of G code,

You will need to delve into a lot of python to have a look at how Axis does it. It uses python bindings to access the underlying HAL and NML and is not easy to follow.
/lib/python/rs274 contains a lot of the drawing code
/lib/python contains hal.py linuxcnc.py etc

I haven't go around to the OpenGL plot yet.
I intend to use a QGLWidget embedded in a tab.

It occurred to me that to produce a preview, all you needed was the current file name and then read it in and draw the tool path line by line.

To produce a representation of the tool travelling on this path, you need to know the current line number ( emcStatus->task.currentLine ) and the current positions of each axis
( emcStatus->motion.traj.actualPosition.tran.x; ) or similar
The previous line number will supply the point of origin and the current line the end point

Whether this simplistic approach will work remains to be seen ;) I intend leaving the plot rendering until last, I already have machine control, homing, jogging, MDI commands Program execution and DROs done
Will be interested to see how you fare with it

regards

Please Log in or Create an account to join the conversation.

More
24 Nov 2012 10:04 #26889 by miaochengyu
I agree to use QGLWidget.
I have not see python/rs274 yet, so I don't know how it process the problem of traj after G41/G42 compensation, it is really a hard work to do by myself :(
The another problem is that after blend, would the controller's running traj exactly same with G code's traj?
Like the attach's pic, blak line is the G code traj, would the controller to run on the red line because of blend?
Attachments:

Please Log in or Create an account to join the conversation.

More
24 Nov 2012 15:10 #26890 by ArcEye
You are right about blending of 2 straight lines unless you use absolute path /stop G61
Sometimes the only way to cut a proper square shape is to program a slight hash with the cuts overrunning the corners of the square.
Out of G61, the faster the feed the more the curvature, so you see it especially on rapid returns.

The reason I left this until last is because of the difficulty of implementing it and the necessity to dissect the Axis code to establish exactly what it uses to get the data.
If you were writing another python GUI you could just copy everything!

regards

Please Log in or Create an account to join the conversation.

More
26 Nov 2012 22:07 #26958 by ArcEye
Well now I have an openGL rendering widget for plot preview, so now I too need to learn openGL programming and disassemble Gremlin etc to see how it is done in Axis. :unsure:


Attachments:

Please Log in or Create an account to join the conversation.

More
27 Nov 2012 08:34 #26969 by miaochengyu
Nice work!
I found it important to understand the detail structure of linuxcnc.
My goal is to create a absolute new GUI not for common use, it may just very suitable to use on flame cutting machine.
Of course your work can help me a lot, but before I start the work I still need to read more about linuxcnc.
I think many people is expecting your work:)

Please Log in or Create an account to join the conversation.

More
27 Nov 2012 20:11 #26986 by BigJohnT
Have you seen my gui tutorials? They are not QT but may give you some ideas.

John

Please Log in or Create an account to join the conversation.

More
12 May 2014 17:17 #46838 by atihillbilly
hi, how far have you proceeded in your project, i need exactly what your are up to, stopping in the middle of a code, run reverse a bit, and retry forward. please let me know how much you have done this far. thank you

Please Log in or Create an account to join the conversation.

More
12 May 2014 18:38 #46839 by ArcEye
Hi

My project is on hold pending changes in the code to replace NML etc

I didn't write a new gremlin widget in the end, I embedded the existing python one into the app.

You should go to the MachineKit project. Alex Rosseler is developing Qt5 GUIs using QtQuick and Qml.
He has already developed some widgets similar to the gladevcp ones for building GUIs

groups.google.com/forum/#!forum/machinekit and search qtvcp

regards

Please Log in or Create an account to join the conversation.

Time to create page: 0.086 seconds
Powered by Kunena Forum