FB CAD

User projects written in or related to FreeBASIC.
Post Reply
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

http://fbcadcam.org/beta
To run and test my latest fbcadcam/gtk beta implementation, I have prepared a zip file (a minimal package)

fbcadcam_(date-time-stamp).zip
Unzip and run fbcadcam_.....exe

This zip file contains the latest beta version (executable and source code) along with files for fbcadcam in folders (fonts, icons, pics) and what I figure to be the minimal number of GTK files needed to run fbcadcam as it is currently. These 23 (.dll) gtk files are from gtk+-bundle_3.8.2-20130704_win32-RC1.zip (note: I still use winxp and haven't tested on other OS. Please let me know if it works on your OS)

The gtk+ bundle, my source code and compiled binaries are also available @ http://fbcadcam.org/gtk3/source_code/myfbgfx-gtk/

To help with the development of fbcadcam just copy the source code into the bin folder ie. c:/gtk3/bin/my_program.bas and then compile with fbc.
I will support hosting of any fbcadcam forks @ fbcadcam.org
Last edited by owen on Mar 05, 2017 17:09, edited 1 time in total.
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

https://youtu.be/-rFNL2LVE-4
FBCadCam version 0.1-33 with GTK imptlimentation version 0.69
An example of creating and editing blocks.
The program crashes when trying to edit the block a second time as you can see at the end of the video.
St_W
Posts: 1619
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: FB CAD

Post by St_W »

Which source code file is the latest one? Your file numbering approach is quite confusing IMHO. What about using GIT (Github) or any other VCS?
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

FB CAD version history
FB CAD versions # 1 - 3 From 02/2007 to 06/2007
FB CAD version # 4 Jun 02, 2008 23:30
FB CAD version # 5 & 6 From 06/2007 to 07/2007
FB CAD version # 7 Jul 22, 2008 14:57
FB CAD version # 8 Aug 23, 2008 8:20
FB CAD version # 9 Sep 01, 2008 8:29
FB CAD version # 10 Sep 03, 2008 19:28
FB CAD version # 11 Sep 16, 2008 10:11
FB CAD version # 12 Nov 04, 2008 9:52
FB CAD version # 13 May 02, 2009 8:43
FB CAD version # 14 May 13, 2010 19:08
FB CAD version # 15 May 27, 2010 14:42
FB CAD version #16 From 06/2010 to 08/2010
FB CAD version # 16.4.7 Aug 08, 2010 12:12
FF FB CAD version # 1 to 1.5 08/2010
FB2dCADCAM version #1.0 to 1.33.31 From 08/2010 to 2013
FB2dCADCAM version #1.33.32 From 2013 to 2016
FBCADCAM (aka myfbgfx-gtk) versions #1 to 70 From 11/2016 to 02/2017
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

Fbcadcam - MACRO
Is a FreeBasic interpreter for fbcadcam
created 09/2016 to 10/2016
original files are @ http://fbcadcam.org/fbcadcam-macro/
It is only a partial interpreter, meaning it does not interpret all FreeBasic commands
and the syntax is restrictive to classical style coding, meaning it does not recognize OOP.
Example code it will interpret:
Dim i as integer
for i = 1 to 10
print i
next
Even though Fbcadcam - MACRO was created for fbcadcam, it may
serve to be a general Freebasic interpreter for your Freebasic projects.
Some say the interpreter is or should be written using tokens instead of
line by line interpretation, but I wasn't able to grasp the token concept at the
time I wrote it.

Now that I've incorporated fbcadcam-macro into FBCADCAM (aka myfbgfx-gtk),
all continued development of fbcadcam-macro will be made in the latest version of FBCADCAM (aka myfbgfx-gtk)
which is available for download from http://fbcadcam.org/beta in a zip file.
Source code updates remain @ http://fbcadcam.org/gtk3

To test fbcadcam-macro in fbcadcam...
Click the MACRO button located in fbcadcam toolbar.Image

A simple (very basic editor) is available to use with buttons at the bottom to save and run the macro.
Note: You can write your macros using your favorite editor (I use FBEdit) and copy/paste/run or open/run with fbcadcam-macro editor.
Image
Here is an example macro that create a line, circle, arc, ellipse and elliptical arc in fbcadcam's drawing area, which once created via the macro, \
can be further modified using fbcadcams tools, just as if the lines and circles were drawn originally using fbcacam's drawing tools.

Code: Select all

'line(0,0)-(400,300)

'circle (x,y),major_radius,minor_radius,arc_start_degrees,arc_end_degrees,rotation_degrees

"CIRCLE
circle(250,250),50

'ARC
circle(250,250),70,,15,185

'ELLIPSE
circle(250,250),120,80,,,35

'ELLIPTICAL ARC
circle(250,250),200,140,30,300,55

And here is another example that tests fbcadcam macro's ability to interpret code with sub routines, for next routines, do while loop routines, select case routines, and arrays.

Code: Select all

Declare Function dtor(degrees As Double) As Double
Declare Sub draw_line_at_angle(x1 As Double, y1 As Double, angle As Double, length As Double)

Dim As Integer i,j,k,c
Dim Shared As Double pi,cx,cy

pi = 4 * Atn(1)

for i = 0 to 360 step 30
	draw_line_at_angle(200,200,i,100)
	circle(cx,cy),20
next

Function dtor(degrees As Double) As Double
	Dim As Double radians
	radians=degrees*pi/180
	Return radians
End Function

Sub draw_line_at_angle(x1 As Double, y1 As Double, angle As Double, length As Double)
	Dim As Double x2,y2
	'x2=x1+Cos(angle*pi/180)*length
	'y2=y1+Sin(angle*pi/180)*length
	x2=x1+Cos(dtor(angle))*length
	y2=y1+Sin(dtor(angle))*length
	Line(x1,y1)-(x2,y2)
	cx=x2
	cy=y2
End Sub

datwill310
Posts: 355
Joined: May 29, 2015 20:37

Re: FB CAD

Post by datwill310 »

Looks amazing! I'll have a look next time I get a chance!
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

fbcadcam-macro now suports variable types:
"BOOLEAN","BYTE","UBYTE","SHORT","USHORT","LONG","ULONG","INTEGER","UINTEGER","LONGINT","ULONGINT","SINGLE","DOUBLE"
and up to three - 1d to 3d arrays of them.
latest beta version (fbcadcam_2017_03_13) uploaded
http://fbcadcam.org/beta
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

Errors were found in fbcadcam-macro while trying to run the rectangle in rectangle macro below. Errors corrected and new beta version is available for your review.
latest beta version (fbcadcam_2017_03_22) uploaded to http://fbcadcam.org/beta

Code: Select all


Dim As Double pi
Dim As Double rad

Dim As Double x,y

Dim As Double r1h,r1w,r1x1,r1y1,r1x2,r1y2,r1x3,r1y3,r1x4,r1y4,r1cx,r1cy
Dim As Double r2h,r2w,r2x1,r2y1,r2x2,r2y2,r2x3,r2y3,r2x4,r2y4
Dim As Double angle,difangle

Dim As Double ba

pi = 4 * Atn(1)
rad=pi/180

r1h=400
r1w=600
r1x1=0
r1y1=r1h
r1x2=r1w
r1y2=r1h
r1x3=r1w
r1y3=0
r1x4=0
r1y4=0
r1cx=r1w/2
r1cy=r1h/2

r2h=250
r2x2=r1x2
r2y2=r1h
angle=atan2((r2h/2),Sqr((r1h/2)^2 + (r1w/2)^2 - (r2h/2)^2)) / rad
difangle=atan2((r1h/2),(r1w/2))/rad - angle
angle=360-angle+difangle
x=r1cx+cos(angle*rad)*sqr((r1h/2)^2 + (r1w/2)^2)

Do While x-r1x2 > .0001
	r2x2=r2x2-(x-r1x2)
	angle=atan2((r2h/2),Sqr((r1h/2)^2 + (r2x2-r1cx)^2 - (r2h/2)^2)) / rad
	difangle=atan2((r1h/2),(r2x2-r1cx))/rad - angle
	angle=360-angle+difangle
	x=r1cx+cos(angle*rad)*sqr((r1h/2)^2 + (r2x2-r1cx)^2)
loop
y=r1cy+sin(angle*rad)*sqr((r1h/2)^2 + (r2x2-r1cx)^2)
r2x1=0
r2y1=r1h-y
r2x3=r1w
r2y3=y
r2x4=r1w-r2x2
r2y4=0

r2w=Sqr((r2x2-r2x1)^2 + (r2y2-r2y1)^2)
Print r2w

Line(r1x1,r1y1)-(r1x2,r1y2)
Line(r1x2,r1y2)-(r1x3,r1y3)
Line(r1x3,r1y3)-(r1x4,r1y4)
Line(r1x4,r1y4)-(r1x1,r1y1)

Line(r2x1,r2y1)-(r2x2,r2y2)
Line(r2x2,r2y2)-(r2x3,r2y3)
Line(r2x3,r2y3)-(r2x4,r2y4)
Line(r2x4,r2y4)-(r2x1,r2y1)

owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

added code in fbcadcam-macro to support more variable arrays...
fbcadcam-macro now suports up to nine - 1d to 3d arrays of variable types:
"BOOLEAN","BYTE","UBYTE","SHORT","USHORT","LONG","ULONG","INTEGER","UINTEGER","LONGINT","ULONGINT","SINGLE","DOUBLE"

latest beta version (fbcadcam_2017_03_30) uploaded
http://fbcadcam.org/beta
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

added new commands:
copy, rotate, flip horizontal, flip vertical, flip both, copy rotate, copy flip horizontal, copy flip vertical, copy flip both.

these commands apply to selected objects in the drawing.
for example:
draw a line and then select it.
then run the following macro:
dim i as integer
for i = 15 to 345 step 15
copy rotate (290,290),i
next

note: i have not coded any error handling in fbcadcam-macro (interpreter) so the program may crash if you do something like misspell INTERGER
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

This month I will be focusing on the web site and documentation for this project.
http://fbcadcam.com
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

FbCadCam User's Guide is online @ fbcadcam.com
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: FB CAD

Post by D.J.Peters »

@owen I'm sure you won't change to FLTK-C anymore
but with FLTK-C (and it's vector 2D engine) your FBCAD would run on all version's of Windows (32/64-bit)
and most Linux Ubuntu, Slackware, ARCH, Pupy. Slax ... and ARM Beaglebone Black and all the cute tiny Raspberry Pi's.

How ever good job so far I can see.

Joshy
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: FB CAD

Post by owen »

I would be happy to try as a separate fork.
Post Reply