Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing a CAD - drawings to CNC machine code software. These CNC's have sort of a Instruction set which receive parameters,etc to do some blah blah job. I am quite comfortable with the CNC side; but am suddenly being asked to make a software which would let you "draw" plus will convert the drawing to the machines code. I am REALLY worried about the "draw" part. Shall i go for OpenGL development? or is there a more simplified way of doing things ? So to summarize, my problem : Creating a mini CAD platform (its all 2D and i dont need to bother with complex shapes apart from lines , some curves) But i have to provide the user with tools to make these "simple drawings"

Please give me technical advice and a head start.

share|improve this question

closed as too broad by rwong, MichaelT, Dan Pichelman, gnat, Bart van Ingen Schenau Sep 5 '14 at 7:35

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

It might be a lot less work to use an existing CAD/drawing program, and just write a converter from some well-documented file format to your CNC machine code. – nikie Jul 5 '11 at 9:26

Not much of questions here. OpenGL is an overkill. It could provide a nice feature for preview of the final work but definitely not necessary for drawing.

Think of this thing as graphical editor of the CNC data. Everything you should be able to do with the CNC should be doable here. Can change spindle RPM? Make it available to be attached to a node. Can change movement speed? Make it available. Start off with this bare set of features - graphical representation of the activity, editable graphically. "Add node, remove node, move node, delete node, set Z axis level, node properties (including special commands like spindle speed )." Use some (any) gfx library to display it all.

Once you have this start adding automating things: bezier curves auto-transformed into series of lines, circles, auto-connect shapes (lift spindle, move at max speed, lower spindle), import Corel/SVG, offset from shape (this one is important - you draw shape you want to obtain, then move the actual route away or inside by cutter tool thickness), optimization for conical tools (a subject for you to think, conical tools allow for extreme amount of flexibility), import of grayscale bitmaps as 3D projects, depth stepping (important - convert one track into multiple tracks at various depths, increasing Z depth with each step), sweep-fill area (to remove bulk amount of material), optimize shape for multiple tools (first rough, then precise) and so on.

(an interesting point is that you may need to implement a "Travelling Salesman" algorithm at certain point: as the rough tool removed most of material, there are many separate isles for the precise tool to "visit", and they can be processed in arbitrary order, so connecting them according to the salesman problem will minimize tool travel time).

share|improve this answer
thanks a lot. would you say it is a good idea to use MFC for the GUI of my tool ?? – ritwik Jul 5 '11 at 12:05
@ritwik: Sorry, no clue for that. I was a (power-) user of such software for quite some time and can give you many advices on functionality/algorithms/CNC tricks you can include but don't expect much from me on the implementation side. – SF. Jul 5 '11 at 12:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.