QT C++ graphics display WIDGET

More
24 Aug 2021 22:44 #218651 by Grotius
Hi, this is a new topic related to Chris :

Chris:
I was thinking about this the other day.
I wonder when you are finished if we could convince you two to build a QT C++ graphics display WIDGET.
If the widget uses qt properties to control it then it can be used in linuxcnc python based screens.
I would think a modern C++ based widget would have potentially more performance then a python based one.
Then your hard work could be accessed by more people.
We'd get the C++ performance but still retain the python low-bar customize-ability.

Grotius wrote: Hi Chris,

Using Qt properties is no problem.
What kind of Qt properties are on the wishlist?
With that info we can determine it's complexity. 

Chris:
Thanks for responding. I looked at the python widget and made this list for discussion.
Not all are strictly need for display but the current version does these things (plus a couple more that are not that important now) I think the (mostly) made up names are descriptive enough.
I don't wish to steal this thread so could make a new topic if you wish to discuss further.PROPERTIES
    BackgroundColor
        DROInlayBackgroundColor

SIGNALS
    GcodeProperties
    GcodeErrors
    CurrentSelectedLine
    LoadingProgress

SLOTS
    setView
    LoadProgram
    HiglightGraphicsLine
    setGraphicsView
    Clear
    zoom
    pan
    rotate
    setAlphaMode
    setShowDro
    SetDROUnits
    feedPlotColors
    RapidPlotColors
The following user(s) said Thank You: tommylight

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

More
24 Aug 2021 23:08 #218655 by Grotius
Hi,

A QT C++ graphics widget is certainly on the list and has a high priority at the moment. A universal widget
would be perfect.

In the c++ division we need it for UdoS his application and Hal-Core needs a display widget.
Then the linuxcnc-python division could also use it.

Chris, thanks for the wishlist.

Showing the dro's with background color is possible as a % transparant local widget overlay.
We can add extra qt-properties for this.
This will take some time to figur out. But i have seen examples online, discussing this solution.

I think UdoS and the python implementations are closest related. Hal-Core needs to be able to load
6 axis robots including configurable rotation matrixes, stepfiles, maybe optional dxf files.

CurrentSelectedLine of the wishlist is the hardest part i think. Not the line selecton an sich,
but giving the selected gcode line number back to lcnc. Info about this is welcome.







 
The following user(s) said Thank You: phillc54

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

More
25 Aug 2021 03:59 #218671 by Reinhard
Hi,

looks like you're talking about a successor of gremlin ...

> Showing the dro's with background color is possible as a % transparant local widget overlay.
If overlay with qt is possible, I'd like to offer my position widget.
I'm actually playing with mvc pattern in qt and have a dockable widget, which handles all position stuff



> CurrentSelectedLine of the wishlist is the hardest part i think. Not the line selecton an sich,
> but giving the selected gcode line number back to lcnc. Info about this is welcome.

When I extended your dxf-viewer, I implemented selection of elements - together with repainting of selection in different color.
In this picture, combobox selects the active plane which fills the listbox with the elements and selected item from listbox is selected in graphic view.


Usually selected element is an information, that comes from linuxcnc backend. When I developed the graphic view in java, I worked out that too. The problem is, that status from backend does not really contain the information needed to update display according to expectations - especially if exact path is not enabled.
Only CAM needs to determine selection from graphic view. But CAM does not need to send that info to linuxcnc backend.

I think, the really hard stuff is no widget requirement, but model related. Means: getting the model information from backend as well as getting up to date informations about backend progress. So this work could be splitted into model tasks and view tasks.

@grotius
if you're skilled in graphic processing, what about a "real" improvement of gremlin?
Painting lines for tool paths is pretty basic. What about a real 3D preview of the chip removal?
I saw this in an early version of deskproto - really amazing :)
Then I got to know, that this was not by intention, but by accident (slow performance).
Anyway - I think you know what I mean:
Create a workpiece and then remove the toolpath with real tool diameters and tooldepth ...
Attachments:

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

More
25 Aug 2021 19:34 - 25 Aug 2021 19:40 #218728 by Grotius
Hi,

I was investegating the widget overlay. 

The label with the white background is a child widget of the opencascade widget and is raised().
The same result we get with qtstackedlayout.

 

The black text can be a QLabel, QPlaintextedit, added in the source code of the opencascade widget.
So far as i can see, a nice methode to go on with.

Create a workpiece and then remove the toolpath with real tool diameters and tooldepth ...
Ok tomorrow when i have time, i can test the opencascade doing a solid live cut as Reinhard suggested.

BRepAlgoAPI_Cut Class

 
Attachments:
Last edit: 25 Aug 2021 19:40 by Grotius.
The following user(s) said Thank You: tommylight, Aciera

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

More
26 Aug 2021 01:11 - 26 Aug 2021 01:12 #218747 by cmorley
looking in the code (glcannon.py)
Looks like it does a simple search through arrays holding the graphics commands.
For instance this is what the cooments said about what the array self.traverse holds:

# traverse list - [line number, [start position], [end position], [tlo x, tlo y, tlo z]]

    def highlight(self, lineno, geometry):
        glLineWidth(3)
        c = self.colors['selected']
        glColor3f(*c)
        glBegin(GL_LINES)
        coords =
        for line in self.traverse:
            if line[0] != lineno: continue
            linuxcnc.line9(geometry, line[1], line[2])
            coords.append(line[1][:3])
            coords.append(line[2][:3])
        for line in self.arcfeed:
            if line[0] != lineno: continue
            linuxcnc.line9(geometry, line[1], line[2])
            coords.append(line[1][:3])
            coords.append(line[2][:3])
        for line in self.feed:
            if line[0] != lineno: continue
            linuxcnc.line9(geometry, line[1], line[2])
            coords.append(line[1][:3])
            coords.append(line[2][:3])
        glEnd()
        for line in self.dwells:
            if line[0] != lineno: continue
            self.draw_dwells([(line[0], c) + line[2:]], 2, 0)
            coords.append(line[2:5])
        glLineWidth(1)
        if coords:
            x = reduce(lambda x,y:x+y, [c[0] for c in coords]) / len(coords)
            y = reduce(lambda x,y:x+y, [c[1] for c in coords]) / len(coords)
            z = reduce(lambda x,y:x+y, [c[2] for c in coords]) / len(coords)
        else:
            x = (self.min_extents[0] + self.max_extents[0])/2
            y = (self.min_extents[1] + self.max_extents[1])/2
            z = (self.min_extents[2] + self.max_extents[2])/2
        return x, y, z



In the python module,  emcmodule.cc
is what processes the commands to make openGL commands for glcanon.
PositionLogger must track the current position while running a program?


The overlay looks great.
Stretch goals would be ability to add special cases like a configurable shaped chuck and stock outline (for lathes)

I've always been annoyed by linuxcnc's zoom feature - It would be nice to be able to zoom from cursor position rather then a fixed point.
Thanks for exploring this!

Chris
 
Last edit: 26 Aug 2021 01:12 by cmorley.
The following user(s) said Thank You: Grotius

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

More
26 Aug 2021 02:35 - 26 Aug 2021 02:42 #218751 by Grotius
Hi Chris,
Thank you for info. I hope i can figur this out.

Hi Reinhard,
The live cut is done. But this really need a high performance. It's interesting to code.

user-images.githubusercontent.com/448801...513-4a6b2b7242cd.mp4
Last edit: 26 Aug 2021 02:42 by Grotius.

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

More
26 Aug 2021 03:01 - 26 Aug 2021 03:01 #218753 by Reinhard
Great job!

Do you have the sources of opencascade?
I tried to get one, but wasn't successful. I don't have any grafic skills, so would like to change that.

For the java part, I got the interpreter result attached to the line number. So each graphic element has a line number and I have a map, where I find the grafic element by the line number.
Linuxcnc has current line number in status - so tracking current element was easy that way.
Last edit: 26 Aug 2021 03:01 by Reinhard.
The following user(s) said Thank You: Grotius

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

More
26 Aug 2021 11:36 - 26 Aug 2021 11:44 #218792 by Grotius
Hi Reinhard,

I have put the code over here:
[edit] github.com/grotius-cnc/temp/releases (it contains 4 files at the bottom)

I tried to get one, but wasn't successful. I don't have any grafic skills, so would like to change that.
The sources are : github.com/grotius-cnc/Linux-Pro/release....0.0/opencascade.deb
This will install sources, compile sources etc. Will take a while.

In the draw_primitive class are most important draw functions present, but you did already know this.








 
Last edit: 26 Aug 2021 11:44 by Grotius.

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

More
26 Aug 2021 18:34 - 26 Aug 2021 18:35 #218823 by Grotius
Hi,

I just opened the repository for the Qt graphics widget. Mr. Morley and UdoS has already write acces.

github.com/grotius-cnc/Qt_Graphics_Widget

In the mainwindow that is used for runtests, i already tested some Qproperties. These work nice !
 
Last edit: 26 Aug 2021 18:35 by Grotius.

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

More
27 Aug 2021 14:12 - 27 Aug 2021 14:13 #218908 by Grotius
Hi Gentleman,

I added a dro example to the widget, please look and comment :
user-images.githubusercontent.com/448801...373-b3bdf14df8e4.mp4

To discus, the dro properties can be for example :
  • textheight
  • transparancy
  • color
  • contains just one QString for entire dro result
  • dro position x,y
  • not highlighted by mouse visit

    etc, etc.

    I only need to know more about the dro wishlist, thanks.

Last edit: 27 Aug 2021 14:13 by Grotius.
The following user(s) said Thank You: phillc54

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

Time to create page: 0.249 seconds
Powered by Kunena Forum