A couple of months ago (May 2-3), the first PyCon was conducted in Israel.
It was a really cool and fascinating event, which I enjoyed and that exposed its 350 participants to lots of useful knowledge and techniques.
I had a talk there, titled “Generating, automating and processing 3D graphics with Blender’s Python API“, that very briefly introduced the host of python coders in the audience to Blender python scripting. You can watch the talk here:
מחקר שפורסם לאחרונה וכלל ניסויים בדגי סלמון בחוות גידול, שופך אור על המנטליות של הנסיינים ביחס למושאי המחקר שלהם, ועל הפסיכולוגיה המורכבת של בעלי החיים לא מוערכים אלה…
Source: חוקרים מגלים שדגים מתים מדיכאון בחוות סלמון – הפתעה?
An amazing event a couple of weeks ago vividly illustrated to me the immense power of sharing knowledge online.
Remember the pet wheelchair I designed for Benji the cat last year?
You might recall that after completing the project, I uploaded the 3D files to thingieverse.
In August last year (2015), I was contacted by a guy from Australia regarding the wheelchair. He asked me to adapt my design to work with 12mm aluminum bars, which are more common and easier to get in Australia. He said there’s a project he’s working on that could use this design at a local vet clinic. I added a 12mm version to Thingieverse and forgot about it for the next 5 months.
But two weeks ago, he posted a comment in the Thingieverse page, and told me this design was used to help a cat called Mozart recover from serious fractures in his hind legs!

Mozart the cat trying out the 3D printed wheelchair. Photo: Martin Orliac.
Apparently, the story even got published in the Sydney Morning Herald. How cool is that?

The finished wheelchair. Looks far nicer than the one I built for Benji! Photo: Martin Orliac.
Why stop there?
After I posted about this on Facebook, I was contacted by Leeron, an activist who lives in Bulgaria and is involved with rehabilitating a baby deer called Kinta. The poor thing got infected with Tetanus and lost control over his hind legs, and is now undergoing physiotherapy. But progress seems really slow via standard physiotherapy, so Leeron wants to use a wheelchair to help Kinta learn to walk again, and asked if I could help.

Kinta the baby deer. Poor thing got infected with Tetanus and lost control over his hind legs.
I opened Blender, downloaded a deer model from BlendSwap and started sketching. This time, I decided to use aluminum pipes with a circular profile for the main frame instead of rectangular bars, since a deer is likely to weigh a lot more than a cat and the added strength per weight ratio will be useful.
Here are some of the sketches I sent Liron:


The keen eyed blenderheads among you will likely notice the quick and dirty shading combined with freestyle, to generate clear lines for the sketches.
Waiting for updates
Leeron and co. already started gathering materials for the build. I’m anxious to hear how it goes, and will likely try to provide them with other designs if this one proves inadequate. I’ll update here when I learn more, and hopefully get good news with pics of the cute little critter with the wheelchair (or better yet -walking after rehabilitation).
In high-school, I always considered myself average in math, and I never took much interest in it.
In fact, I can’t say I took an interest in any of the classes taught except history occasionally (at least there were nice stories there). It’s not that I wasn’t interested in the subjects themselves (as I would later discover), it’s just, well… that they were taught in a dull and utterly unimaginative manner. This, unfortunately, is likely the norm in most schools.
It would take me nearly 10 years from the time I was graduated from high-school, to really appreciate how useful math could be. It was during my time as a graduate student, performing research in microbiology that required analyzing large amounts of data. At the end of that period, statistics – probably the least favorite topic for most undergrads, would become one I’m actually rather fond of! Later still, I would heavily regret my earlier disinterest in math, and learn how useful it is for my day to day work in 3D and image processing.
I believe that math is normally taught in a criminally bad way in school. Being a field full of abstractions, it’s commonly taught in an abstract, detached manner, without giving students any real indication to its applications. Our brain is a pretty economical organ, which often refuses to learn things that seem utterly useless, particularly when they require as much effort and repetitive exercise as math often does. I think this is at the heart of the modern math education crisis.
If it was up to me, I’d intertwine math with other subjects from the start. Programming specifically, but also physics, chemistry, economics and biology. Heck, why not a combination of programming and math heavy science? Let kids write code that solves their homework for them, and they will have to understand both the science and the math involved, and learn to code along the way. However its implemented, math should ALWAYS be taught alongside its applications. Optimally, interesting and compelling applications (like video games).
Of course this might not apply to the truly abstract nature of some of the higher level, academic math topics, but it does and should for middle and high-school, and most college level courses.
Intersecting Edges

Lately I’ve seen an intersting question on the Blender StackExchange website: how to add a vertex at the point of intersection of two edges. That’s a pretty useful thing, especially if your 3D geometry is distorted and noisy, a common issue with 3D scans.
There were already several answers to this question, describing a number of efficient techniques for fixing this issue. One of which, by the almighty Zeffii (who maintains the Blender Python blog), included an automated, scripted solution that employs the function geometry.intersect_line_line(v1, v2, v3, v4) to find the intersection and adds a vertex there.
It does not, however, split the edges at this point, so this vert is floating above.
That’s one reason I wanted to write a different solution. The 2nd reason is that I didn’t want to depend on the built-in intersection function. Intersecting two straight lines is a pretty trivial mathematical problem, and I wanted to see if I can revive enough of my basic math skills to solve it.
Solving it
The first step is to generate a parametric line equation for each of the two edges. This nice page showed me that a 3D line equation could be represented thus:
(x,y,z) = (x0, y0, z0) + t(a,b,c) = ( x0 + t·a, y0 + t·b, z0 + t·c )
With x0, y0, z0 being the XYZ coordinates of the edge’s first point (let’s call it p1),
and a, b, c being the XYZ values of the edge direction vector, which is calculated by subtracting the edge’s first point (p1) from the 2nd point (p2).
And finally, t is the line’s parameter, with which we can calculate any point on that line.
This could also be broken down to equations for any particular axis’ coordinate:
x = x0 + t·a
y = y0 + t·b
z = z0 + t·c
With this in mind we can reconstruct both edge’s line equations. And the intersection point between both lines, is the point where the x,y,z values will be the identical in both lines. I later found an answer in the Math StackExchange website describing this solution in a much prettier manner.
So, since I know the first points of each vector and the direction vector’s of both edges, all I needed to do is to reshuffle the variables a bit until I had an equation for one line equation’s parameter t, then plug that value in the line equation to find the intersection point’s coordinate. Here’s the python code for that bit:
globCo = lambda co: o.matrix_world * co</pre>
def find_intersection( edges, o ):
# Calculate global locations of edge verts
p1, p2 = [ globCo( v.co ) for v in edges[0].verts ]
p3, p4 = [ globCo( v.co ) for v in edges[1].verts ]
v1 = p2 - p1 # Edge 1 line vector
v2 = p4 - p3 # Edge 2 line vector
# Calcualte intersection
# Based on paramteric line equation: (x,y,z) = p0 + t * lineVec
numer = v2.y * ( p3.x - p1.x ) + v2.x * ( p1.y - p3.y )
denom = v1.x * v2.y - v1.y * v2.x
t1 = numer / denom
co = Vector( [ getattr( p1, i ) + t1 * getattr( v1, i ) for i in 'xyz' ] )
return co
The entire script can be found on GitHub.
Hopes and Regrets
If only someone told me the algebra and calculus that dulled my senses in school (and more advanced topics) can be used to generate amazing 3D structures, power game engines and simulate interesting phenomena in the real world, I certainly would have paid more attention and worked harder to master the material and learn more. One day, when I have a bit more free time, I hope to try and develop curricula that integrates math into programming and other scientific subjects from the get-go, preferably with gamification employed as well. If any educators are reading this, I’d be happy to hear your thoughts on the matter.

Extruded spiral with a few modifiers applied
Many hardcore blenderheads will probably identify with one of my latest addictions – the Blender Stack Exchange website.
Stack Exchange is part of the Stack Overflow universe, an ingenious, revolutionary project that provides invaluable information to coders and software users around the world. The idea is simple, encourage people to share knowledge and information by answering questions in a gamified social environment. Questions, answers and comments are easily ranked and carefully moderated, and good answers can easily stand out from the bad or mediocre ones by a useful system of ranking.
But the real genius of this system is its effective gamification. Good questions and answers provide points, badges and status. It quickly becomes addictive to see if an answer you posted got positive votes, or helped the person who asked the question (who often might post grateful, enthusiastic comments). Once you got enough points under your belt, it becomes interesting to examine the various leaderboards (which show top ranks by week, month, quarter and all time, among others).
The system is so effective, that world renowned experts that would probably charge hundreds of dollars per hour, work hard to provide useful answers for free.
The Blender Stack Exchange website is particularly active and there are some amazing people there who obsessively check for new questions, and would often provide a useful answer within 30 minutes or less from the time the answer was posted! Usually you don’t even need to ask a new question, as so many good questions and answers already exist. I cannot count how many hours of difficult research, struggle and experimentation I saved by simply tapping into this amazing well of knowledge.
This is a good opportunity to thank these brave women and men 😉
Zeffi, Gandalf3, Poor, Cegaton, Carlo, batFINGER, David, PGmath, Sambler, Jerryno, Pink Vertex, CoDEmanX, stacker and any I might have forgotten. You guys are awesome.
Lately I’ve been expanding my addiction to additional Stack sites, one of which is Computer Graphics. The Script I’ll describe below is a result of this fortunate new interest.
Archimedian Spiral Generator Script
While browsing the Computer Graphics Stack page, I bumped into a guy who asked (and later answered) how to algorithmically generate an Archimedian Spiral in C++. The algorithm was short and elegant, and the result beautiful. It was simple to translate this into a blender script that would generate spirals in 3D, so I did.
After installing it as an addon, you will be able to add a new spiral through the Add Mesh Menu. I might make proper or addon out of this sometime soon (perhaps as a new Extra Objects variation that will also include my Koch snowflake addon and Fibonacci Spiral).
Enjoy!

I designed this (not so) little thing ages ago, put it up on Shapeways and saw quite a number of people order it in metal despite the considerable price it cost to print something of this size in metal.
It’s the kind of shape you can’t really manufacture in any other automated fabrication method except 3D printing (you can make such a shape by hand if you’re a master jewelmaker, but that I am not). But if you really loved The Withcer 2, which I really did, this shape will hold a special significance and you simply must have a physical representation of it somehow (and a replica of the medallion from the game is the best kind).
I designed, printed and wore a version of Geralt’s Wolfshead Medallion for quite some time, but lots of people have these, and CD Project even gave out copies with collector’s edition of the original Witcher game and its sequels.
No one else that I know of made a really good replica of Letho’s viper school medallion, so I had to make one.
I ordered it once in the cheapest material available, nylon-12 (that shapeways call “Strong and Flexible plastic”), just to see how it feels, and it looked cool, though it was obvious this kind of object must be printed in metal to live up to its potential.
My Witcher medallions are the bestselling products in my Shapeways store, and I’m always pleasantly surprised when another person orders one, especially in metal. A few of these ordered during the last couple of months provided enough income to convince me it’s about time I got one too.
Here’s the result!
The medallion is pretty damn heavy in this (polished nickel steel) version, but it makes it feel solid and awesome. I’m really happy with how it came out.
I recently had to convert a bunch of 32 bit tif depth maps to 16 bit pngs at work, while keeping the same file names expect for the new extension.
Normally I’d do this in Photoshop, but photoshop doesn’t allow you to save 32 bit tifs as png, it only converts it to HDR, PSD, PSB, RAW, EXR or PBM.
Which program does allow you to do that? Blender. You can load tifs and render them to any of the supported formats in Blender, which includes the 16bit PNGs I wanted.
I loaded the tifs to the video sequence editor and rendered the frames as PNGs. While that worked, all the new files had frame numbers for names.
So I decided to write an addon that does the same thing, only it saves the converted files with the same name as the original, except for the extension of course.
There’s a bunch of features that will make this addon even more useful, which include:
- Custom name patterns (instead of keeping the same name, save as another kind of pattern with numbering).
- Make sure to ignore non-image files in the source folder for the script.
- Read the source images’ resolution, and allow using it for the output, instead of relying solely on the render settings.
- Avoid deleting the existing render node tree.
- Have any additional ideas? feel free to write a comment to this post and suggest more features.
For a detailed installation and usage guide (which really isn’t all that required for such a simple addon), watch the video above or visit the addon’s WIKI page.
To report bugs, fill this form.
More information about how this latest version of the chair was built, in an upcoming post.
Meanwhile, download the 3D printable files here.
I had a chance to do a short 10 second animation recently for the Freedom Farm initiative, a non-profit aiming to establish the first farm animal sanctuary in Israel, with a museum and education center.
This was the opening sequence for a promotional video, which introduces viewers to the farm and why it’s so important.
I had very little time to do this, as work is pressing, but I think it came out alright even if I’d add and improve a gazillion things if I had the time.
Everything was modeled in Blender and the animation was rendered in Cycles.
I used this nice grass made by blendswap user einarparker, but modeled the rest myself. A particle hair system was used to distribute the grass on the hills (which were created with the landscape generator addon and some sculpting).

Grass object group used for the particle system. Original grass provided by einarparker (downloaded from Blendswap.com).
I also used a few of the awesome textures Pixar released recently to the public, and some image textures I took myself. Spec, normal and AO maps were generated using the free and wonderful AwesomeBump.

Generating AO, normal, spec and cleaned diffuse maps from a single image with the incredible AwesomeBump – easy, quick and looks great!
For the animation (which was simple camera movement only), I added some subtle camera shake as suggested by Andrew Price (Blender Guru).
I made the mistake of rendering the sky separately from the rest, which looked far less good than it would otherwise. I used some filtering in compositing to mix the two, but it shows if you look carefully (mild blur and a weak halo around the edges where the sky meets the foreground). If I had time I’d add a whole lot more detail, add more terrain in the far background, replace the sky, use a procedural texture for the wood fence (the repeats show and it’s annoying!) and improve the lighting.

Node setup used for compositing. The sky and the foreground came from different image sequences, rendered separately (big mistake), and blended back together with some subtle edge blurring. I also added a vignette and an animated blur vignette to fake DOF when close to the grass (accomplished with a simple fast gaussian filter applied via a circular black and white gradient, with the factor animated).
Rendering took around 35 hours in total for 250 frames, with my 2GB Nvidia GTX660 GPU.
Complaints and perfectionism aside, this was a really nice foray back into 3D animation from my daily coding routine. In the next few weeks I’ll get to follow it up with an internal architectural visualization of the farm’s museum, something I hope to do in a higher standard and perhaps also generate an interactive “playable” version for web interaction.
Other stuff
The cat’s wheel harness is progressing too, and a much improved new version simply needs integrated screw sockets on the aluminum frame. More updates about that soon.
I also got some comments and emails about some of my scripts that require updates and don’t work well with Blender 2.74. I’ll try to find time to handle these ASAP, which will probably be sometime during the next week or two.
What a week. A week of many lessons learned.
5 faulty designs for the pipe connector until I finally found one that will hold the pipes in place and won’t break.
A failed attempt to put the harness on the kitten, giving some clues to required (but yet missing) body supports.
And the best lesson – a visit to a vet specializing in rehabilitation medicine.
In case you have no idea what I’m talking about, you should probably read part I.
Problems with the 3D printed pipe connector and how I finally solved ’em
The wheel harness’ frame has 3 pipes connected to each other, with two longitudinal pipes attached to one transverse pipe.
The aluminum pipes’ round profile makes them quite strong for their weight, but the roundness also makes it harder to hold the pipes in place. The simplest way to connect the pipes is to screw or weld them to each other, but that renders the connection permanent and non-adjustible.
My aim is to create an adjustible wheel harness that can fit cats and dogs of various sizes, so I designed an adjustable 3D printed connector that squeezes on the pipes to hold them in place.
I had some experience using this method with aluminum connectors and it worked quite nicely. Aluminum seemed like overkill here though, since the frame won’t have to withstand too much force. In addition, it was quite difficult to make that connector, and required a mill and a lathe (not your everyday DIY equipment).
3D printing to the rescue. I designed a minimalistic connector, and Inspired by some other designs I saw online, I added a socket for embedding bolts in the plastic.

However, this connector broke rather quickly. It could hold the pipes in place rather well, but preventing them from rotating required a much stronger grip, and trying to tighten the bolt to accomplish that broke the connector.
Unfazed, I changed the design and tried adding thickness, widening the contact area between the pipe and connector and making the gap between the “lips” larger to increase the pressure on the pipe. The design gradually improved but nothing worked quite well enough, until I made a rather rigid, blocky design (leftmost in the image below).
Initially I was pretty happy with it. It held the pipes beautifully in place, and the pipes did not budge in any direction. I could apply quite a bit of pressure by tightening the nut and bolt and it didn’t break. Success? almost. It did have one major flaw…
The rigid structure proved to be a double edged sword, and it made the connector fragile in a particular axis. When I pushed a pipe inside forcefully or yanked it sideways so that it applied pressure outwards, cracks showed up and the whole thing could split into two pieces.
Further investigation showed that the very nature of 3D printing was to blame here. The piece’s weakest point was the adhesion between layers themselves. The vertical layering weakened the structure and when enough force was applied, the layers just separated and the whole structure split.
The solution – rotating the whole structure by 45 Degrees
After consulting with my start-up partner Dudu, he suggested to change the direction of the layering, by rotating the whole piece by 45 degrees. This way, the vertical layers will not be parallel to the forces applied by the pipe to the connector, and the structure will maintain its rigidity without sacrificing cohesivity.
While it’s easy to rotate the part in 3D software, printing the rotated piece is another matter. From a nice flat piece, I now had an overhanging unsupported mass. I print with Repetier and Slic3r, and the latter never seems to generate stable supports. You can see the automatic supports it generated below:
I tried to print this, but the supports didn’t stick to the bed or just collapsed way before they even had to suport anything, and I was forced to terminate the print job.
You know what they say, “if you want something done, do it yourself”. So I generated my own supports in Blender, with a column field that provided excellent support but was a pain to extract the pieces from
It took me around 10 minutes per piece and a scalpel, rotary tool, scissors, wire cutter, electric drill and pliers to clear up all the supports, but the piece was perfect – didn’t break and withstood enough pressure to hold the pipes in place beautifully. A reliable solution at last!

It took a lot of trial and error until I found a design (and print method) that works reliably, but I’m happy with the result (rightmost above).
Fitting the harness to the kitten (or rather trying to)
There’s one element crucial to the harness that’s almost invisible in all the images you can see online, unless you know what to look for.
When animals are strapped to the harnesses, you can easily see the frame, the wheels, and the front harness. Sometimes you can even see a belly support strip. But one of the most important parts is the rear harness or saddle, and since its integral to the frame and lies flat, it’s really hard to spot.
Which is why I didn’t really include one in my design…

Without a rear harness, the kitten couldn’t use the cart at all, and the whole thing just anchored him to the floor. Poor thing mewed in frustration and I felt a pang of premature desparation. First time that happened, I didn’t even know that was the reason it failed, and suspected the frame was simply too short. While that was true, the real insight came later when we went to visit a specialist vet, who’s an expert in rehabilitation at “Ha Kfar Ha Yarok” veterinary hospital.
The vet loved my design and the lightness of the frame compared to the Walking Wheels commercial harness they offer to clients at the clinic. But she immediately pointed out the lack of a rear harness.
At first I was flummoxed, but then I saw her demonstrate how to train the kitten in spinal walking using a wiry front harness as a rear harness. I suggested we try to use it for the wheel cart, and it was a pretty sound solution that held Benji’s hind legs nicely in place.
But then an additional problem manifested itself – the wheels were to low, even extended to the full height (around 15cm above ground) using my adjustable design.
The harness has to lie straight across the cat’s body, in order to avoid applying pressure on his back, which means the wheels have to be precisely the right height.
Since I had no way of adding height without preparing longer aluminum bars for the wheels, it was game over for the night. To see how it’s supposed to work, we strapped the commercial harness on Benji, but it was way to big for him so it didn’t help much except for giving me a few ideas for improving the usability of my design.
The Walking Wheels harness is pretty awesome. It’s fully adjustible, sturdy and has great build quality. The only downsides are that It’s pretty heavy and quite expensive (250-500$ if you buy it directly from them). I guess the quality of the product justifies the price, but some people just can’t afford it, and it doesn’t fit small cats. Another proof that a cheap, versatile and effective design is in needed.
What’s next
Since I posted about the DIY harness on Facebook, I got 3 more requests for helping another disabled cat and two disabled dogs. One dog needs a front harness, which is a completely different matter.
But I shouldn’t get ahead of myself. After all, this harness is not yet finished. I still need to prepare longer bars for the wheels, and attach a permanent rear harness to the frame. Both tasks are pretty straightforward, especially since I’m not the one making the rear harness! A friend’s mother, an experienced seamstress, is making a beautiful rear harness for Benji.
Which makes me worry a bit about the simplicity of the DIY solution I’m trying to devise. If you need to find a seamstress to make a harness for you, in addition 3D printing and cutting and drilling into aluminum pipes and bars, it’s starting to get complicated.
But I believe I’ll be able to find a solution for this as well. I’ll try making the next rear harness myself, and to again combine readily available materials with 3D printing to keep it simple.
But first, I want to see Benji walk. Tomorrow I’ll be heading back to the makerspace to prepare the new wheels, and later try fitting the harness to Benji again. Hope I’ll have exciting news to share!








