Mechanical Engineering

CAD & SolidWorks

Designing parts the way engineers do: parametric models that update when a dimension changes.

SolidWorks is a parametric 3D CAD program from Dassault Systèmes, widely used in mechanical engineering. You sketch a profile, add dimensions and constraints, then build the part with features such as extrude, revolve and fillet.

Because every dimension is a parameter, changing one number updates the whole model, its drawing and every assembly that uses it. Try it on the bracket below.

What SolidWorks covers

  • Parametric parts
  • Assemblies & mates
  • Sheet metal
  • Weldments
  • Surfacing
  • Drawings & GD&T
  • Simulation (FEA)
  • Design tables & configurations

File types

.SLDPRTPart
.SLDASMAssembly
.SLDDRWDrawing

Parametric bracket

Change a dimension and the drawing, the 3D shape and the mass all update, the way a SolidWorks model rebuilds.

Volume -   Mass -

Dimensions in mm

From idea to part

01

Sketch

Draw a 2D profile and fix it with dimensions and constraints.

02

Features

Turn sketches into solids: extrude, revolve, sweep, loft, fillet, hole.

03

Assembly

Combine parts with mates (coincident, concentric, distance) and check motion and fit.

04

Drawing

Make manufacturing drawings with views, dimensions, tolerances and GD&T.

05

Simulation

Check stress, deflection and vibration with finite element analysis (FEA).

06

Manufacture

Export for CNC machining, 3D printing, sheet metal or casting.

CAD automation

CAD programs can be automated, so repeated work is done by a script instead of by hand. SolidWorks offers several levels, from no code at all to full programming.

01

Equations and global variables

Link dimensions with formulas. Change one number and the whole model follows.

02

Configurations and design tables

One part, many sizes. An Excel table lists the sizes and SolidWorks builds each version.

03

Macro recorder

Record your clicks, save them as VBA code, then edit and replay them.

04

The SolidWorks API

Write code in VBA, VB.NET, C# or C++ to create parts, change dimensions, make drawings and export files.

05

Add-ins

Packaged tools that add their own buttons and panels. Companies use them to check designs and fill in title blocks.

06

Simulation and PDM automation

The same idea reaches simulation studies and the PDM file vault: run tests and manage files by script.

A tiny macro
' SolidWorks macro (VBA): set a dimension and rebuild
Sub main()
    Dim swApp As Object, part As Object, dimn As Object
    Set swApp = Application.SldWorks
    Set part = swApp.ActiveDoc
    Set dimn = part.Parameter("D1@Sketch1")
    dimn.SystemValue = 0.15      ' the API uses metres: 0.15 = 150 mm
    part.EditRebuild3
End Sub

Run it with a part open. Names like D1@Sketch1 come from the dimension you clicked. Always try macros on a copy of the file.

What automation is good for

  • Making dozens of versions of one part from a table.
  • Exporting hundreds of files to PDF, STEP or DXF.
  • Checking drawings for missing notes or empty title blocks.
  • Filling title blocks and bills of materials from a spreadsheet.
  • Repeating the same rebuild or measurement on many models.

Other CAD programs can be scripted too

  • Autodesk Inventor: iLogic rules
  • Fusion: Python and C++ API
  • AutoCAD: AutoLISP and .NET
  • FreeCAD: Python
  • Onshape: FeatureScript
  • OpenSCAD: CAD written as code

Where to start: use equations and design tables first. Use a macro when you repeat the same clicks. Use the API when you want a proper tool.

Engineering calculators

Four small tools engineers use every day. Change a number and everything updates.

Gear pair

Compression spring

Beam deflection

Shaft and hole fit (ISO 286)

Fit

Values from the ISO 286 tables. Always check the standard for production drawings.

Let’s build something

Looking for an intern or have a project idea? Get in touch.

kenith [at] kenith.net