More tile work from the Aga Khan Museum’s fountain.
svgo is, on the face of it, pretty neat: it takes those huge vector graphic files and squozes them down to something more acceptable. Unfortunately, though, the authors have seen too many files with junk machine-generated <metadata> sections, and decided that it’s all worthless.
Metadata isn’t junk; it’s provenance. Your RDF? Gone. Your diligently researched and carefully crafted Dublin Core entries? Blown away. The licence you agonized over? teh g0ne, man. svgo does this by default. It would be very easy to use this tool to take someone else’s graphic, strip out the ownership information, and claim it as your own. It would be wrong to do that, but the original creator would have to find your rip-off and go to the effort of challenging your use of it. All so much work, all so easily avoided.
You can make svgo do the right thing by calling it this way:
svgo --disable=removeMetadata -i infile.svg -o outfile.svg
Drawing a circle between a centre point and one on the circumference is a common requirement in working up geometric patterns. If you need lines parallel to a radial line, or indeed any line at a fixed distance from another point, you need to draw a circle as a construction guide. the figure below will never be destined for design greatness, but it shows how they could be used:
The turquoise circles define the green parallel lines, and also the smaller green hexagon inside the black one. Drawing circles from a centre is what compasses do, yet Inkscape doesn’t have a tool to do it easily.
There is a way around this, though, that I picked up from this forum post. The poster’s method isn’t very clear, but in very brief summary, you need to construct a 3 point or 2 line-segment polyline with its nodes equidistant from the centre point, then use Render → Draw from Triangle … → Circumcircle to construct the circle. Simple? Um …
Okay, dodgy animation and point by point explanation coming up. With cusp, intersection and centre snapping all enabled:
- Draw two points: one for the centre, one on the circumference
(I usually draw a short diagonal line as the pointand snap to the cusp node, as they are unobtrusive but easy to pick up the rotation centre.)
- Click on the circumference point to select it
- Click on the circumference point again to select the rotation centre and handles
- Move the rotation centre of the point to the centre of your circle
- Duplicate the point (Ctrl+D)
- Rotate the point 90° (Object → Rotate 90° CW)
- Duplicate the new point (Ctrl+D)
- Rotate the new point 90° (Object → Rotate 90° CW)
(You should now have three points arranged around a semicircle)
- Draw two straight line segments through the three points
- Select the line
- Render → Draw from Triangle … → Circumcircle — and there’s your circle.
There’s probably another way to do this by creating a point (Ctrl+click in Line mode) giving it a line width, setting rounded line ends, then doing Path→Stroke to Path to get a buffer around the point, but I can’t work out how to do this reliably.
Oh, and the patten I made from the construction? Well, it might look okay on a paper towel …
You might have noticed that I’ve become a bit obsessed with Arabic/Islamic geometric designs lately. Clues include posts like this, this, also this, and maybe even this. When I refer to Islamic Geometric Design, I’m more talking about the frameworks, repeat units or grids that are the starting point for the intricate and hypnotic abstract designs that have traditionally been used in Islamic architecture for over a thousand years. Here’s an example of the larger patterns in context:
“A close up of [The Tomb of Bibi Jawindi, Uch, Pakistan] by Usman Ghani” by Usman.pg – Licensed under CC BY-SA 3.0 via Wikimedia Commons.
I’ve been following Eric Broug‘s methods of construction that use a ruler and compass exclusively. Not being that great with manual dexterity, I’ve found these much slower to draw than I could on a computer. Consequently, I looked around for a good, free tool that people could use to start making these drawings. Most of the operations (including drawing from one intersection to another, rotating objects around a point, buffering lines into polygons) can be done by CAD packages, but these often have a steep learning curve. CAD packages also don’t tend to have many artistic functions.
Thankfully, the free drawing packing Inkscape has almost all of the features I need. Just one of the features I use quite often (creating a circle from a centre point and a point on the circumference; in other words, emulating a compass) isn’t built in, but can be done with a simple sequence of operations. In this article, I hope to show you some techniques you can build on for making your own patterns.
This is covered well on the Inkscape website, so I won’t repeat it here. It’s important to get the most recent stable version of Inkscape. Some Linux distributions provide a really old version, so make sure you’re using at least version 0.91.
Inkscape runs on Linux, Mac and Windows. On Mac, it’s a little slow and uses some non-(Mac-)standard keyboard shortcuts. You may also have to install XQuartz on your Mac for it to run. It works fine on Windows (I tested 8.1).
Snapping is your friend
You’re going to have to get to know and love the Snapping Toolbar, shown at right. When you enable snapping, the items you draw or modify are locked to the node, intersection, object centre or grid point nearest to your cursor. When snapping is active, you get a little hovering info box showing you what Inkscape thinks you want to snap to:
I’ve enlarged the screen grab so you can make the info box out more clearly.
Snapping allows you to place lines in geometrically precise locations if you work up a drawing from a template or construction lines. All of the templates I made have the most useful snapping modes enabled:
- Snap to Intersection — prefer where lines cross
- Snap to Cusp Node —prefer end points of lines, or local extrema of polygons
- Snap to Object Centre —prefer the centre of objects.
Here’s a simple example of a triangle drawn from construction lines. I couldn’t ever draw a perfect equilateral triangle freehand, but with snapping, it’s four clicks (three vertices, then a final click on the first vertex to close the figure), and it’s done perfectly.
Incidentally, most of the patterns I make use straight lines. In Inkscape, you’ll want to use the Pen tool () with straight lines enabled ().
Moving the Centre of Rotation
When you double-click an object in Inkscape in Select & Transform mode (), you get shown the rotation handles and the all-important Centre of Rotation. By default, the centre of rotation is in the centre of the bounding box of the object; that is, the centre of the smallest horizontal box that encloses the object. Here it’s marked by a small cross:
Let’s say we want to make a six-pointed star from this triangle. You might think that if you duplicated it (keyboard shortcut: Ctrl+D) and flipped it horizontally (keyboard shortcut: h), you’d get your star. Alas, no star for you:
What we wanted to do was to flip the triangle around the centre of rotation of the radial construction lines, and to do that we need to drag the triangle’s centre of rotation over to the centre of the construction lines:
You’ll know when you’ve got it in the right place, as Inkscape’s snapping info box should tell you:
Let’s try that duplication and flipping thing again:
Moving the centre of rotation makes all the difference.
Rotation & Duplication
Now that we can move the centre of rotation, we can use that to build up compound objects:
This interleaved set of strapwork pentagons is made from 10 segments:
Since there are 10 segments, we have to rotate each segment 36° (= 360°/10) to fill up the whole circle. For this, we use the Transform tool’s Rotate tab:
If you’re wanting to avoid doing even division in your artwork, here’s a table for many common values:
|Number of Segments||Rotation / °|
Applying nine duplicate-rotate steps, we get this result:
Stroke to Path
(work in progress …)
Most geometric figures have lines with some thickness to them. Guide lines alone are pretty boring.
You can use Object → Fill & Stroke and set Stroke Style on a path to make it wider, but sometimes you might want to work with the intersections of the edges of these paths. Fortunately, Inkscape makes this relatively easy.
First, give your path the width you want, say 3-5 mm. Then, with the path selected, use Path → Stroke to Path. At first, nothing appears to have happen, but change the Fill to none (the ‘×’ icon) and the Stroke Paint to solid. Suddenly, the path will appear to get really thick, but reduce the Stroke Style: Width down to a fine line, and you’ll end up with the outline of your original path.
I’ve jumped ahead a bit with the illustration, and started to fill in the strapwork. Inkscape will snap to the nodes on the edges of your figure, and you can decorate it any way you wish.
(The Stroke Style: Join and Stroke Style: Cap permanently affect the outline path. You’ll get quite good at using Undo until you get the effects you want. Really pointy shapes will need a custom Stroke Style: Mitre Limit, as graphics programs try to limit really acute intersections, as they can get awkwardly long and trail off the page.)
Other useful techniques
- Separating construction lines from drawing objects by using Layers is very helpful. Once you hide the construction lines, your patterns look much more impressive, as you can’t easily see how it was put together.
- The Select Same command allows you to select objects with the same fill and/or stroke style. I find this useful for selecting objects for grouping, or moving to other layers.
- Clipping objects to basic tile shapes can help to make seamless repeat units for tiling.
- The Clone → Create Tiled Clones … command is immensely powerful for making patterns out of repeat units. It’s also rather hard to use. I hope to add some basic examples later, though it’s hard to get this exactly seamless. This tutorial helps for a limited number of cases.
I’m still happily using a Raspberry Pi 2B as a lightweight desktop machine. It’s not my main computer, but it’s pleasantly capable. Set up with a couple of paged desktops (or virtual desktops, as we used to call ’em), I can get a bunch of things done with it.
One feature that really irked me, though, was the way that window switching worked. Or, for greater clarity, didn’t work. Openbox, the standard window manager in Raspbian, didn’t allow you to switch to windows on another desktop with Alt+Tab. As I have a smallish screen, I typically have very few windows per desktop, so I want that ability to move from task to task.
This, however, can be fixed. In your ~/.config/openbox/lxde-pi-rc.xml file, change the keybinding sections for Alt+Tab and Alt-Shift+Tab to read:
<keybind key="A-Tab"> <action name="NextWindow"> <allDesktops>yes</allDesktops> </action> </keybind> <keybind key="A-S-Tab"> <action name="PreviousWindow"> <allDesktops>yes</allDesktops> </action> </keybind>
Log out, log back in, and Alt+Tab across desktops should Just Work. If you’re not using the default pi user, I suspect you’ll have to edit the ~/.config/openbox/lxde-user-rc.xml file instead.
Credit for this tip: user crunchworksyeay on the CrunchBang Linux Forums.
This has been a Memo To Myself™ production.
I bought a CD-ROM, The World of Patterns. It’s supposed to work on ‘Any computer with an Internet browser and a CD-ROM drive’. Guess I don’t just have any computer, then …
The disk — an interesting mathematical/artistic study of patterns — is arranged as a tree of HTML files, with internal links and images. This is how the folders appear on my computer:
├── art │ ├── islam │ ├── preislam │ └── pstislam │ ├── latt │ ├── other │ └── quilts │ ├── modern │ │ ├── large │ │ ├── patch3 │ │ └── patch4 │ └── usa ├── info ├── maths
All neatly lower case, as one might expect. Unfortunately, the internal links are hard-coded to access links such as /art/Islam/over.htm, and Linux, being good and literal, can’t find the upper case ones.
Unfortunately, the majority of computers quietly ignore the case of letters on removable media. Linux’s insistence on being correct is at odds with what is generally considered useful. But there’s a way around this. You can give the mount command options to tell it to be more chill about case:
sudo mount -t iso9660 -o loop,check=relaxed,map=normal,norock,nojoliet disk.iso /mnt/scratch/
This works for me quite well:
The CD-ROM is interesting, if a little dated. The author has gone on to produce the website tilingsearch.org, a huge database of historical tile patterns.
These SVG templates are modelled after Eric Broug‘s drawing templates for Islamic Geometric Design pattern elements. Although written for Inkscape, they should be usable with almost any graphics program.
By enabling snapping to nodes and object centres, your drawing program can act like an accurate straight edge and compass for constructing geometric figures.
The files are name N-LL-S.svg, where:
- N — is the root symmetry: 4-fold, 5-fold, 6-fold, etc.
- LL — the total number of lines arranged evenly around the circle. This will always be a multiple of N.
- S — If the total number of lines has another symmetry that is a factor, this is S. If S = 0, then only the root symmetry is marked.
4-12-6.svg— base symmetry 4-fold (square/diamond), with 12 lines or 30° spacing. Hexagonal (6-fold) guidelines are highlighted in a different colour.
5-10-0.svg— base symmetry 5-fold (pentagonal), with 10 lines or 36° spacing. No other guidelines are highlighted.
In Inkscape 0.91:
- units set to mm
- snapping set to cusp nodes, intersections, and object rotation centres
- construction lines on a separate layer (‘construction’) from the active layer (‘drawing’)
- templates are initially sized at 100 x 100 mm
- hair-line (0.1 mm) construction lines
All files, zipped: radial-templates-for-inkscape.zip
Individual files, with SVG linked behind image:
Summary: Buy the paper edition; this book is illegible on Kindle.
The original book features very finely engraved line drawings, with construction lines showing how the patterns are built up. The Kindle edition has only low-resolution scans, so the lines break down into noise and are very hard to follow. You can’t zoom in, either. The figure numbering is entirely absent from the Kindle edition, so you can’t use this book for reference. Some of the page scans are squint and partially cut off, too.
Very disappointed in this purchase. You’re better off with the paper than trying to squint at these smudgy pixels.
(unedited text as simultaneously posted to Amazon)
Basic 10-point star, nothing fancy:
I’d been having no luck getting the SD card working on my Zeta. I got help on the mailing list, and uploaded a new 512KB Flash ROM image (via XMODEM and floppy; teh slow!). So now I have two multi-megabyte drives on my CP/M computer — whee!
Instagram filter used: Earlybird
Here’s the board, fully populated:
I still have to put it in a proper case. A visit to Above All Electronics did result in getting a floppy drive (and most importantly, 3½” 1.44 MB floppies …) and all the cables, so I’ll add that later. But for now, I’ll try to remember how CP/M works …
Please excuse horrible blurry photo, but I think all the soldering is done —
A whole new board I soldered up is the Mini-PPISD. It adds (slow) SD card storage to an SBC board:
Man, but those surface mount SD card pads are a pain. I had to get flux on the PCB pad and the bottom of the SD connector, load a little blob of solder on the iron, then warm up the pad and roll the solder into place. It made a satisfying little Zsht! noise as the flux burnt off, and the molten solder got drawn under the pad by capillary action.
Next up is checking the power and ground continuity, adding the chips, building a null modem (grr; I hate RS232, really) and finding a case. I may already have one, but I may forage at Above All to get a 3½” floppy drive and enclosure. I definitely have an old Turbo/reset button from an XT that would make a great reset breakout.
Just waiting for the full-can oscillator sockets (and most of the chips) to arrive from Mouser. I could have used 14-pin DIP machine pin sockets, as Sergey was thoughtful and had all of the holes drilled.
Most of the big sockets need to be fully soldered, as at the moment they’re just tack-soldered at the corners. Maybe I’ll put on some dronecore and have a meditative time with the Sn-Ag tonight. I’ll be glad to get the flux off the board, though: it’s not my usual stuff (which is Kester #951; no clean ftw), and what I’m using is smoky and a bit gummy. It does make nice bright joints, though, which is never 951’s strong point.
This might be my last post on mini-printers, as I’ve found a driver that just works with CUPS on Raspberry Pi. It also works on Ubuntu on my laptop, and should work (though untried) on Mac OS. You’ll have to build it from source, but it’s not too hard.
The hard part is working out if your thermal printer will work or not. There are many out there, and they’re all slightly different. If they support the ESC/POS bitmap command GS v 0 on 58 mm wide paper, they should work. The ones I’ve tested are:
- Catex POS5890U — USB, cheap, fast.
- “701” control board panel printer — fairly generic, decent quality printer with serial input. A bit slow for daily use at 9600 baud.
- Xiamen Embedded Printer DP-EH600 — as above.
The following should also work, but haven’t been tried:
- Adafruit Mini Thermal Receipt Printer — again, serial, so not super fast.
- Sparkfun thermal printer — which now appears to be identical to the Adafruit unit, and is referred to as the “A1 (or A2) micro panel printer” in the documentation.
Known not to work:
- BTHT-V6 printer — which uses a completely different command set.
If you have a manual for your printer, check it to see if it prints bitmaps by sending a three byte header of 29 118 48 (or 1D 76 30 in hexadecimal). If you’re not sure, try it with a small test image, and be ready by the power switch …
Getting and building the driver
Building it is fairly easy, though it has some package requirements you’ll need to meet. On Raspbian Wheezy, do something like:
sudo apt-get install libcups2-dev libcupsimage2-dev git build-essential
Update, 2015-10: Raspbian now uses the Debian Jessie distribution, but this article was written when Wheezy was current. In the initial 2015-09-24 Raspbian release, a lot of the printing system is not installed. Instead of the line above, you’ll need to run:
sudo apt-get install libcups2-dev libcupsimage2-dev git build-essential cups system-config-printer
This new command may take a long time to run.
Now you can download the driver code:
git clone https://github.com/klirichek/zj-58.git
Building it is straightforward:
cd zj-58/ make
and installing takes all of:
You’ll still have to set up the printer to accept jobs, but now you have the driver installed.
Setting up the printer
This bit is much more graphical. Open up the printer settings window:
The POS5890U shows up as “Unknown” on my USB port, as Linux doesn’t know the name of this device from its USB ID. Your printer might have an known ID, or show up as a serial port. Select the right one, and click Forward:
Most printers expect paper wider than 58 mm, but mini-printers can’t do that. To tell the system about paper sizes, right click on the printer’s icon, and change the printer settings:
You do want to set the media size to at least 58 × 210 mm. This is just the longest strip it will print in one ‘page’; if your print is shorter, it won’t waste extra paper. You can choose longer prints, but not wider. The default assume your local standard paper size which —be it A4, Letter, or whatever — will not be what you want here. Hit OK.
You could print the self test page, but it’s long and boring. If you’re fairly sure your printer will be supported, try this scaled PDF version of the Raspberry Pi Logo: raspberry-pi-logo. Printed and scanned, it came out like this:
Not the best rendition, but not bad for a $30 receipt printer. My test image came out like this (iffy scan, sorry):
I haven’t covered the intricacies of setting up serial port connections here; maybe another time. Also, there’s a short delay (maybe 10–20 s) between selecting Print and the printer coming to life. CUPS is pretty complex, and is doing things in the background while you wait.
(Seeing as I use their logo prominently up there, I should totes acknowledge that “Raspberry Pi is a trademark of the Raspberry Pi Foundation”. Also, I couldn’t have done all this without the support of Reed Zhao. Though Reed has moved on to bigger things and doesn’t sell printers any more, his help — not to mention the generous loan of a couple of printers — was very welcome.)
Instagram filter used: Lo-fi
Scored this cheapo USB printer on eBay: “High-speed 58mm POS Dot Receipt Paper Thermal Printer USB”. It identifies itself as a CATEX Technolog [sic] POS5890U, with a USB vendor:product ID of b000:0410. After a bit of random fiddling, it shows up as /dev/usb/lp0 on a Raspberry Pi. After turning off CUPS (as it nabs the device, not even letting root near it), you can print images up to 384 dots (48 mm at 8 dots/mm) wide using the ESC-POS GS v 0 command. You can use my esc-pos-image.py script if you wish, and if you need a test image …
(The photo is of Marie Doro; proto-goth 1902 style.)
I’m building a Zeta SBC V2, a basic Z80 computer in the spirit of the N8VEM. I’m trying to kit it out mostly locally, which means extensive trips to Creatron, Supremetronics/Honson Computer (aka the basement of College Home Hardware), Above All Electronic Surplus, and Active Surplus.
Fun discovery #1: not all CR-2032 battery holders are the same size. This board call for the one just a tiny bit larger than the coin cell itself. Most of the ones with the retainer clip that goes over the battery are too big, and will prevent other components being installed.
Here you go, then. It should print perfectly on an 58 mm thermal printer. It features:
- 12½% grey scales (clockwise, from right) — ordered, Hilbert (clump=5), Floyd-Steinberg, and halftone (4 pixel/cell).
- Vertical and horizontal test lines.
- Classy woven background.
- Roughly 50% grey overall, so shouldn’t cause your printer too much grief.
- Entirely free of licence restrictions.