You spend ten minutes configuring the DXF export dialog — turning on bend lines, setting the layer map, choosing which sketch entities to include. You close SolidWorks. You open it the next morning and every checkbox is back to the default. Again.

This is one of the most reliably frustrating behaviors in SolidWorks, and it has a specific technical reason that most documentation skips over. More importantly, there are three concrete fixes — ranging from a template trick to a four-line API call — that eliminate the problem entirely.

What actually lives where

The Save As → DXF dialog mixes together two categories of settings: ones that persist and ones that don’t.

Settings that DO persist between sessions:

  • DXF version (R12, R2004, R2013) — stored in user registry under HKCU\Software\SolidWorks\SolidWorks 20XX\UserPreferences
  • Output coordinate system selection
  • Whether multi-sheet drawings produce one file or multiple files

Settings that DON’T persist:

  • Entity type checkboxes (sketch entities, bend lines, form features, hidden sketch entities)
  • The active layer mapping template
  • Construction geometry and hidden layer inclusion

The entity checkboxes in the flat pattern export dialog are session-state only. They default from a hardcoded bitmask in the SolidWorks session — swExportFlatPatternOptions_e.swExportFlatPattern_IncludeBendLines is on by default, sketch entities depend on the document type. SolidWorks does not write these back to user preferences when you dismiss the dialog. This is by design — the dialog is intended for per-export overrides, not global defaults.

Understanding this distinction is the starting point for fixing it.

Fix 1: Layer mapping templates

Layer mapping templates (.ldm files) are the one persistent piece of the export configuration that SolidWorks actually saves properly. They control which SolidWorks layer gets mapped to which DXF layer name — critical for laser-cutting workflows where the cutter reads layers to determine cut vs. etch vs. score operations.

To create a persistent layer map:

  1. Open any sheet metal part and go to File → Save As → DXF
  2. In the dialog, click Map to open the layer mapping editor
  3. Configure your layer assignments (bend lines, outer profile, sketch entities, etc.)
  4. Click Save and name the .ldm file in a shared network location

The template path is then loaded automatically if you set it as the default in your SolidWorks installation configuration. More reliably, you specify it explicitly in your export script — which brings us to Fix 2.

Fix 2: The ExportFlatPatternView API

IModelDocExtension.ExportFlatPatternView gives you complete control over every entity option, with no dialog. You set the bitmask programmatically, and the result is the same every time, regardless of what the last session had in memory.

using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;

public static bool ExportFlatPatternDxf(PartDoc swPart, string outputPath, string layerMapPath)
{
    IModelDocExtension ext = ((ModelDoc2)swPart).Extension;

    // Build options bitmask
    int options =
        (int)swExportFlatPatternOptions_e.swExportFlatPattern_IncludeBendLines |
        (int)swExportFlatPatternOptions_e.swExportFlatPattern_IncludeSketchEntities |
        (int)swExportFlatPatternOptions_e.swExportFlatPattern_IncludeGeometry;

    // Export: layerMapPath="" uses current session map; specify .ldm path for a persistent map
    bool success = ext.ExportFlatPatternView(
        outputPath,         // full path to output .dxf
        options,            // entity bitmask
        layerMapPath,       // path to .ldm file, or "" for current session settings
        true,               // include bodies: all flat-pattern bodies
        true,               // include hidden sketch entities
        0,                  // sheet number (0 = current)
        0                   // configuration index (0 = current)
    );

    return success;
}

The full swExportFlatPatternOptions_e enum values from SolidWorks interop:

ConstantValueEffect
swExportFlatPattern_IncludeGeometry1Export flat pattern profile edges
swExportFlatPattern_IncludeBendLines2Include bend line entities
swExportFlatPattern_IncludeSketchEntities4Include user sketch entities
swExportFlatPattern_IncludeHiddenSketchEntities8Include hidden sketch entities
swExportFlatPattern_IncludeLibraryFeatureGeometry16Include library feature geometry
swExportFlatPattern_IncludeFormFeatures32Include form feature outlines
swExportFlatPattern_ShowBendDirectionAndAngle64Add bend direction notes
swExportFlatPattern_IncludeSketches128Export 3D sketch projected to flat
swExportFlatPattern_SingleFile256All configurations to one file
swExportFlatPattern_MultipleFiles512One file per configuration

A typical laser-cutting export uses options 1 + 2 + 4 = 7 (geometry + bend lines + sketch entities). A shop that uses form features for embossing marks adds 32. A shop that wants explicit bend angle callouts adds 64.

This bitmask is the ground truth. Whatever the dialog shows is just a GUI reflecting a session-local copy of this value. Setting it via API ignores the dialog entirely.

Fix 3: Embed defaults in document templates

For teams that primarily export via the Save As dialog (rather than via API or add-in), the most durable fix is to bake the defaults into the SolidWorks part template (.SLDPRT).

SolidWorks reads certain sheet metal properties and export hints from the document-level model, including the active layer mapping template. If you set the layer map in a template file and save it, new parts created from that template inherit the setting.

Steps:

  1. Open a blank sheet metal part (your standard template)
  2. Configure the DXF export settings as desired in File → Save As → DXF — set the layer map, configure entities
  3. Close the dialog without exporting (click Cancel)
  4. Save the part as your template: File → Save As → Part Template (*.PRTDOT)

The layer mapping selection propagates into new documents. The entity checkboxes still won’t persist across sessions — they remain session-state — but the layer map will load from the template, which is usually the higher-value setting for laser workflows.

Why the dialog isn’t designed to save those checkboxes

The entity checkbox behavior is intentional. SolidWorks treats the Save As DXF dialog as a per-export override tool, not a global preference editor. The reasoning: different bodies in the same part may need different export configurations (one body goes to a laser cutter that needs bend lines, another body goes to a waterjet house that explicitly doesn’t want bend lines as separate entities). Having a global persistent state would interfere with that per-export flexibility.

For teams with consistent workflows — same material, same downstream equipment, same layer requirements every time — this design is a mismatch. The API approach and the template approach exist precisely to impose consistency despite the dialog’s session-local behavior.

The add-in approach: eliminating the dialog entirely

If you’re running batch exports across dozens or hundreds of parts, you shouldn’t be touching the Save As dialog at all. The dialog is single-part, session-dependent, and blocking. An in-process add-in or a standalone API script calls ExportFlatPatternView with a fixed bitmask and a pinned layer map path. Every export is identical.

CadShift takes this approach — the export settings are configured once in the add-in options, not per-session in a dialog. Bend line trimming, sketch entity inclusion, layer mapping, and DXF version are all set in the add-in preferences and applied consistently across every part in a batch.

For a comparison of what add-in batch export handles vs. what VBA macro approaches struggle with, see SolidWorks batch DXF export tools compared. For the underlying entity settings themselves — what each option actually controls and the silent defaults that cause problems — see our DXF entity export settings guide.

Takeaways

  • Entity checkboxes in the DXF dialog are session-state only — they do not persist to user preferences. This is by design.
  • DXF version and coordinate system DO persist via user registry preferences, so those settings are sticky.
  • Layer mapping templates (.ldm files) are the right tool for persistent layer configuration — save them to a shared location and reference them explicitly in your export script.
  • ExportFlatPatternView with an explicit bitmask is the cleanest fix: you set the options in code, they never depend on dialog state, and results are reproducible.
  • For batch workflows, skip the dialog entirely. Call ExportFlatPatternView from an in-process add-in with a fixed configuration. That’s the only approach that scales past a few dozen parts.