QT C++ code samples

More
10 Jul 2019 20:38 - 10 Jul 2019 21:42 #139019 by Grotius
Replied by Grotius on topic QT C++ code samples
@Project update.

Arc's are included in contour recognize today.
In relation to raw dxf data, the arc's can predict the cw or ccw so simple. (g2 or g3)

The cw and cww recognize has to have a algoritme...

A few lines of C++ algoritme is not enough.

A good algoritme looks like auto nesting. Then
it can recognize inner and outher contours without any problem.


Colorcode 1 = cad red.
The arc is swapped from g2 to g3 by the algoritme to match the contour direction, see terminal output for this arc.
For this contour we know it's a ccw contour. But if it was a reqtangular shape without the arc, we only have line's to define a cw or ccw shape. That makes it more difficult.
And a final predict algoritme solution (code) is not alway's working with very complex shapes for lines. So i have to find a solution for this. 90% of the algoritme will work, but 10% will not work by complex shapes that are multiple inlined.

I will think about the auto nesting option coming day's. This will solve any contour direction cw or ccw recognize problem at once. B)

We can put out the g-code for now. But that will provide a basic program. It's my job to bring something new.
Will try to investegate auto nesting, product rotation, mirroring and optimalisation for plates.
Why not try to write some code from scratch. Try to translate your vision into output. In fact you only have to write the template. B)

The following linked program (deepnest) can not mirror the product and optimalisize it in the nesting... It's open source.
deepnest.io/ (open source, so far so good).
It's used for nesting Dassault Systems, a program called Fusion. Only available for Mac and Windows.
Today i looked by customer at deepnest, mirroring would be more effiecient. But deepnest can not mirror the product and
update the nesting.

So Linux has to use a VM (virtual machine). Strange isn't it? We are going to show something to Dassault Systems coming time.
And the final solution, that is not for sale and no hiring licences.

I won't look at the source code of this program. Better is to translate your own imagine into code.
Take for example the stress test in previous post's. I was advised to improve the python code dxf2gcode. But i would stay
in a problem situation, even when i would upgrade the python code.


Part of the message is hidden for the guests. Please log in or register to see it.
Attachments:
Last edit: 10 Jul 2019 21:42 by Grotius.
The following user(s) said Thank You: chimeno, tommylight

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

More
13 Jul 2019 22:32 - 13 Jul 2019 22:51 #139271 by Grotius
Replied by Grotius on topic QT C++ code samples
Today me have got a very basic program for you... :whistle:

It's not much, but it's something usefull for now. And it's free to use.

It can handle lines, arc's and circles. It's only for closed contours at this moment.
It can load a dxf file and save a ngc file to your specification's for linux only :laugh:
Me will not compile for windows or mac.

It's very basic, it has passed the stress test so far for 250.000+ objects.

Download link : we.tl/t-llYhQ4ei1J

Download it. To start up, unzip and type in terminal : ./DxfDecoder

The DxfDecoder gui :


The Linux Axis gui :


Next week i hope to improve some code.
We are at the beginning of something nice...
Attachments:
Last edit: 13 Jul 2019 22:51 by Grotius.
The following user(s) said Thank You: phillc54, tommylight, snoozer77

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

More
14 Jul 2019 00:16 #139276 by phillc54
Replied by phillc54 on topic QT C++ code samples
What linux distribution are you running this on?

It seems to use a later libqt5core than what is available on stretch.

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

More
15 Jul 2019 16:55 - 15 Jul 2019 17:56 #139466 by Grotius
Replied by Grotius on topic QT C++ code samples
Hi Phil,

Thanks for your reply !

What linux distribution are you running this on?
Debian 9. Uname -r : 4.9.0-8-rt-amd128

It seems to use a later libqt5core than what is available on stretch.
It seems that version Qt 5.5 is compatible with most linux distro's, this is info from qt forum.
I am building on Qt 5.12.3. Wich linux version are you using Phil? Then i can try this to run myself and find a solution.

The latest program : we.tl/t-ygF2uelACM
To run, unzip and type in terminal : ./DxfDecoder

Cad logo :


DxfDecoder :


Linuxcnc :


Have done some nice coding in the mean time. C++ is becoming my second language. B)
Every day it become's more easy to code.

I have to explain some things about the program until it is at this moment.

I made some differences related to my earlyer program examples.

1. At this moment the program read lines, arc's and circles seperate.
Related to the first C program examples, the program now has 3 C++ classes. (in total 23 classes, 23 header files until today)
One class for Line, one class for Circle and one class for Arc.

Every class is in fact a separate program. It open's the dxf file, read's the data, and closes the file when reading is finished.
This result's in a more stable program flow and very easy debug situation, and a very easy expand structure, like adding Polylines later on in the fourth class. Or a class you want to imagine yourself.

2. The program has one base_array, divided in 2 classes. This array store's all the readed dxf data into memory places as long the pc is on.

One base array is of type double (for storing large accuracy numbers iike the number : 21.000215) and one base array is of type integer ( for storing simple numbers like 1,2 or 3. )

- The program read's the dxf files for line, circle and arc. All this data is straight stored into the base_array.

Everything you see in the attached pictures comes straight ahead out of the base array, the most simple form of memory data storing, up to millions of lines. And dynamic.

We can store this dxf data into a text file instead of an array for example , but a text file is hard to manipulate and order.
A array is a easy item (instrument or tool) to manipulate, copy, and edit data.
It is the key to make an ultra fast program that can do a stress test without any problem relating to other cad cam programs !

3. The program is very simple in setup. We read in line's, circle's and arc's, we have 2 base array's to store the data, and look what we can do so far without any logic like contour recognizing, difficult algoritmes etc.

4. The program has one C++ class with all the external variables. This program stucture i found out my self. This keep's all other source and header files so empty as possible. Every new Class needs the class <variables.ccp>. This file is the post office of the whole program.

5. Good luck with coding ! Giving up is the easy part !
Attachments:
Last edit: 15 Jul 2019 17:56 by Grotius.
The following user(s) said Thank You: tommylight

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

More
16 Jul 2019 00:30 #139523 by phillc54
Replied by phillc54 on topic QT C++ code samples

I am building on Qt 5.12.3. Wich linux version are you using Phil? Then i can try this to run myself and find a solution.

I am using the ISO from the LinuxCNC website.
phill@stretch ~ $ uname -a
Linux stretch 4.9.0-6-rt-amd64 #1 SMP PREEMPT RT Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux
phill@stretch ~ $ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.9 (stretch)
Release:	9.9
Codename:	stretch

All the libQt5 stuff seems to be 5.7.1-1

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

More
16 Jul 2019 21:32 - 16 Jul 2019 21:39 #139607 by Grotius
Replied by Grotius on topic QT C++ code samples
Hi Phill.

Indeed i get the same error on my other pc that is on at my factory that has no QT installation.
Today i did some research on that pc. I have not finished because i had to go. I am at 50% of a solution. I think maybe
tomorrow i have the terminal command's ready to go... Later on i will make a install icon for you. ;)

For you at your stage you could consider a qt installation. This you can use as text editor for your python projects. And you
can test the DxfDecoder coming time during update's. And make some request's to me. ;)

Today i had not much time to code. But i did a nice thing.


Added a few setting files. They save the user preferences.. They load your default gcode intro, etc.
User can edit the file's. No programmer experience is needed. It's very easy.


This will be expanded with text input options after and before M3, M5 for your PlasmaC Gcode style... Do you like this?

To download this version, file stay's here one week : we.tl/t-t2iZnqEKrH
It has the file structure for user preferences included.
To start the program, unzip file and type in terminal : ./DxfDecoder
QT must be installed.
Attachments:
Last edit: 16 Jul 2019 21:39 by Grotius.
The following user(s) said Thank You: phillc54

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

More
16 Jul 2019 23:13 #139636 by phillc54
Replied by phillc54 on topic QT C++ code samples
I may need to set up another machine for this as I am working on a QtVCP GUI so I do have some form of Qt installed and I am not sure if adding later versions will cause problems with that.
The following user(s) said Thank You: Grotius

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

More
16 Jul 2019 23:47 #139644 by Grotius
Replied by Grotius on topic QT C++ code samples
Hi Phill,

Installing QT will not break other things. But i agree if you have very imporant work to do i would also go for the safe way.
That's why i frequently make backup's, just to be sure.

www.qt.io/download

If you download clonezilla, you can make a fast disk clone (takes 10 minutes) Then you have also a backup !! And you can try QT.

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

More
17 Jul 2019 04:56 #139670 by phillc54
Replied by phillc54 on topic QT C++ code samples
I cloned my machine and went to download QT.

They are kidding, 8.8Gb. My whole machine is only 16Gb.

Surely there is a simpler way.

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

More
17 Jul 2019 22:12 - 17 Jul 2019 22:20 #139728 by Grotius
Replied by Grotius on topic QT C++ code samples
Hi Phill,

I cloned my machine and went to download QT.
Nice work !!!

Surely there is a simpler way.
When the time is fertig, a auto installer will be made... Just like Qt.
Soon the command line installer will be fertig.

I made some progress with the contour recognize algoritme finally.
There was a tiny bug that was very hard to spot in the front end class. The swapping class.
This class looks for matching start and end point. If not, it swaps the points to a match.

Tomorrow i will try to add the open contours and circles to this.

The example works nice for closed contours now. I can make more progress now. Up to the next gear...
Soon i can make a algoritme for nesting. I will start that item when i think the basic's are more or less hufter proof.

DxfDecoder example of optimized closed contours :


Axis gui :



Latest version :
we.tl/t-mbU0YfBKBW
After unpack, type in terminal : ./DxfDecoder
Qt must be installed for now.

For example a non optimized contour. Pure base array (raw gcode output)
It forget's the corner arc's, it will do everything non logic. It stops half way the left above contour and goes to the right above
contour. Haha....
Attachments:
Last edit: 17 Jul 2019 22:20 by Grotius.
The following user(s) said Thank You: phillc54, tommylight

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

Time to create page: 0.848 seconds
Powered by Kunena Forum