Design of a Mechanical Counter in ISCAD - hkroeger/insightcae GitHub Wiki

The goal of this example is the assembly shown below: a two digit mechanical counter, ready to be 3D-printed.

InsightCAE ISCAD Counter exploded

For a more detailed description of the principle, e.g. have a look here: http://woodgears.ca/counter/ .

The Components

We will start by creating models of the components of the mechanism. Then we will combine them into an assembly and add the housing on the assembly level.

Trigger Gear

Create a new model by right-clicking in the file tree view on the left of the main window and select "Create new file...". Enter the name "trigger_gear.iscad". A new tab for the just created model will open and we can enter the model script in the editor widget right of the 3D display widget.

The first entries are the definitions of some parameters that are need later in expressions. All ISCAD statements end with a semicolon ";". Like in an interpreter language, symbols are created through assignments. The type of each symbol is recognized from the right hand expression. A comment is everything from a hash symbol "#" until the line end or everything enclosed by the C-style comment symbols "/*" and "*/". If an assignment is made with "?=" instead of "=", its RHS value can be overriden by some other script which loads the current script through the "loadmodel" command (This will be used later in this example).

modul ?= 1; 	# gear module
t ?= 3; 	# gear thickness
dw ?= 2;	# shaft hole diameter
tovl ?= 1.5;	# depth of the recess

A geometry feature is created next. There are several commands available for geometry creation, A list is available by typing Ctrl+F (or by selecting Model > Insert feature... in the menu).

InsightCAE ISCAD Insert Feature Dialog

We create a "SpurGear" feature, named "sg1", with a module according to the previously set parameter "modul", a fixed number of 20 teeth and the thickness t. Afterwards, the angle of a single tooth is computed and stored in the variable "sg_ang" for later use:

sg1 = SpurGear(modul, 20, t);
sg_ang = 2*M_PI/20;

The symbol "M_PI" is predefined in every model and contains the value of pi. Similarly, there is another constant "deg", which contains the value of one degree in radians.

Once the last two commands are entered, the model may be parsed and the geometry features built. This can be done by clicking on the button "Rebuild" in the upper right corner of the window. Alternatively, you can type Ctrl+Return. When the script becomes longer, it is sometimes desirable to evaluate it only up to a certain location. To do this, place the cursor where you want the parsing to be stopped and either click on "Rbld to Cursor" or type Shift+Ctrl+Return.

When the script is evaluated in this stage, the entry "sg1" shows up under the node "Features" but is hidden. This is the default for all feature symbols which are created by assignment with an equal sign ("="). The alternative is assignment with a colon (":"). Those symbols appear under "Components" and are visible by default.

InsightCAE ISCAD feature sg1 display

For the trigger gear, the whole spur gear is not needed (this is why it was not assigned as a component with the ":"). Only two tooth are required. Geometry features are not only representing geometry but are also containers for additional symbols, including scalars, vectors and geometry. The "SpurGear"-function creates a feature which contains the cross-section geometry of a single tooth, named "tooth". The directory of available symbols can be explored by typing Ctrl+I or selecting Model > Insert component name... from the menu.

InsightCAE ISCAD symbol explorer

For the current model, we create a pair of two teeth from the cross section geometry in "sg1.tooth", by rotating it to the left and right, extruding it and joining the two solids together by a boolean union ("|" operator). The result is assigned to the symbol "teeth":

teeth =
 Extrusion( Rotate( sg1.tooth, -0.5*sg_ang*EZ, O ), t*EZ )
  |
 Extrusion( Rotate( sg1.tooth,  0.5*sg_ang*EZ, O ), t*EZ )
;

Then a ring is created and the two teeth are subtracted from the ring ("-" operator):

sg_gap1= 
 Cylinder(O, ax t*EZ, 2*sg1$outer_radius, 2*sg1$root_radius)
 -
 teeth
;

Here, the inner and outer radius of spur gear feature is used, which were also stored inside "sg1". The result looks like this:

InsightCAE ISCAD ring with teeth subtracted

We only want to keep the volume between the two teeth and drop the other. With the "?solid()" query operator, some solids of a multi-solid feature can be extracted by a rule (similar versions of the operator exist for vertices, edges and faces). The rule is a string (enclosed in single quotes). Here, we want to find the subsolid with the minimum volume ('minimal(volume)'). The return type of the query operator is a selection set. This set can be converted into a geometry feature by the enclosing asterisk operator "*( )" and is assigned to the symbol "sg_gap":

sg_gap =
 *( sg_gap1?solid('minimal(volume)') )
;

In the last step, the final geometry is created by subtracting from a cylinder the gap, the shaft bore and the recess and adding the teeth pair. This time, the result is stored in a component symbol "gear" with the colon (":") operator:

gear :
(
 Cylinder(O, t*EZ, 2*sg1$outer_radius)
 -sg_gap
 -Cylinder(O, ax t*EZ, dw)
 -Cylinder(t*EZ, ax -tovl*EZ, 2*sg1$outer_radius, 2*sg1$root_radius)
) | teeth
;

Additionally, two datums are also defined for later use in the top assembly:

pl_gear = XY;
axis = RefAxis(O, EZ);

The final part looks like this:

InsightCAE ISCAD Counter Trigger Gear

Will be continued soon...