Close
0%
0%

Space Colonisation

No, not space exploration. Its a method of filling an area with a pattern.
A remix of Charlie Williams' "Laser etched book edges".

Similar projects worth following
Charlie Williams (https://hackaday.io/project/158718-laser-etched-book-edges) presented a version of this code in his project. This project is a remix of his project. The orginal source code was by Algirdas Rascius (https://www.openprocessing.org/user/1133). The idea is to engrave the blank faces of laser-cut projects with nice patterns.

Port the Source Code to C

Rascius's code is in Java/Processing and needs to port it to C. For graphics I use he xbgi library (an X11 port of the Borland Graphics Interface from the days of DOS).

Rascius's code is a bit messy and not very efficient. My code is a bit better but more could be done. Still it good enough for this purpose.

I have uploaded a version to the library.

Next

I want to:

  1. import arbitary cutout shapes (dxf).
  2. export dxf and/or gCode.
  3. consider warping the pattern to better fit cutouts.

Colonisation.dxf

An example of the dxf code.

AutoCAD DXF - 249.76 kB - 06/07/2018 at 13:40

Download

colonisation2dxf.c

Export DXF code as well.

x-csrc - 11.51 kB - 06/07/2018 at 13:39

Download

dxf.c

My dxf line (segment) code

x-csrc - 3.56 kB - 06/07/2018 at 10:37

Download

dxf14.pdf

In case you need to find out something (best of luck)

Adobe Portable Document Format - 1.52 MB - 06/07/2018 at 10:35

Preview
Download

test.dxf

A polyline test

AutoCAD DXF - 21.98 kB - 06/07/2018 at 10:35

Download

View all 11 files

  • DXF Export Code

    agp.cooper06/07/2018 at 10:58 0 comments

    DXF Export Code

    Writing DXF code is a real pain. The reference manual is complex. Also old code usually does not work with later versions of Autocad.

    Not too hard to write line or segment code (there is an example in the back of the reference manual) but polyline code was a real headache. Made worse that my CAD package reads in polylines as lines/segments and not as polylines, as it uses LWPolyline internally. Took me ages to accept that the code was likely correct.

    I have written 3D code but reverting back to 2D is easy enough.

    But really I should have written a gCode export and skipped DXF export.

    There is some C code for DXF import (just a skeleton) in the back of the reference manual so that should not be too bad.

    I can use segments for the Colonisation algorithm cut-out and out-line boundaries but that requires quite a bit of code to reconstruct the orginal polyline. It not that easy to reconnect the segments, I know as I have had to sovle this problem before.

    Determining if a grid point is inside or outside a polyline is not too hard, however.

    gCode Export

    I think I should rework the Colonisation code to export gCode directly. Internally, the Colonisation algorithm will need some work (I think) else I will likely need to reoptimise the segment order (think of the Travelling Salesman problem).

    DXF Line/Segment Code added to Colonisation Algorithm

    I could not add the DXF Polyline code without a major rework of the Colonisation algorithm. So I will have to convert to Polylines later. The results are quite good:

    Still an issue with some missed grid locations but much improved from my first iteration.

    DXF is a Headache

    DXF is a headache. Delta-Cad is happy with Circle and Line but not Polyline (it loads as segments). Cut2D is happy with Polyline but not Circle or Line. When I look inside the other dxf files they are using  AcDb* etc. What is that?

    Okay, I found a paper with a simple dxf file with AcDb* entities. Entities have handles but what are the rules? Anyway, Delta-Cad will load the file, even with LWPolyline it still thinks they are segments (even when I set the closed polyline flag). Cut2D will not touch them.

    I think I am going backwards!

    I actually think I would be better off using some other format or even directly to gCode.

    AlanX

View project log

Enjoy this project?

Share

Discussions

agp.cooper wrote 06/06/2018 at 05:28 point

That is the basic idea.
Western culture seems to favour "white goods", we seem to lack any concept of extra-presentation even if it costs almost nothing. When was the last time you saw a "Greek Key"? Have you ever seen a greek key on a recent public structure or even a footpath/sidewalk?
I was in Japan last year and even the display panel of the vending machines "played games" when not in use. A sense of humour still is allowed to exist there!
Anyway, if you have seen a computer generated pattern that seems to mould around a shape I would be interested to look at it.
AlanX

  Are you sure? yes | no

Jarrett wrote 06/05/2018 at 16:42 point

This would be pretty good to load in a PCB, and then pizzazz up all the empty space

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates