[chbot] Draw algorithm
Andrew Errington
a.errington at lancaster.ac.uk
Tue May 17 10:28:29 BST 2011
On Tue, 17 May 2011 05:37:04 Marshland Engineering wrote:
> Hi all
>
> I'm a bit stumped with this one. I can't seem to work out the algorithm I
> need.
>
> I need to draw a picture of a bit of computer code.
>
> The verbal description is
>
> 1 Drill a hole
> 2 Repeat step1 5 times, each time adding 5 mm going the left
> 3 Repeat 1 and 2 2 times, each time add 5 mm going up.
> Now you should have 18 holes.
> 4 Repeat 1 to 3 2 times, each time adding 100 mm to the left
> 5 Repeat 1 to 4 1 times, each time adding 200 mm to the top.
>
> If I have my sums correct, that is 6 sets of 18 holes.
>
> Any suggestions ?
Is this for controlling a CNC machine? Take a look at G-Code. You can find
tools to write G-Code, but I think something like this could be coded by
hand. Next, you should be able to find a G-Code viewer, which will draw the
results of the G-Code program on screen.
This guy http://softsolder.com/ uses G-Code a lot and puts code snippets on
his web page.
Alternatively there's OpenSCAD http://www.openscad.org/ which is a 3D
programming tool. Type in your program and get a 3D rendered drawing.
Unless I misunderstood your requirements entirely.
Andrew
More information about the Chchrobotics
mailing list