Art of illusion

From RepRap
Jump to: navigation, search

Hints on Using Art of Illusion for RepRap

0. Introduction

We have decided to use Art of Illusion (AoI for short) as the design system for RepRap. AoI is not intended as an engineering computer-aided design (CAD) tool, but rather as a three-dimensional design system for animated computer graphics. However, it has an extraodinarily minimal, wide-spanning and intuitive user interface that is very easy to learn, and it has the ability to output solids as STL files; STL is the standard format for rapid-prototyped parts. AoI was written by Peter Eastman and others and is completely free and open-source.

There is a lot of good clear documentation that comes with AoI, and it is not the intention of this page to duplicate any of that. However, we have found a number of how-to hints that help when using AoI for mechanical design, and those are documented here.

1. Getting started

The AoI website has detailed instructions for downloading AoI and getting it working under a wide range of operating systems. Once you have installed it, go to the Scripts and Plugins manager (in the AoI "Tools" dropdown) and get all the scripts and plugins from the web (you won't use all of them, but they're quick to download, and this is simpler than deciding which you want and which you don't). Note that on some systems you may need to be the superuser or administrator to do this, as it will install a file on your machine.

If you are going to use AoI for CAD (for RepRap or for any other engineering) start by getting familiar with it using its own documentation and examples; don't begin by trying to design an entire mobile phone casing (or whatever you actually need) first off. It's important to learn without the added pressure of having to solve a specific design problem too.

However, do make sure you explore and get familiar with Boolean Modelling (in the AoI "Tools" dropdown) and the use of the grid (under the "Scene" dropdown). I am assuming that you will be working in millimeters as the standard engineering unit. Treat one AoI unit as one mm, and experiment by building objects of about the size that you want to end up making.

If you're from a place which has not yet discarded the archaic unit of "inches", a quick cheat is to set the grid spacing to 25.4 units, and the divisions per grid unit to represent the fractions of an inch that you wish to deal with. Your design will then be in millimetres, but can be worked on in inches. Millimetres are strongly recommended for RepRap work.

If you're working with an existing model that is scaled one inch per unit, you can convert it to millimetres using the mesh editor:

  1. Convert the object to a mesh if it isn't already (Object->Convert to Triangle Mesh)
  2. Open the object in the mesh editor (Object->Edit Object)
  3. Select all the vertices in the model (Edit->Select All)
  4. Open the transform dialog and set all scale factors to 25.4 (Mesh->Transform)

2. Hint: avoid doing booleans on coincident surfaces

You have to get into a way of thinking with AoI, and this hint has the biggest influence on how you think about constructing shapes. It is also the most important hint in the list, for reasons that will become apparent.

But what does it mean?


Suppose you wanted to make the L shape in the picture. A natural way to think of this might be to take two blocks:


And to form their boolean union to make the shape you want. But this is a boolean operation on a coincident surface - the flat face where the red and blue blocks just touch. Eventually you will discover if you keep doing this that AoI ends up thinking it has what is technically called a non-manifold shape. A non-manifold shape is one that, for example, has a face on it of no thickness. Such an object cannot exist in the real world of matter, and so your design will start to unravel from this point onwards. In particular you may find it impossible to do further boolean operations with it, and impossible to write it out as an STL file. Things will get worse more quickly if you create such objects using curved surfaces rather than simpler flat planes.

The problem is caused by a nice distinction that mathematicians make between open and closed sets, and the impossibility of representing this distinction unambiguously in a finite computer. If you want details (and rather excitingly they have profound philosophical consequences for the ultimate nature of reality and what happens in the quantum structure of the universe itself), I've written a separate page on the question.

Note that AoI is not alone in suffering this problem - I have researched geometric modelling for CAD for twenty years, and no perfect solution has been found by anyone. All commercial CAD systems (many costing tens of thousands of dollars) will fall over at this problem sooner or later. It's quite fun if you're in the know and are at a big trade show with lots of suits. You can go up to an expensive system and crash it for them almost immediately...

How do you avoid the problem? Simple - make most shapes by subtraction, and always subtract a bigger thing than need be:


The blue transparent block is taken away from the red block to make the desired shape. Note that the blue block is bigger than the red one in all its "un-needed" dimensions. This completely avoids two surfaces of the two boolean operands coinciding.

You can do the same trick with union.


Here the blue cylinder is longer than it needs to be and punches down through the horizontal surface to a point about half way through the thickness. The red and blue objects can now be unioned without the flat end of the cylinder coinciding with the flat horizontal face.

The only place that the coincident-surface problem cannot be avoided is when you want to create a tangency. For example here:


If you wanted to union the cylinder and the block you cannot avoid the coincidence down the line of tangency. But you can avoid the coincidences of the top and bottom surfaces by making both objects too long and of different length:


And then subtracting a block from their union to chop it to length:


Obviously, in the real world you need to do a similar thing to the bottom of the artifact too but we're keeping this illustrative example really simple.

3. Hint: Use the grid

If you are designing a real physical object you will almost always want most of its dimensions to be precisely controlled. Indeed, you probably want almost all of them to be a whole number of millimeters. Turn the grid on almost all the time. I set the grid pitch to 10 mm, and then have the cursor click to one tenth of that, so everything I design is on a 1 mm grid. This gives precision, but the screen isn't filled with lots of grid lines. Peter Eastman very kindly changed AoI at my suggestion so that it numbers its grid lines on the screen. This is very helpful when you are designing as it stops you getting lost.

Occasionally you need something on an 0.5 or an 0.25 mm point (particularly when you are centering an object against something else of odd width). There are two ways to do that:

  • Move to the nearest whole grid line, then transform the object by 0.5 mm ("Transform Object" in the "Object" dropdown).
  • Temporarily reduce the grid pitch to 0.5 mm

The second is often quicker (especially if you need to perform the operation on several objects), but the first is safer and easier to undo. I also found that I tended to forget and leave the grid on 0.5 mm by mistake. After 15 minutes busy designing I noticed, but by then had placed twenty objects 0.5 mm out...

4. Hint: Keep all your construction

First, the guys at Metalab have written an AoI plugin that makes it much easier to do boolean set-theoretic operations in AoI. You can find details and downloads here. It's thoroughly recommended, as engineering design uses booleans all the time. They have effectively automated what follows:

Suppose you want to make four holes in your L-block for some screws to go through:


Create one cylinder in the right place (and longer than need be - see the first and most important hint above):


Then make three copies of it and translate them to where you want them:


Then subtract all four from the block one by one (or you can union them, then subtract the result in one go).

Keep the cylinders, but hide them from view if they clutter the scene. That way if you need to re-create the object you have all the building blocks for it. Also, if you design another object next to it to which it has to be attached, you can subtract the same screw-hole cylinders (possibly elongated) from that and thus guarantee that all the holes will line up.

5. Hint: Make and position all the building blocks first

This is a psychological, rather than a technological, hint. It is a natural tendency to want to solve a problem quickly, and so the temptation is to position a few simple shapes, then to start taking boolean combinations of them, then to position some more shapes to make refinements, and so on.

Resist this temptation, and instead plan. In particular put all the primitive shapes you will need to make an object in the right place before doing any boolean operations, and do these last of all. The intermediate scene can get very cluttered, so use hide- and show-object to make things clearer and use colour to distinguish between objects and classes of objects.

In a simple way this was illustrated above in the holes in the L bracket - the cylinders were all positioned before the booleans were taken. The two blocks that made the L should have been treated in the same way, but this is a didactic document so clarity must take precedence over consistency...

6. Hint: Keep track of what you are doing by using descriptive names

It can be an idea to use a naming convention that keeps track of how you made something. And when you do a boolean operation, hide the two operands and drag them to make them sub-objects of the result. Thus subtracting the first hole from the L block would give:

>  L-block - cyl-hole-a

And the whole block would be:

>   L-block-with-holes
    > L-block - three holes
      >  L-block - two holes
         >  L-block - cyl-hole-a

Use the indent arrows to close sub objects when they are complete to keep things compact. This allows you to know what you've done with what, and - if need be - to re-play the construction steps.

AoI already has the ability to re-play the construction steps one at a time automatically - if you right-click on a boolean object and select the "Edit" menu, you get the two things it was made from and the boolean operator. You can change any of these. I had an e-mail correspondence with Pete Eastman (AoI's principal author) on extending this to have the option to create a general log file of every action you take when using AoI. This could be replayed and, more importantly, edited, thereby making it easy to create modifications of a design without manually re-constucting all of it.

7. Hint: Creating rotational symmetries is easy if you know how

For many designs you need to distribute parts around a circle. For example, here is the rotor from the RepRap peristaltic pump (this feeds paste-like building materials).


Desiging this needed many parts to be created in a fixed location (for example at a radial distance along the X axis) then rotated into position. To do this make a cylinder centred where you want the rotation to centre (in this design I just used the cylinder that was to form the basis of the top plate you can see). Then make the part to be moved a subsidiary part of that cylinder - select it, and drag it under the cylinder in the right-hand component list column. Then rotate the cylinder through the required angle, and all the things under it will rotate too. You can then drag them back out again in the right hand column if you want to restore them to the base level of the hierachy.

8. Hint: Convert complicated objects to a triangle mesh, but beware approximations

If you do lots of booleans to create an object, you will discover that AoI gets slower and slower as you go on. However, if you convert the object to a triangle mesh:

  1. Select the object and convert it to a triangle mesh (in the "Object" dropdown).
  2. Select "Solid Editor..." from the "Tools" dropdown.
  3. In the "Mesh" dropdown, make sure that "none" is selected under "smoothing method".
  4. Both "Optimise" and "Simplify" the mesh from the "Mesh" dropdown. As far as I can tell, the order in which you do these doesn't matter.
  5. Select "Fix -> Fix all" from the "Solid" dropdown. It's at this point that you'll discover if you have made a non-manifold object (first hint above) as the system will complain if you have.
  6. Click on "O.K."

you will find that things go a lot faster. Beware though - you have introduced an approximation; where before you had, for example, a perfect cylinder (well, perfect to the accuracy of floating-point arithmetic), now it will be a facetted approximation to a cylinder. AoI allows you to set the accuracy of the triangulation that you generate; set it finer than you want the precision of the object that you will be making (that is, typically smaller than 0.1 mm).

9. Hint: Tidy the triangulation before writing an STL file

When you have finished your design, save it first as an .aoi file so you can read it in again and work on it. Indeed, it's a good idea to do this from time to time as you are designing, especially before you are about to try something that you are unsure of.

If you are going to build your design using an RP machine, it will need also to be saved in stl format. This is little more than a list of triangles in space that completely cover the surface of the object you want to make. AoI contains several tools to help with the generation of such files, and you need to apply them in the sequence given for triangulating an object in Hint 8.

Then you can export the object as an STL file. In the latest versions of ArtOfIllusion, you must install a plugin in order to enable ArtOfIllusion to actually create STL files. You can do this from the "tools->Scripts & Plugins Manager->Install tab, or you can search for the STLTranslator jar file on the ArtOfIllusion sourceforge page and copy it to your ArtOfIllusion/Plugins directory. If you use ArtOfIllusion's Scripts & Plugins Manager, make sure you have privilege to write to the Plugins directory, or you'll be in for a confusing time.

Once the plugin is installed, first select the object in the scene to export (even if you only have one). Then go to the "Export" option from the "File" dropdown. You should see an option to export stl file there. Depending on how you have installed AoI, the default directory in which it will save the STL file may be the one in which AoI is installed, to which you may not have write permission. Use the "Browse..." menu to select a sensible place to write your file.

10. Bug fix: AoI On Wintel

Drivers for video cards on Wintel machines can cause trouble with AoI, especially drivers for ATI cards.

If you are having trouble with your Wintel machine hanging up while you are running AoI with challenging problems and especially if you get the occasional Blue Screen of Death, a very rare situation with XP, try disabling OpenGL in your preferences file for AoI.

c:\Documents and Settings\(username)\.artofillusion\aoiprefs Find the line that says..

useOpenGL=true and change it to false. This will make the program a bit slower to work with, but it should work.

Actually it didn't seem to make any difference in AoI's execution speed. Thanks go to Peter Eastman at AoI forums for the tip.

(taken from AoIOnWintel page)

Improvements to AoI that would be useful

This is a list of functions that, if added to AoI, would make it even more useful to RepRap and to engineering design in general.


This would be a function that allowed one to add dimensions in the conventional engineering way to views. They could probably be implemented (compactly but inefficiently) entirely using existing AoI polygons for both text and tick marks. One extra piece of information would have to be added to each such polygon - which views it appeared in. Thus the ticks and text (||<------>|| and "25 mm" or whatever) would only be plotted in, say, the front and back views, and not any other.

It would also be useful to be able to hide all dimensions, or show them, with a single click.

It would be really neat if dimensions could also be tied to the parameters of primitive objects, so that, for example, selecting a dimension that said "30 mm R" for the radius of a cylinder pulled up a little window with "30 mm" in, and when one edited that to "40 mm" the cylinder would change appropriately. That would only work for dimensions on simple objects; attempting to do it for a dimension on a complicated object should produce a warning saying something like "Rescale whole object ABC in X direction to make dimension 50 mm 60 mm? OK/Cancel".

Four types of dimension should do to start with: linear, radius, diameter, and angle.


For most design, you don't care what colour things are as long as you can see them. AoI gives everything a default grey colour, which can make multiple objects hard to distinguish. It would be useful to have an option that automatically coloured every new object in a contrasting colour to those that had already been used (that is to say, it distributed the points in the RGB colour space as widely as possible, and also avoided the origin where everything is a shade of black). An additional function to take all the objects in a scene and apply that rule retrospectively would also be useful.

-- Main.AdrianBowyer - 03 Nov 2005