QT C++ code samples

More
02 Aug 2019 14:38 #141188 by Grotius
Replied by Grotius on topic QT C++ code samples
Hi,

We got the contour offset algoritme working now for a line-line contour offset of only one product at the moment.

It works nice !!



Coming time we can expand this algoritme with the already tested line-arc and arc-arc intersection classes. (see previous posts).
Attachments:
The following user(s) said Thank You: tommylight

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

More
02 Aug 2019 17:15 - 02 Aug 2019 18:26 #141207 by Grotius
Replied by Grotius on topic QT C++ code samples
Thank you Phill and Tommy,

I hope soon we make progress. It's a long way to the top for sure... B)

We have a closed contour, and i was curious about other cam program's so i tested this example in sheetcam.

Sheetcam output :


Dxfdecoder output :


Why has sheetcam no full output for this example?

Another example of a more complex shape :
Sheetcam output :


DxfDecoder output :


Okey a while ago i learned from Rodw how to use Switch state's in C, used for custom linux plasma component's that time.
I integrated the switch statement as C code into the C++ dxfdecoder project to startup a structure that deals with multiple contour offset's and mutiple intersection types, like line-line, line-arc, arc-arc and visa versa.
The finishing touch of a nice program that can do contour offset's needs this structure now...

WIth the knowlegde we now have, we could make a open source autocad program, with more function's for sure !!
We only have to add some student's for help coding the program.

Or a program like facebook or watsapp. Or a improvement of youtube called mytube...
Or something else. Can be almost everything.. A global window's 7 update destroyer looks funny to make, but it's not legal to write program's with this purpose this day's. It's only legal if you carry the name America and write some Stuxnet code that involves innocent pc's worldwide. Then it's legal...

In the store i can only buy a new pc with a American Window's Licence. It's to crazy to be true.
This must change soon. It's not a fair trade...

The last time we did a software stress test. Now this one. What is left?
Attachments:
Last edit: 02 Aug 2019 18:26 by Grotius.
The following user(s) said Thank You: phillc54, tommylight, rodw

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

More
03 Aug 2019 18:30 - 03 Aug 2019 19:34 #141282 by Grotius
Replied by Grotius on topic QT C++ code samples
Hi,

We got the contour offset algoritme working now for multiple product's at the moment. Still only line-line intersection.
We got a inside and a outside offset. The logic about this i have to integrate coming time. The only logic about this at the moment is that it depends on the contour direction.

The next step is to add a line-arc intersection offset to the closed contour.

Today was quite a difficult piece of code to understand. Next time i will make a code template with only a debug output first.
This will display's the correct output first in text form.

After the correct text output flow is approved, we can implement the function's to it. This will make the coding much easyer.
Sometimes you get blind with so many trees in the forest.

DxfDecoder output :


Most of the code that i did today is attached as a picture. In Qt it looks nicer !

Mention that display a text output or a value to a terminal (console) in C++ is much easyer then in C.
This saves you so much time.. C++ is much more automated then C.
Attachments:
Last edit: 03 Aug 2019 19:34 by Grotius.
The following user(s) said Thank You: sivaraj, phillc54, tommylight

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

More
05 Aug 2019 15:13 #141427 by Grotius
Replied by Grotius on topic QT C++ code samples
Hi,

Today we added more offset intersections.
Now we have :

-line to line intersection
-arc to line intersection
-line to arc intersection
-arc to arc intersection



Okey this is nice !!

It's almost time to upgrade the swapping class for swap contours from cw to ccw and visa versa.
Attachments:
The following user(s) said Thank You: tommylight

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

More
06 Aug 2019 22:56 - 07 Aug 2019 00:46 #141550 by Grotius
Replied by Grotius on topic QT C++ code samples
Hi,

We have a little update.

The idea is to adapt standard cad function's, like drawing a line, circle, etc to the program.
So we added the draw line function today.

- It has an F8 keyboard button for "ortho on" and "ortho off" toggle, to draw a vertical or horizontal line without gambling.
- The line follow's you mouse while drawing the second point.... Wow...
- At the mouse pointer you see how long the line is. In the below screen you see the global mouse position, this is nice !!
- We did not a draftsight decompile... Haha... We did not steal the source code... Haha. It was much easyer. We write the source code our own. We write code with much more power. Linux Power !!

Added a terminal command window below to enter your line lenght or wathever the message box is asking you...
We must get rid of empty window space, just like draftsight. The command line in draftsight fill's the entire screen from left to right.
Hopefully we will make a difference in all kind of detail's and add magic function's.



Why do i do this?

Drafsight has another update to migrate from 2018 to 2019. For window's the program is not free anymore.

How about next year, will draftsight be free for linux? We will not wait untill it's unplugged by Autodesk.

Just provide a open source cad program. It's not so hard to write some text in C++.

See the list of cad program's
partsolutions.com/60-years-of-cad-infogr...y-of-cad-since-1957/

My goal is : the next one on the list will last for 1000 years and is free for everyone. Okey we have freecad etc. Maybe that software will be on the list..

Let's compile for linux, window's, mac and for everyone that want a free cad program without staying with a update licence
a 200 dollars a year.

The name PRONTO CAD 2019 is a good name.... Or maybe OGCC, "Open Grotius Cad Cam" ....
Drafsight is written in QT C++. .. Haha we write with the same development package, we as inventor's, professor's, linux guru's
we have much more practical experience in writing function's up to complex algoritme's.

The idea of CAD has grown from simple 2D designs into complex, multi-layered 3D structures with kinematic-movement and detailed meta-data
Ai ai... Kinematic movement's, we can try to add tomorrow... Meta data is crap.
Attachments:
Last edit: 07 Aug 2019 00:46 by Grotius.
The following user(s) said Thank You: phillc54, tommylight, Clive S

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

More
07 Aug 2019 20:23 #141631 by Grotius
Replied by Grotius on topic QT C++ code samples
Thank you phillc54, tommylight, Clive s,

Today we added the function draw a 2 point and a 3 point circle. While drawing, update the circle off course.
I mentioned freecad has no 3p circle. In draftsight you have to enter it in the command line wile drawing a 2p circle.

The C++ code for calculating a 3p circle is attached. Maybe freecad can use this code also.



Warning: Spoiler!


Okey this works nice. Next item to draw is a 3 point arc... This is in fact a 3p circle, but with start_angle and end_angle, combined
with xy_start and xy_end coordinates to make it a succesful story. Keep up the good work !
Attachments:
The following user(s) said Thank You: tommylight

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

More
07 Aug 2019 20:57 #141633 by tommylight
Replied by tommylight on topic QT C++ code samples
You have become a "one man software development team " !
Respect, you have earned it.
The following user(s) said Thank You: Grotius

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

More
07 Aug 2019 22:12 #141636 by Clive S
Replied by Clive S on topic QT C++ code samples
Yes Grotius. I don't understand that much are what you are doing but I do understand the amount of work that is going into this project and the effort you have put in.:) I follow along the best I can.
The following user(s) said Thank You: Grotius

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

More
07 Aug 2019 23:16 #141637 by Grotius
Replied by Grotius on topic QT C++ code samples
Hi Clive and Tommy,

Thank you for your kind words!!
It's nice to hear some feedback!! It give's power...

For cad there are so much new function's to integrate, like a button for drawing a inline circle inside a 3 point triangle.
Wich is difficult to draw your own, unless you make some help lines first. B) Or draw a inline circle inside a contour automaticly.



The more we get involved into this project, the more new solution's we see.
We don't have a time limit.

Some of the code templates are worth more then real diamonts. B)
Attachments:
The following user(s) said Thank You: phillc54, tommylight, Clive S

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

More
09 Aug 2019 23:12 - 10 Aug 2019 01:10 #141820 by Grotius
Replied by Grotius on topic QT C++ code samples
Hi phillc54, tommylight & Clive s,

You are perfect !! Wow. The idea we have a strong community with soul member's.. The open source facility... The interest... The time we invest to make thing better for next generation's.. Wow. We can write history if we go on this way for sure !!

Elon Musk is clear about open source. Everything will be open source within a certain time. Think about where to buy a linux pc or laptop. The trade is not fair at this moment. Every laptop has windows 10 for 150 euro's. I don't need window's ......
Maybe with the next auto window's update, we let the customer choose the system.. let the customer choose : free or non free. ;)
So maybe i tell some authority about trade mistake's that are going on. Customer can deside what he want's on the pc, that is fare trade. Let window's go a few step's down's please...

Today we added the polygon function to the cad interface. Yesterday the arc function was ready. The arc source code has exact the same features as autodesk and some improvements related to drawing arc's.. perfect done !!
A screenshot of several cad functions :

- lines ( ortho on or off (F8 toggle) )
- linestrip ( ortho on or off (F8 toggle) )
- arc's ( very clever function for cw and ccw arc's )
- rectangular
- polygon ( give up the sides in terminal, it's react's on even and odd polygon's, output is very good !! )

It looks like a Egyptian hyroglypics text, isn't it... ;)



Now we started coding the ellipse function. This is a nice exotic function to integrate, it's a little special in this case.
We don't want a conventional ellipse (one liner). We can use a ellipse on a cnc when it's build up from multiple arc's. So in that case we must make a ellipse C++ template algortime. Nice !!

The cad template to draw the ellipse is in fact the source code for the C++ template algoritme.
If we follow the steps of drawing the ellipse in cad, we can write the C++ code the same way, so in fact drawing something has the same logic as coding something...
The most difficult part is debugging the step's. ( debugging is in fact : every step you make, check this step in output if it's correct. )

Okey how to define a ellipse in Cad :


So there was a youtube video about this how to draw (define) a ellipse yourself.
I started coding the ellipse. Within 2 day's it's ready.

Did you realise a kwart 1/4 ellipse can be a perfect chamfer option for 2 lines instead of a segment of a circle or a arc....
An ellipse with the same base and height is a full circle. But it has some improvement's that i did not realise until i start working
with this exotic piece of mathematical workspace.
The ellipse chamfer function, wich does not extist chamfers with material reduction in a natural perfect way. Given a perfect
end shape output. We will show and start that option soon. The ellipse chamfer solution is a nice one for the pocket !!!

Autodesk can not do this, because they use ellipse one liner's...
40 years of autodesk coding, where is the logic? Maybe they can dot it. but have no good coders....

Polygon C++ source code :
Mention... The open gl is no display management sytem...
Everything you have to code yourself... Make your coding stratagy.. That's what top coder's have to say about opengl.

Warning: Spoiler!


For fun i think about integrating :


In Math's i suspect there is a gab in the Pi value... Can a Pi value be updated? In Radian's it has no unexpected values... but it also in radians we have PI.. or M_PI for C++.. Fuck !! How to get rid of PI and solve the problem...

For example,
if you calculate 4 arc's as ellipse that imagine a full circle in double. (defined as about 16 digit's... (2x accuray of float))
What is the difference when calculating the same as one liner circle with given : M_PI...
Never seen any comparishment's about this....

We will calculate the difference of PI some how in combination of a 4-arc's circle to a one liner circle.
And i think the 4 -arc's are more clever in output before i start the calculation. Why??
It can be a output of ^4 more PI accuracy for example.
Attachments:
Last edit: 10 Aug 2019 01:10 by Grotius.
The following user(s) said Thank You: phillc54, opw, tommylight

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

Time to create page: 0.450 seconds
Powered by Kunena Forum