Every SOLIDWORKS weldment tutorial starts with “Insert Structural Member” and assumes the profile library is already populated. It never explains where those profiles actually live, what format they use, or what to do when the profile you need isn’t there. If you’re trying to automate weldment creation via a VBA macro, the API reference assumes you already have the profile path, which means you need to know the folder structure before you can write a single line of code.
This covers the actual file format, where the profiles are stored on disk, how to add custom profiles, where to get additional standards, and a complete working VBA macro using InsertStructuralWeldment5.
What Weldment Profiles Actually Are
The terminology causes confusion: forum threads and older tutorials refer to weldment profiles as .swp files. This is incorrect. SOLIDWORKS weldment profiles use the .SLDLFP extension — SolidWorks Library Feature Part. The .swp extension is used for SOLIDWORKS macro swap files (a different, unrelated thing).
A .SLDLFP file is a regular SolidWorks part file (it opens as a .SLDPRT) saved in the Library Feature Part format. It contains a single 2D sketch that defines the structural section cross-section. The sketch is constrained relative to the origin, which becomes the insertion point when SOLIDWORKS extrudes the profile along a path segment. The file is not encrypted or proprietary — you can open any .SLDLFP in SOLIDWORKS to inspect or modify the cross-section sketch.
When you select a profile in Insert Structural Member, SOLIDWORKS reads the sketch from the .SLDLFP file, extrudes it along the selected path segment(s), and creates a solid body. If you select multiple segments grouped into one structural member, SOLIDWORKS handles the miter and butt joint geometry at intersections.
Where Profiles Live on Disk
The default weldment profile library is installed in the SOLIDWORKS install directory under a language-specific subfolder:
[SOLIDWORKS Install Dir]\lang\[language]\weldment profiles\
On a typical Windows installation with SOLIDWORKS 2024:
C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\lang\english\weldment profiles\
The library is organized in three levels:
weldment profiles\
├── ANSI Inch\
│ ├── C Channel\
│ │ ├── C10x15.3.SLDLFP
│ │ ├── C10x20.SLDLFP
│ │ └── ...
│ ├── W Section\
│ ├── L Angle\
│ ├── Pipe (standard, S40)\
│ ├── Tube (square)\
│ ├── Tube (rectangular)\
│ └── ...
├── ISO\
│ ├── c channel\
│ ├── Circular Tube\
│ ├── L Angle (equal)\
│ ├── Tube (square)\
│ └── ...
├── DIN\
├── BSI\
└── AS\
The Standard folder (ANSI Inch, ISO, DIN, BSI, AS) appears in the Structural Member property manager’s Standard dropdown. The Type subfolder (C Channel, W Section, etc.) maps to the Type dropdown. The individual .SLDLFP files are the size entries in the Size dropdown.
ANSI Inch includes these section types:
Al CS Channel (squared ends), Al Channel (standard), Al I Beam, Al L Angle (rounded ends), C Channel, HP Section, L Angle, M Section, MC Channel, MT Section, Pipe (X strong, S80), Pipe (XX strong), Pipe (standard, S40), S Section, ST Section, Tube (rectangular), Tube (square), W Section, WT Section
The ISO library includes metric equivalents: Circular Tube, L Angle (equal), L Angle (unequal), SC Beam, T Section, Tube (rectangular), Tube (square), etc.
When Profiles Are Missing — Adding a Custom Path
SOLIDWORKS may ship with only a subset of the full profile library, or you may need profiles from a standard that isn’t installed. The profile lookup path is configurable.
Go to Tools > Options > System Options > File Locations, then select Weldment Profiles from the dropdown. You’ll see the current profile search paths. Add any folder you want SOLIDWORKS to treat as a profile library root — the folder structure below that root must follow the same Standard\Type\Size.SLDLFP pattern.
For network environments with shared profile libraries, add the network path here and ensure all users have read access. The path is saved in the user’s SolidWorks settings (sldworks.ini), not in the document — so each user needs to add the custom path on their machine (or via a group policy registry push).
Downloading Additional Weldment Profiles
SOLIDWORKS ships profiles for ANSI, ISO, DIN, BSI, and AS. If you need profiles for other regional standards, or larger/smaller size ranges within existing standards, there are a few sources:
SOLIDWORKS Content downloads (official): Log into the SOLIDWORKS Customer Portal with your active subscription. Under Downloads > Optional Add-ons or Content, look for Weldment Profiles packages. Dassault releases periodic content updates that expand size ranges and add regional standard variants.
SOLIDWORKS Forum and GitHub communities: The SOLIDWORKS user community has shared profiles for European EN standards, AISC structural steel sections, and custom tube/pipe series. Search the SOLIDWORKS Forum for “weldment profiles download” filtered by year — old threads often have attachments with complete library folders.
Create from scratch: For a non-standard section or a proprietary profile (custom extrusion, company-specific tube), create the profile yourself:
- Create a new SolidWorks part
- Edit Sketch 1 on Plane1 (the default XY sketch)
- Draw the cross-section. The Origin is the insertion point — center it on the origin for typical structural profiles.
- Fully constrain the sketch with dimension constraints
- Close the sketch without adding any 3D features
- File > Save As → set type to Lib Feat Part (*.sldlfp)
- Save into your custom profiles folder under the appropriate
Standard\Type\path
SOLIDWORKS reads the first sketch in the part file as the cross-section profile. If the file has multiple sketches, SOLIDWORKS uses Sketch1. If you want to offer multiple configurations (e.g., different wall thicknesses for the same nominal size), add configurations with different sketch dimensions — the InsertStructuralWeldment5 API accepts a configuration name as a parameter.
VBA Macro to Insert a Structural Weldment Member
The API for inserting structural members uses IFeatureManager.InsertStructuralWeldment5 (added in SOLIDWORKS 2016, Revision 24.0). This is the current version — InsertStructuralWeldment through InsertStructuralWeldment4 are older signatures with fewer parameters. Always use version 5 for new code.
Signature:
Function InsertStructuralWeldment5( _
ByVal Path As String, _
ByVal ConnectedSegmentsOption As Integer, _
ByVal AllowProtrusion As Boolean, _
ByVal Groups As Object, _
ByVal ConfigurationName As String _
) As Feature
Parameters:
- Path: Full path to the
.SLDLFPprofile file - ConnectedSegmentsOption: Member of
swConnectedSegmentsOption_e—0for None,1for Natural,2for Along Sketch Normal - AllowProtrusion: Whether member bodies can protrude past path endpoints
- Groups: Array of
IStructuralMemberGroupobjects (one group per set of co-planar sketch segments) - ConfigurationName: Configuration name in the profile file, or
""for standard profiles with no configurations
Before calling InsertStructuralWeldment5, you need to set up at least one IStructuralMemberGroup and assign sketch segments to it. The group controls how segments are oriented and trimmed.
Complete working macro:
Option Explicit
Sub InsertWeldmentMember()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeatMgr As SldWorks.FeatureManager
Dim swSelMgr As SldWorks.SelectionMgr
Dim swGroup As SldWorks.StructuralMemberGroup
Dim swSkSeg As SldWorks.SketchSegment
Dim swFeat As SldWorks.Feature
Dim groups(0) As Object
Dim segs(0) As Object
Dim profilePath As String
Dim swDir As String
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
If swModel Is Nothing Then
MsgBox "Open a weldment part first."
Exit Sub
End If
Set swFeatMgr = swModel.FeatureManager
Set swSelMgr = swModel.SelectionManager
' Build the profile path from the SOLIDWORKS install directory.
' swApp.GetExecutablePath returns the full path to SLDWORKS.exe;
' trim the exe filename to get the directory.
swDir = Left(swApp.GetExecutablePath(), InStrRev(swApp.GetExecutablePath(), "\") - 1)
profilePath = swDir & "\lang\english\weldment profiles\ANSI Inch\C Channel\C10x20.SLDLFP"
If Dir(profilePath) = "" Then
MsgBox "Profile not found at:" & vbCrLf & profilePath & vbCrLf & _
"Check the path and adjust for your installed standard."
Exit Sub
End If
' Select the sketch segment to use as the structural member path.
' Replace "Line1@Sketch1" with the actual sketch segment name in your model.
swModel.ClearSelection2 True
Dim bRet As Boolean
bRet = swModel.Extension.SelectByID2("Line1@Sketch1", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
If Not bRet Then
MsgBox "Could not select 'Line1@Sketch1'. Check the sketch and segment name."
Exit Sub
End If
' Get the selected sketch segment from the selection manager.
Set swSkSeg = swSelMgr.GetSelectedObject6(1, -1)
If swSkSeg Is Nothing Then
MsgBox "GetSelectedObject6 returned Nothing. Ensure the selection succeeded."
Exit Sub
End If
' Clear the selection (InsertStructuralWeldment5 reads segments from the Groups array,
' not from the active selection at call time).
swModel.ClearSelection2 True
' Create a structural member group and assign the segment.
Set swGroup = swFeatMgr.CreateStructuralMemberGroup()
segs(0) = swSkSeg
swGroup.Segments = segs
' Optional group properties:
' swGroup.Angle = 0 ' Rotation angle in radians
' swGroup.LocateProfilePoint = 0 ' 0 = Centroid, 1 = custom point
' swGroup.ApplyCornerTreatment = False
groups(0) = swGroup
' Insert the structural weldment feature.
' ConnectedSegmentsOption = 0 (swConnectedSegmentsOption_e.swConnectedSegments_None)
' Use 1 (Natural) or 2 (Along Sketch Normal) when segments in the group are connected end-to-end.
Set swFeat = swFeatMgr.InsertStructuralWeldment5( _
profilePath, _
0, _
False, _
groups, _
"" _
)
If Not swFeat Is Nothing Then
swModel.GraphicsRedraw2
MsgBox "Structural member created: " & swFeat.Name
Else
MsgBox "InsertStructuralWeldment5 returned Nothing." & vbCrLf & _
"Possible causes:" & vbCrLf & _
"- Profile path invalid or file not found" & vbCrLf & _
"- Sketch segment not a valid path (must be a line or arc)" & vbCrLf & _
"- Active document is not a Weldment part (check weldment toolbar)"
End If
End Sub
Key notes on this macro:
Profile path construction:
swApp.GetExecutablePath()returns the full path toSLDWORKS.exe. Stripping the filename gives the SOLIDWORKS install directory. This is more reliable than hardcodingC:\Program Files\SOLIDWORKS Corp\SOLIDWORKSbecause the install path varies between machines and SOLIDWORKS versions.Segment selection: The macro uses
SelectByID2with type"SKETCHSEGMENT"to select a sketch segment by its name (visible in the FeatureManager tree under the sketch). The name format is"SegmentName@SketchName". Use Tools > Evaluate > Measure on a segment to see its actual name.Groups vs Segments: Each
IStructuralMemberGroupholds a set of colinear or connected sketch segments. For a frame with multiple path lines, you typically want one group per connected chain of segments (SOLIDWORKS handles miter/butt joints at connection points within a group). For disconnected segments of the same section type, create multiple groups.ConnectedSegmentsOption: Use
0(None) for a single isolated segment. Use1(Natural) for connected segments sharing endpoints — SOLIDWORKS then calculates joint geometry automatically.ConfigurationName: Pass
""for standard library profiles (they have no named configurations). For custom profiles where you saved multiple sizes as configurations in one.SLDLFPfile, pass the configuration name string (e.g.,"HSS4x4x0.25").
Reading the Profile Path from an Existing Weldment Feature
For automation scripts that need to read back what profile a structural member uses, access IStructuralMemberFeatureData.WeldmentProfilePath:
Sub ReadWeldmentProfilePath()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeat As SldWorks.Feature
Dim swData As SldWorks.StructuralMemberFeatureData
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
' Walk all features looking for structural members
Set swFeat = swModel.FirstFeature()
Do While Not swFeat Is Nothing
If swFeat.GetTypeName2() = "StructuralWeldment" Then
Set swData = swFeat.GetDefinition()
If Not swData Is Nothing Then
swData.AccessSelections swModel, Nothing
Debug.Print swFeat.Name & ": " & swData.WeldmentProfilePath
swData.ReleaseSelectionAccess
End If
End If
Set swFeat = swFeat.GetNextFeature()
Loop
End Sub
IStructuralMemberFeatureData.WeldmentProfilePath returns the full path to the .SLDLFP file for each structural member. Useful for auditing whether a weldment uses the correct library profiles or custom files.
Why the Macro Returns Nothing
The most common failure mode with InsertStructuralWeldment5 is a Nothing return with no error message. Check these in order:
The active document is not configured as a Weldment part. A weldment part requires the Weldment feature at the top of the feature tree. If you created a regular part and tried to add structural members, SOLIDWORKS may reject them. Use Insert > Weldments > Weldment first to add the Weldment feature.
The profile path is wrong.
InsertStructuralWeldment5returnsNothingsilently if the path doesn’t resolve to a valid.SLDLFPfile. The macro above adds aDir()check, but verify the path manually first by pasting it into Explorer.The sketch segment wasn’t properly selected before
CreateStructuralMemberGroup. The group’sSegmentsproperty needs actualISketchSegmentobjects. IfGetSelectedObject6returnedNothing, the segment array passed to the group is invalid.The sketch is not a weldment sketch. Only sketches created within a Weldment part’s context produce valid path segments for structural members. A regular 3D Sketch or regular Sketch should work, but the Weldment feature must be present in the FeatureManager tree above the sketch.
For more complex structural automation — batch-inserting multiple member types across a frame sketch, automating trim/extend operations, or exporting the cut list to BOM — the pattern from this macro extends naturally into larger pipelines. If you’re already running this kind of SolidWorks VBA automation at scale, see the SolidWorks macro recorder limitations guide for what the recorder silently drops (the structural member workflow is one of its biggest gaps), and the SolidWorks workflow automation hub for where VBA macros fit relative to Task Scheduler, PDM Dispatch, and full C# add-ins.