A VBA macro for SOLIDWORKS that reads the geometry out of a STAAD.Pro .STD input file and rebuilds it as a 3D sketch wireframe (one line per structural member) in a new SOLIDWORKS part.
Useful for quickly bringing a STAAD analysis model into SOLIDWORKS as a reference skeleton — for building out member sections, checking clashes against architectural geometry, or general coordination.
- Parses the
JOINT COORDINATESsection of a.STDfile into joint number → (X, Y, Z). - Parses the
MEMBER INCIDENCESsection into member → (start joint, end joint). - Auto-detects the model's length unit from the file's
UNITcommand and scales everything to meters (SOLIDWORKS' native internal unit). - Opens a new SOLIDWORKS part and draws the full frame as a single 3D sketch.
- Prompts you to pick the
.STDfile via SOLIDWORKS' own file dialog — no hardcoded paths.
- SOLIDWORKS (any recent 64-bit version; developed/tested against 2023+).
- A default part template configured under
Tools > Options > Default Templates(the macro creates a new part from this). - A STAAD
.STDfile using explicit joint/member listings (see Limitations below).
- Download
STAAD_Import_Wireframe.basfrom this repo. - In SOLIDWORKS, open the VBA editor:
Tools > Macro > Edit(orNew, then open the editor). - Import the module:
File > Import File...and selectSTAAD_Import_Wireframe.bas.- Importing (rather than copy/pasting) is recommended — it preserves the file exactly and avoids any manual transcription issues.
- Save the macro (
.swp) wherever you keep your SOLIDWORKS macros.
- Run the macro (
F5, or via the SOLIDWORKS Macro toolbar). - A file picker will open — browse to and select your
.STDfile. - The macro parses the file and reports how many joints/members it found and what length-unit scale factor it used.
- A new part opens with the frame geometry as a single 3D sketch.
A couple of constants near the top of the module can be adjusted:
| Constant | Purpose |
|---|---|
DEFAULT_BROWSE_FOLDER |
Folder the file picker opens in first. Leave "" to use the default/last-used location. |
AUTO_DETECT_UNITS |
True (default) auto-scales from the file's UNIT command. Set False to force a manual scale instead. |
MANUAL_SCALE_TO_METERS |
Used only when AUTO_DETECT_UNITS = False. E.g. 0.3048 if your file is in feet. |
STAAD's input syntax is flexible, and this parser covers the common explicit-listing case rather than every generation shorthand STAAD supports:
REPEAT/REPEAT ALLcoordinate generation is not expanded — joints created this way won't be picked up. Expand them to explicit coordinates in STAAD first if needed.- Member incidence linear-generation shorthand (e.g.
1 1 2 5meaning "auto-generate members 1 through 5") is not expanded. If your file uses this, expand incidences to explicitmember start endtriples in STAAD before running the macro, or the parser will misalign and produce incorrect connectivity. - Only straight frame members are imported — plates, solids, surfaces, and curved members are ignored.
If the resulting geometry looks wrong, check in this order:
- The scale factor reported in the completion message box (unit mismatch is the most common issue).
- Whether your file uses either of the generation shortcuts above.
- The file is read as plain text, and STAAD's trailing
-line-continuation syntax is merged into single logical lines before parsing. - Within the
JOINT COORDINATESandMEMBER INCIDENCESblocks, every token is filtered down to numeric values only (this transparently strips section keywords, semicolons treated as separators, etc.) and then grouped into fixed-size chunks — 4 per joint, 3 per member. - Joints are stored in a
Scripting.Dictionarykeyed by joint number for O(1) lookup when resolving member endpoints. - Geometry is drawn using
SketchManager.Insert3DSketch+CreateLine, which SOLIDWORKS' API expects in meters regardless of document units — hence the unit-scaling step. - The file picker uses SOLIDWORKS' own
ISldWorks::GetOpenFileName, rather than a raw Win32 API call, for reliability across versions and machine configurations.
Issues and pull requests welcome — in particular, expanding support for STAAD's generation shorthand (REPEAT, member-incidence auto-generation) would be a valuable addition. If you hit a parsing issue, please include a redacted snippet of the relevant JOINT COORDINATES / MEMBER INCIDENCES section that reproduces it.
Add a license of your choice (e.g. MIT) — none is specified by default.
This is an unofficial, community tool and is not affiliated with or endorsed by Bentley Systems (STAAD.Pro) or Dassault Systèmes (SOLIDWORKS). Always visually verify imported geometry against your source model before relying on it.