## Friday, September 28, 2012

### Parametric Airplane Variations in SolidWorks

I'm currently in the process of designing my third remote-control airplane from scratch. (Footage of the first airplane can be found here.) My objective for this new airplane is to make an airplane that is stable, controllable, and able to capture aerial video.

SolidWorks was very helpful in the planning and building phases. However, I found that parametric tweaking of the design once it was completed was difficult: for example, changing the length of the aileron would require editing the size of the aileron cutout in the wing, and then editing the aileron itself. Parts with more dependencies, such as the fuselage, were more complex.

Luckily, there's a very elegant solution: global variables and equations. This is relatively easy to learn and enables rapid parametric tweaking of the model to get it just right. Here are the self-documenting global variables I'm using for my new airplane (in units of inches and degrees):

"Fuselage height"= 2
"Fuselage length"= 25
"Fuselage width" = 4

"Wing chord"= 8
"Wing height"= 1.25
"Wing offset from nose"= 9
"Wing platform height"= 2
"Wing platform angle"= 180 - 45

"Nose length"= 8

"Rudder length on fuselage"= 5
"Rudder angle"= 90 + 45

"Elevator height above fuselage"= 5
"Elevator platform width"= 4
"Elevator length"= 15
"Elevator width"= 3
"Elevator throw angle"= 45

"Aileron length"= 12
"Aileron width"= 4
"Aileron throw angle"= 45

"Propeller diameter"= 9

A few parametric changes

Here is what the airplane looks like with the parameters above.

 Dimetric view of the original configuration
And here it is from the side:

 Side view of the original configuration
Though I haven't flown it yet, I expect this configuration to be moderately aerobatic and moderately stable.

Let's say we wanted a more streamlined version for racing and aerobatics.  Here are some parameters I might change to do this, along with comments explaining the change.

"Fuselage height"= 1                  // flatten the fuselage
"Fuselage length"= 22                 // shorten the fuselage
"Wing chord"= 6                       // shorten the wing chord
"Wing height"= 1                      // decrease the wing height
"Wing offset from nose"= 6            // bring the wing towards the nose
"Wing platform height"= 1             // lower the wing
"Elevator height above fuselage"= 2.5 // lower the elevator
"Elevator platform width"= 3          // decrease the elevator platform area
"Propeller diameter"= 5               // make the props smaller

 Side view of the "racer" configuration
The "racer" configuration is smaller, leaner, and more compact.

Now suppose we wanted to go in the opposite direction and make a cargo-style airplane with low wing loading and a high carrying capacity.

"Fuselage height"= 4            // increase the fuselage height
"Fuselage length"= 32           // increase the fuselage length
"Wing chord"= 9                 // lengthen the wing chord
"Rudder angle"= 90 + 30         // decrease the rudder sweep
"Elevator platform width"= 5.5  // increase the elevator platform area

 Side view of the "cargo" configuration
The cargo configuration is larger and stockier. It would be well suited for carrying fairly large payloads.

These examples convey the usefulness of global variables and equations. They enabled me to create three functionally unique variations on my original model in a matter of minutes.

How it's done

In SolidWorks, global variables can be derived from mathematical operations/functions and/or other variables.

Here's a simple example. Let's say you want to be able to control the length of the aileron easily, without having to slog through editing sketches. First, navigate to Tools > Equations and define two variables.

"Aileron length"= 10
"Aileron wing cutout"= "Aileron length" + (1/8)

Click "Export" to save the variables externally as a txt file. Then click the checkbox next to "Link to external file" and direct SolidWorks to your txt file. Now, SolidWorks will read the variable values from the txt file.

Now, let's say you already have a part model for the wing and aileron. To use these variables, you must open each part, navigate to Equations, and click "Import" to load the variables from the txt file. This enables you to dimension your sketches using the variables defined in the txt file. This is done in a similar way as in Excel: Smart Dimension the sketch entity, type equals (=), and then type the desired equation, referencing variable names in quotes. Make sure to not link these equations with the txt file. These equations are part-specific; only the variables are global.

When you dimension a part using an equation, the dimension will appear with a red capital sigma next to it. Here's a sketch for of one of my simpler parts, the elevator:

Change the variables as desired in the txt file. If you update parts or entire assemblies by typing Control+Q. SolidWorks uses sophisticated algorithms to look at part dependencies and figure out the logically correct solve order.

As a word of caution, there is nothing preventing you from putting in absurd or geometry-breaking values, like negative distances. It is up to you, the modeler, to clearly know what each parameter is, which parameters it affects, and what its acceptable range is.