Draw a Car

Community contributed macros

Moderators: yajra1219, Jayem, kitty_webb, Ywsp, joanCruz03, shela

Post Reply
Jayem
Posts: 36
Joined: Wed Sep 26, 2018 8:46 am

Draw a Car

Post by Jayem » Tue Oct 02, 2018 10:51 am

Code: Select all

'     car body /////

line(30,220,-610,220)
Circle (230, 220), 200, 200, -180,  0, -180
line(1300,220,430,220)
circle(1500,220), 200, 200, -180, 0, -180
line(1700,220,2090,220)
line(2090,220,2090,530)
line(2090,530,1500,640)
line(1500,640,1066,918)
line(1066,918,92,918)
line(92,918,-300,660)
line(-300,660,-610,520)
line(-610,520,-610,220)

'     car window /////

line(578,830,578,600)
line(578,830,200,830)
line(200,830,-32,602)
line(-32,600,578,600)

line(639,600,639,830)
line(1054,830,639,830)
line(1054,830,1415,600)
line(1415,600,639,600)

'     car wheels /////

circle(230,220,160,160)
circle(1500,220,160,160)

owen
Site Admin
Posts: 657
Joined: Thu Apr 13, 2017 12:14 pm

Re: Draw a Car

Post by owen » Tue Oct 02, 2018 4:14 pm

Good job JM
Can you give the wheels some lug nuts?

By the way the syntax you are using for the Circle is incorrect.

hint: all you need is CIRCLE (x,y), R
hint: x and y are the values of the circle's center point
hint: R is the value for the Radius of the circle
hint: because you are only drawing a Circle and not an Ellipse then the remaining parameters are not needed.

For example your last two circles (the wheels), you put:
circle(230,220,160,160)
circle(1500,220,160,160)
and the correct way is like this:
circle(230,220),160
circle(1500,220),160

Here is the correct syntax for the Circle command which can be found in the User's Guide: http://fbcadcam.com/fbcadcam_users_guide.html
CIRCLE (x,y), R, r, aS, aE, rot
programmatically create circles, arcs, ellipses, elliptical arcs in the drawing
using variable_name_or_value for:
x1,y1 - circle center
R - radius (or major radius of an ellipse)
r - minor radius of an ellipse
aS - arc start (in degrees)
aE - arc end (in degrees)
rot - rotation of ellipse

The syntax usage I designed for the fbcadcam macro interpreter is Not Exactly the same as FreeBasic's syntax.
for example the freebasic syntax of a circle looks like this:
Circle [target,] [STEP] (x,y), radius[, [color][, [start][, [end][, [aspect][, F]]]]]
which can be found on their documentation: https://www.freebasic.net/wiki/wikka.ph ... eyPgCircle

One thing you can notice about fbcadcam's macro Circle syntax is that I include an extra parameter call ROT
rot - rotation of ellipse
Also another thing you can notice is that I did not include COLOR and that is because Cad programs are not about color.
Cad programs are about Layers. Although it is common for Cad programs to use different colors to represent Layers.
It's done this way so that the users of the cad software can see a visible (noticeable difference) between Layers.

Post Reply