How would you design a real time application for cnc control in c / c++ ???

More
24 Jan 2022 17:32 #232986 by Grotius
Just for info.

For opencascade i have a new example for linux users : github.com/grotius-cnc/occt-samples-qopenglwidget
  1. made linux compatible.
  2. It has widget overlay.
The following user(s) said Thank You: tommylight

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

More
24 Jan 2022 18:45 #232996 by bkt
The following user(s) said Thank You: Grotius

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

More
26 Jan 2022 21:57 #233236 by Grotius
Hi,

I coded some more and finally came up with this template desgin.


github.com/grotius-cnc/occt-samples-qopenglwidget

The nice thing is, it tracks your current mouse position onto the objects.
It is based on graphical gui design. Has qt widget overlay, and has some additional menu options.
 

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

More
03 Feb 2022 01:08 #233848 by Grotius
Hi,

The past 8 day's i did a OpenCascade Hacking Course.
The result is zuperrr satisfying.

The problem was as follows.

With Opencascade you can draw nice things, like 3d models, gcode, cad data etc.
This is all done trough the opencascade  c++ api.

In some scenario's you want to do a direct OpenGL function call from Opencascade and render this to the screen.
Haha..
Problem... You guess.

An exotic direct opengl call could be this project : github.com/grotius-cnc/qt_3d_mouse_ray-tracing
It is used for ray-tracing. But you can forward the lcnc gremlin gui in this way. Lots of scenario's need
direct opengl commands.

You can not draw a opengl core coded line, point etc with Opencascade.
But after some investegation and source code modifiation
i could draw a line's in opengl trough the opencascade interface.

 

Source code :

 

Now i will make a permanent hook into the source of opencascade. The opencascade lib is now compiled as qt project.
The new Opencascade.deb archive will have this opengl core code hook.







 
Attachments:
The following user(s) said Thank You: tommylight, bkt

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

More
05 Feb 2022 00:40 #234003 by Grotius
Hi,

Currently working on a file converter. As you can see, i am quite close.

- Gcode to Dxf converter.
 

- I had to expand the widget a little bit more. After above is working, i need the stl file input working.


 
Attachments:
The following user(s) said Thank You: tommylight

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

More
05 Feb 2022 17:49 - 05 Feb 2022 17:51 #234034 by Grotius
Hi,

Ok this works. It can now export some different filetypes.
It looks like a gcode ripper : www.scorchworks.com/Gcoderipper/gcoderipper.html#split

I had to dive into the cad arc angles a little bit. In opencascade the angles differs a bit from the autocad angles.
Now that's solved. For example. Autocad radians 0 = east position. Opencascade works a little different.

export stefile solid (.step) to dxf (.dxf)


export gcodefile (ngc) to dxf (.dxf)
 

exporting a dxf to ngc will have no value. It has to be organized, and a dxf is far from organized.
Attachments:
Last edit: 05 Feb 2022 17:51 by Grotius.
The following user(s) said Thank You: tommylight

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

More
07 Feb 2022 16:16 #234257 by udoS
@Grotius

Hi Grotius
how could this new knowledge help to create a realy good and fast realtime path.
Any new insight on that topic.

About your sample:

in Line 351 and 368
 //myView->SetWindow (aWindow, (Aspect_RenderingContext) glXGetCurrentContext());

I do not find " glXGetCurrentContext() "

Debian 10
QtCreator5.0.2
occ 7.6
Vulkan Instance Version: 1.1.97

Best Regards

 
Attachments:

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

More
20 Feb 2022 18:43 #235407 by Grotius
Hi,

The "glXGetCurrentContext()" comes from the glx.h file wich is included by installing :
$ sudo apt-get install libgl1-mesa-dev

how could this new knowledge help to create a realy good and fast realtime path.
I tested program's over 1000.000 lines a few weeks ago. This is usable to preview toolpaths.
This will explain how to setup this type of shapes.

Currently building a sketcher app.
 

 
Attachments:
The following user(s) said Thank You: tommylight

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

More
23 Feb 2022 06:02 #235582 by udoS
@Grotius

That looks really good.

Grotius, have you ever tried to separate the cnc from the HAL.
How do the HAL and the cnc interact at startup. ?

 

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

More
01 Mar 2022 21:57 #236132 by Grotius
Hi Udo,

Grotius, have you ever tried to separate the cnc from the HAL.
I don't get this question. But you don't need hal to create a cnc program like lcnc.
Hal is just a connection to talk to real hardware.
You could make a program without hal and just sent data to some port of your pc. Only problem is
if you need 1ms to update, you end up writing a kernel module. Hal is a kernel module.

How do the HAL and the cnc interact at startup. ?
In hal-core latest examples this is tricky to understand.

It all start's in hal.
1.halmodule.c load's some dynamic memory in a *ptr.  
(this is a array of data, like numbers, text etc, c-code compatible)

2.Then the *ptr is passed to the c++ side in userland. 
(the *ptr is readed by the qt-app. The qt-app also stores data back into the pointer).

3.The app has done it's thing and the *ptr is given back to the halmodule.c to be ready to read out.
(there is a flag that tells the halmodule, when to read out, because the thread's are different).

 
The following user(s) said Thank You: tommylight

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

Time to create page: 0.432 seconds
Powered by Kunena Forum