OpenSCAD: Homework LS 2015/2016
Hedgehog in the Cage
You need to create a parametric mode of Ježek v kleci written in OpenSCAD, in case you have no idea what Ježek v Kleci is read about it overhere.
Hedgehog (Ježek) is basically a ball with spines, as you can see on this illustration. Hedgehog can have spines all over his body.

Jan Tleskač has hidden a blueprint of the flying bicycle inside his hedgehog, he has screwable hedgehog, we will only have “clickable” hedgehog, clicking mechanism is illustrated on next picture:

Properties of hedgehog:
- Vertical distance from center of the ball (hedgehog’s body) is defined.
- Hedgehog is hollow, the thickness of his body wall is defined by parameter.
- NOTICE: The upper part of the ball is not moved anywhere, there is just a hole, not gap.
- Spines has shared diameter, but they differ in their lengths and directions. This is defined by outter point, which is passed by coordinates represented by vector in order X,Y Z. Hedgehog body, the ball, lays in center of the origin.
- Spines are only outside of hedgehog’s body not inside, spines that would be to short, would not exist.
- Spines are touching the ball by whole side not just in one point.
- Spine is actually specialized cylinder, with specific ending as is shown on next picture.

Cage in which hedgehog is placed in is composed by top and bottom toroids and pillars.

Inner view of top and bottom toroid is rectangle with rounded corners.

Every single pillar has the same thickness, and spines are places symmetrically around the circle, and they lays in the center of toroid profile. For testing purposes make sure that you will start to place pillars starting from positive direction of X axis.

The cage shall be placed so the ball (Hedgehog’s body) lays in middle of it, and pillars should be parallel with Z axis. Red dot on the following image represents the origin.

Module
Your module must comply as an independent OpenSCAD module, it has to be usable by using OpenSCAD directive ‘use’, it shall not contain aby constants outside module, but it’s very good idea to create helper modules. You have to use this interface (including those default values!), in case you will not use it your task will fail.
module hedgehog(diameter=30, wall_thick=3, spines=[[0,0,20], [0,0,-20], [0,20,0], [0,-20,0], [20,0,0], [-20,0,0]], spine_thick=3, lock_distance=3, lock_gap=1, profile_size=[5,3], profile_diameter=40, profile_corner_radius=1, pole_thick=3, pole_count=4, pole_length=40 ) { /* code */ }
diameter
outside diameter of hedgehog without spineswall_thick
thickness of hedgehog wall, (Hedgehog is hollow)spines
vector of end points of hedgehog spinesspine_thick
spine thicknesslock_distance
distance described by two arrows of locking mechanismlock_gap
thickness of hole of the lockprofile_size
vector of two values defining outter size of rectangle profile of toroid first value is in direction of X/Y the second one is in direction of Z axisprofile_diameter
outter diameter of toroidprofile_corner_radius
radius of cornerspole_thick
thickness of pillarspole_count
count of pillarspole_length
pillars length from one toroid to another
Corner Cases
- You do not have to care about
spines_thick
being thicker thandiameter
- If a spine would interfere with the locking mechanism, both spine and mechanism should remain intact (i.e. the spine should start on the surface of imaginary sphere that would be there if the mechanism would not be present), in reality such spine might connect both parts and make the mechanism useless, but in this homework, we don’t want you to try to fix this anyhow
- You do not have to care about spines or ball going throught cage
- In case of negative value you shall change this value of any parameter to 0
- In case of negative value or 0 parameter where it doens’t make any possible sence nothing should render
wall_thick
andlock_distance
doesnt neccesary fin into hedgehog (don’t try to solve this)lock_gap
can be bigger thanwall_thick
in this case locking mechanism dissapear, and the hole will still be there- In case
profile_corner_radius
is to big, you need to shrink it to maximum possible size
Bonus
The BONUS point you can get by implementing Tleskač’s secret. You shall place children()
of hedgehog()
module inside the ball, beware, you do not know how big a secret it is so resize it accordingly. You however know that: The center of secret is in origin. Largest dimension is X.
Code
Code must be on level of University student! You need to use the very same code alignment for the whole document. Repetitive constructions must be implement using modules and loops. Magical constants must be self explanatory, or commented. It is not possible to use any external libs. Manipulation with $fn
, $fs
a $fa
is sctrictly prohibited.
Submission and grading
Name your source code hedgehog.scad, and save it to hedgehog.zip to root dir of archive and upload it to you personal namespace on Edux. It has to be downloadable from https://edux.fit.cvut.cz/courses/BI-3DT/_media/en/student/username/hedgehog.zip
. Place link to your submission to your namespace. The archive should contain all necesery files. There shall not be any generated .STLs. Correct naming convention is necessary for our automatic tests. Badly named files are not considered as submitted, and your task will be graded by 0 points.
Deadline is 18.5.2016 (including that date). Late submission is not possible! In case of long term illness, it is possible to discuss different deadline. Illness or accident right before the submission date is not valid excuse for us.
After you task will be graded, there is no way how to get better grade or fix your issues, but it is possible to consult your homework before the submission deadline.
When grading is in progress we have prepared tests with corner cases, make sure that you will test your modules for any possible arguments.
Student can gain from 0 to 20 points. Depending on code quality, and functionality of your module.
In case we analyze your module as cheating or you will not be able to explain your own code, your task will be graded by -100 point. This happened before.
The count of failed tests reflects grading. Tests will be publicized after the deadline. It is not valid argument to say that one mistake in your code caused several tests to fail, so you should not be graded that badly.
Before deadline there will be tests submission for you, your teacher will run tests on your module and contact you for example that some of your mistake has broken all tests etc. We will not show you the test before the deadline because it would be too easy to develop this task just to pass those tests.
Pre-deadline test checks will happen on 23.4., 30.4., 7.5., 14.5. and 16.5. always around 00:01 (in the night). Make sure your code is on Edux on that time. You can expect feedback within 2 days. Your code will not be pre-tested on any different date.
FAQ
1. //In case profile_diameter is to big, you need to shrink it to maximum possible size
Does “too big” mean if the hole in the toroid is bigger or equal to the sphere’s diameter, so the hedgehog could “escape” through the toroid holes?//
It should say profile_corner_radius, corrected.
2. //wall_thick and lock_distance doesnt neccesary fin into hedgehog
Does it mean that wall_thick and lock_distance could be bigger than the sphere’s radius? If so, how should should it be handled? Not render? Decrease to maximum size?//
Don’t try to solve this, we will not test such case (added a note there).