Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I create 2D graphics in C# using the Microsoft Graphics Class (System.Drawing) that consist entirely of straight lines and circular arcs. These graphics represent the path that a machine tool (e.g., a laser machine) travels when cutting out a part.

Until now, these graphics have been purely static, i.e., the entire contour is completely rendered in a single operation.

I would now like to show how the contour builds up in time, i.e., you should see how the machine moves (with adjustable speed).

If I see this correctly, there are no suitable functions for this in the Microsoft libraries.

What software could be used for such a task?

What I have tried:

I took a look at Unity. But this package seems to be oversized for my requirements.
Posted
Updated 14-Sep-23 8:22am
v5
Comments
Rick York 19-Aug-23 21:09pm    
Have you tried searching for animation? https://www.codeproject.com/search.aspx?q=animation&x=7&y=1&sbo=kw
Ralf Meier 21-Aug-23 4:29am    
could you give an example how the moving-path of your machine-part looks like ?
I think there is a way with customized controls and using more parts of the graphics-unit - but for this I need more infomation ...
Member 13566383 21-Aug-23 5:32am    
I have got a screenshot of a typical path but I don't know how to upload it.
Member 13566383 21-Aug-23 10:20am    
Here is a link to the screenshot:
https://www.file-upload.net/download-15180065/Screenshot2023-08-21112041.png.html

Quote:
I would now like to show how the contour builds up in time, i.e. you should see how the machine moves (with adjustable speed).

More or less, you want to render your drawing in slow motion.
Your needs look rather specialized, this imply a lot research to find a readily library for your needs.

Or you can create your own library.
- you need to master the mathematics of scaling in size and in time.
- You need to recreate tools for the drawing 1 pixel at the time.
- You need to master the usage of timer draw each steps in a timely fashion.
- You may also want to simulate the move of the laser head between cuts.
- You may also want to show the laser head with a sprite.

A lot of work, but a nice learning curve too.
 
Share this answer
 
Comments
Member 13566383 20-Aug-23 4:17am    
Math is no problem.
At least for now, I have no intention of visualizing or simulating a machine tool like a sophisticated CAD system. Currently, I am only interested in the path of the tool in 2D applications.
But who knows. The appetite comes with the meal.
I think single pixel drawing without antialiasing is not a suitable solution.
There is no simple solution.

WPF has a great 2D and 3D rendering engine that can use Direct X and supports animation. This will be a new system to learn as it is very different to WinForms.

Examples, from here on CodeProject:
* Beginner's WPF Animation Tutorial[^]
* Advanced Animations in WPF[^]
* WPF 3D Primer[^]
* WPF: A 3D screensaver written in WPF[^]

If you do some research via Google, you can find many examples for WPF.
 
Share this answer
 
Comments
Member 13566383 20-Aug-23 4:05am    
Yes I already have seen that WPF may have a solution for my problem. Looks like a completely new world to me, where learning how to draw a line or circle in slow motion will be the smallest problem to be mastered.
Graeme_Grant 20-Aug-23 6:24am    
there are tonnes of articles out there on WPF around animation, 2D & 3D rendering. Work each part and you should get there.
You're not going to find anything that renders this for you in the .NET Framework or .NET.

You're basically talking about rendering an animation, frame-by-frame, over time. You can render the first part of the path, increment the path taken by the tool over the next, say, 0.1 seconds, then draw everything up to that point, and repeat until the end of the path is reached.

If you find a library to do this for you, great, but don't get your hopes up. What you're talking about is a very vertical, niche market, so the chances of finding a library are going to be small.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900