FB CAD by Owen Reese
A cad program developed by freeBASIC programmers written in freeBASIC for the pupose of :
1. Learning how to code in freeBASIC
2. Creating a free basic cad program for all to use (freely)
3. Learning and understanding math
4. Inspiring Creativity.
Pressing Esc to end the program saves the drawing in file called "drawing.dxf" if you choose "Y" for yes.
Screen Layout:
The left side is used for drawing information, buttons and line color/layer selection. The right side is used for the drawing area.
Functionality:
While moving the mouse in the drawing area the x y coordinate of the mouse are shown on the left.
While drawing a line the line's length, angle and x2,y2 are shown on the left.
To draw a line:
Left click in the drawing area and move the mouse. The new line's x1,y1 is defined by the initial mousex,y position.
The line's x2,y2 follows the mouse(x,y). By left clicking a second time a new line is created and stored in an array.
By default a second line is beginning drawn in which it's x1,y1 was that of the x2,y2 of the previous line.
Either continue to draw lines by moving the mouse about and left clicking to define the beging and ending points of lines or ESC out of the line drawing mode by pressing the Escape key one time.
While drawing lines there are several options available by pressing keys:
Some of these options are available by using the buttons on the left.
"O" - Ortho mode: Draw vertical or horizontal lines by pressing "O". This turns ortho mode "ON" or "OFF"
"S" - Snap to the end point of another line. By positioning the mouse near the end point of another line and pressing "S" either the lines beginning or ending point will be set to that of the highlighted point.
"M" - Snap to the mid point of another line. By positioning the mouse over an existing line and pressing "M" either the lines beginning or ending point will be set the that of the highlighted line.
"L" - Set the length of a line as you are drawing it to:
A specified length - Enter the length an press return or set the length to that of another line's length by first having positioned the mouse over another line prior to pressing "L". Note: the angle of the line is determined either by the current angle or the set angle (setting the angle of a line is done by pressing "A").
"A" or "a"
"a" - Set the angle of a line by first starting a new line then press "a" and either:
Enter the angle such as 33 and press enter or use @33 to set the angle relative to that of the last selected angle. (by default the last selected angle is that of the last line drawn. Otherwise, the selected angle is set by highlighting another line prior to pressing "a")
"A" - Use "A" to set the angle relative the last line drawn - No need to enter the @.
"X" or "Y"
As a line is being drawn, it's end point is restricted to either x or y of the last selected lines x1,y1 or x2,y2 depending of which end point was highlighted.
To select objects in the drawing area for the purpose of deleting them or moving, copying, rotating, flipping etc... you have two options:
To select objects turn off all of the top buttons L,C,A,E (line, circle, arc, ellipse)
1st option is to position the mouse over an object and either press "g" or left click
2nd option is to box select one or more objects by left clicking once, release, move the mouse, drawing a box around the objects, and clicking a second time to sellect all items in the box.
Last edited by owen on Mar 06, 2007 5:59, edited 2 times in total.
added maddogs requirement to dim mouse params
ps. i was able to import drawing.dxf into autocad2k - i was kinda using ac2k to verify my math was correct.
Last edited by owen on Feb 16, 2007 18:17, edited 1 time in total.
sample dxf file - save as drawing.dxf
oops - for some reason the text gets modified in the code block so I commented it all. When you copy this text you'll need to uncomment it and then save as drawing.dxf
These routines are called by pressing "X" or "Y" while drawing a line at a spcified angle. For example: Their purpose is to allow a line to be drawn at 45 degrees and setting the end point (x2 / y2 ) to that of another line's x value while maintaing the specified angle of 45 degrees.
Last edited by owen on Feb 16, 2007 18:20, edited 1 time in total.
So far it can only draw lines, ie. no circles yet.
I added some buttons to click on in order to change the snap to settings. Snapping to the end points of lines is still available by pressing "S" on the keyboard, or "M" to snap to mid points, etc...