Metamation Developer Notes

  • Developer Notes
  • Resource Map
  • Tools
    • Code Formatting
    • Configuring Git
    • Assignments
    • Testing with Windows Sandbox
    • Single Binary Applications
    • Self-Updating Applications
  • Flux Workflow
    • Flux Workflow
    • Flux Development Style Guide
    • Release notes for Flux
    • SonarCloud analysis for Flux
    • Build a Flux SDK Program
    • Shipping Flux
    • Flux.Test
      • BasicBendAuto Test
      • LaserAuto.cs Detailed Documentation
      • Laserexample:Test1
  • Technical Notes
    • File formats
      • .FX File Format
      • Au(Gold) streams
      • .GEO File Format
      • .LST File Format
      • .LST file - technology
      • .BNC File Format
      • .WAD Files: Flux Resource Packages
      • .Curl Files: ASCII config information
    • Folders App
      • Data\Bendtools
      • Data\Machines
    • FluxCode
      • Welcome & Repo Map
      • Architecture & System Context
      • Subsystem *Bend* (Press Brake)
      • Subsystem *BCell* (Bend Cell Automation)
      • API Maps
      • Data Model Catalog
      • Design Patterns -- A Reader's Guide
      • Tests and Golden Paths
      • Guided Code Tours
      • CAM Glossary with Code Mapping
      • Assignments
      • Flux Onboarding Handbook
    • Data flow
      • Part
        • Part.Dwg
        • Part.Load
        • Part.Load to Part.Dwg
      • BendTech.cs
      • Bend Technology
      • Laser Cutting Technology
    • LTS (Long term support mechanism)
    • Machine ID Scheme
  • FluxTester
    • Commands and Scripts
    • Command Cookbook
    • Script Commands
    • BendTooling.cs Test Inventory
    • LaserTooling.cs Test Steps
    • Fluxtester Recipe Book
    • Nesting.cs Overview
    • Nesting.cs Recipe Book
    • Job.cs Overview
    • Job.cs Recipe Book
  • Software license
  • 3d party software
    • Python
  • Documentation
    • Bento documentation
      • Structure of a Bento page
      • Attributes
    • Software
      • Software Requirement
      • Installation
      • Git workflow for documentation contributors
    • Quick start guide
    • Workflow
      • Roles and responsibilities
      • Analyze
      • Edit
      • Proofread
      • Pre-Publish
      • Publish
      • Release cycle
      • Information required for Documentation Team
      • Checklist for Documenters
    • Styleguide
    • Flavoring
    • Translation
      • Ordering translation for a new document
    • Citations
    • Annotation
Technical Notes
/
Data flow
/
Part
/
Part.Load

Part.Load

Part.Load is the SDK entry point for reading a sheet-metal part from disk. It accepts any file format that Flux understands, returns a fully constructed Part object, and leaves manufacturing calculations to the caller.

File: Core/Part/Part.cs — static method Part.Load(string filename)

1. Prerequisite — Library.Init

Part.Load requires the Flux library to be initialised before it is called. Library.Init loads the WAD resource packages and verifies the licence. Calling Part.Load before Library.Init results in undefined behaviour.

Library.Init(sDataDir, sWadDir, null);   // must come first
var part = Part.Load(filename);

The third argument to Library.Init is the application’s main window handle — pass null for console applications, a Window instance for WPF applications.

For licence handling during initialisation see the APIInit pattern used in every SDK sample:

static void APIInit() {
    try {
        Library.Init(sDataDir, sWadDir, null);
    } catch (APIException e) {
        if (e.Code == EResult.NoLicense) {
            // Prompt user for serial / name / email, then call Library.RegisterLicense.
            // ...
            Environment.Exit(exitCode);
        }
    }
}

static readonly string sDataDir = "C:/FluxSDK/Data", sWadDir = "C:/FluxSDK/Bin";

2. Signature

public static Part Part.Load(string filename)
Parameter Type Meaning

filename

string

Absolute or relative path to the source file. The extension determines which loader is used.

return

Part

A fully constructed Part object. The set of populated properties depends on the file format (see below).

The method throws if the file does not exist, the format is unrecognised, or the file is corrupt.

3. Supported File Formats

The format is detected from the file extension. Part.KnownFileTypes returns the complete list of extensions recognised by the installed build:

// Build an OpenFileDialog filter string from all supported types.
// Each entry has the form "Description|*.ext".
string filter = string.Join(";", Part.KnownFileTypes.Select(x => x.After('|')));

Common formats:

Extension Format

.fx

Flux native format — ZIP archive containing AU-serialised part data. Produced by Part.SaveFX(). Preserves everything the part contains.

.geo

Flux text format for 2D flat drawings. Contains geometry, material, thickness, and bend marks but no 3D model.

.dxf

AutoCAD Drawing Exchange Format. Flat 2D drawings; layers map to drawing roles.

.pdf

PDF vector outlines imported as a 2D flat drawing.

.iges / .igs

3D surface or solid geometry imported as a surface model.

.step / .stp

3D solid geometry imported as a surface model.

4. What Gets Populated

The properties populated on the returned Part depend entirely on what the file contains. No manufacturing data is computed automatically — all Make* methods must be called explicitly after loading.

Property .fx .geo .dxf .iges / .step

Part.Info (name, material, thickness)

yes

yes

partial

no

Part.Dwg (2D flat drawing)

yes

yes

yes

no

Part.Model (3D folded model)

if saved

no

no

no

Part.BendTech

if saved

no

no

no

Part.FoldTech

if saved

no

no

no

Part.CutTech

if saved

no

no

no

Part.SurfaceModel

if saved

no

no

yes

A .geo or .dxf file always yields a Dwg and never a Model. A .iges or .step file yields a SurfaceModel and nothing else — both Dwg and Model must be derived via post-load operations (see below).

5. Post-Load Operations

Part.Load does not call any manufacturing algorithms. Callers must explicitly request whatever representations or tooling they need:

Method What it produces

part.FoldTo3D()

Derives Part.Model from Part.Dwg — folds the flat drawing into a 3D model. Required before MakeBendTech or MakeFoldTech if only a flat file was loaded.

part.UnfoldTo2D()

Derives Part.Dwg from Part.Model — unfolds the 3D model into a flat drawing. Required before MakeCutTech or saving as DXF/GEO if only an FX with a 3D model was loaded.

part.SheetMetalize()

Derives Part.Model from Part.SurfaceModel — converts imported 3D geometry to a sheet-metal model. Call before FoldTo3D / UnfoldTo2D when loading IGES or STEP.

part.MakeBendTech(machine)

Generates Part.BendTech — press-brake tooling for the part.

part.MakeFoldTech(machine)

Generates Part.FoldTech — panel-bender tooling for the part.

part.MakeCutTech(machine)

Generates Part.CutTech — laser or punch tooling for the flat drawing.

The call graph for the most common starting points:

File loaded as flat 2D (geo, dxf)
 └── Part.Load(file)
      ├── part.Dwg          ← ready immediately
      ├── part.FoldTo3D()   ← derive 3D model from Dwg
      │    ├── part.Model   ← now available
      │    ├── part.MakeBendTech(mac)
      │    └── part.MakeFoldTech(mac)
      └── part.MakeCutTech(mac)

File loaded as 3D surface (iges, step)
 └── Part.Load(file)
      ├── part.SurfaceModel ← ready immediately
      ├── part.SheetMetalize()
      │    └── part.Model   ← now available
      └── part.UnfoldTo2D()
           └── part.Dwg     ← now available

File loaded as native (fx)
 └── Part.Load(file)
      ├── part.Info, Dwg, Model, *Tech ← as saved in the file
      ├── part.FoldTo3D()   ← only if Model is null
      └── part.UnfoldTo2D() ← only if Dwg is null

6. Common Patterns

6.1. Read metadata only

var part = Part.Load(file);
Console.WriteLine($"Name:      {part.Info.Name}");
Console.WriteLine($"Material:  {part.Info.Matl.DisplayName}");
Console.WriteLine($"Thickness: {part.Info.Thickness}");

6.2. Convert to another 2D format

var part = Part.Load(file);
part.Dwg.SaveDXF(Path.ChangeExtension(file, ".dxf"));   // GEO → DXF
part.Dwg.SaveGEO(Path.ChangeExtension(file, ".geo"));   // DXF → GEO

6.3. Save as native Flux format

var part = Part.Load(file);          // any supported format
part.SaveFX(Path.ChangeExtension(file, ".fx"));

6.4. Generate press-brake tooling

var part = Part.Load(file);
if (part.Model == null) part.FoldTo3D();   // ensure 3D model exists
part.MakeBendTech(BendMachine.Default);
var tech = part.BendTech;

6.5. Generate laser tooling

var part = Part.Load(file);
part.UnfoldTo2D();                          // ensure flat drawing exists
part.MakeCutTech(sDefaultCutMac);
var tech = part.CutTech;

6.6. View in a WPF editor

var part = Part.Load(filename);
part.UnfoldTo2D();
if (part.Dwg != null) part.FoldTo3D();     // derive 3D from Dwg if possible
_ = new PartEditor(part, PartEditor.ESkin.Model);

7. KnownFileTypes

Part.KnownFileTypes is a static property that returns all file type descriptors recognised by the current build, in file-dialog filter format:

IEnumerable<string> Part.KnownFileTypes

Each element has the form "Description|.ext1;.ext2", matching the Filter property of a standard OpenFileDialog:

// All supported types, PDF excluded.
static string PartFileTypes
    => string.Join(";", Part.KnownFileTypes.Select(x => x.After('|')))
             .Replace("*.pdf;", "");

8. Result After Part.Load

Part.Load(filename)
 │
 ├── Info           ← name, material, thickness, grain, GUID
 │
 ├── Dwg            ← 2D flat drawing (null if 3D-only file)
 │    ├── E2Pline[]     outer contour + holes + features
 │    └── E2Bendline[]  bend marks with angle, radius, k-factor
 │
 ├── Model          ← 3D folded model (null unless .fx contains one)
 │    ├── E3Plane[]     flat faces
 │    └── E3Flex[]      bends connecting faces
 │
 ├── SurfaceModel   ← raw imported surfaces (iges/step only, otherwise null)
 │
 └── BendTech / FoldTech / CutTech
                    ← null unless restored from .fx; call Make*() to generate

9. Key Files

File Responsibility

Core/Part/Part.cs

Part.Load(), SaveFX(), FoldTo3D(), UnfoldTo2D(), SheetMetalize(), MakeBendTech(), MakeFoldTech(), MakeCutTech()

Core/FX.cs

FX.LoadPart() — internal dispatcher that routes the filename to the correct loader

Core/IO/GeoLoader.cs

Parses the .geo text format into a Drawing2

Core/IO/DxfLoader.cs

Parses DXF into a Drawing2

Base/Gold/AuStream.cs

AU deserialiser — reads the binary object graph inside .fx entries

Core/Part/PartInfo.cs

PartInfo — name, material, thickness, and metadata dictionary

Core/Model/Drawing2.cs

Drawing2 — the 2D flat representation

Core/Model/Model3.cs

Model3 — the 3D folded representation

Contents

  • 1. Prerequisite — Library.Init
  • 2. Signature
  • 3. Supported File Formats
  • 4. What Gets Populated
  • 5. Post-Load Operations
  • 6. Common Patterns
  • 6.1. Read metadata only
  • 6.2. Convert to another 2D format
  • 6.3. Save as native Flux format
  • 6.4. Generate press-brake tooling
  • 6.5. Generate laser tooling
  • 6.6. View in a WPF editor
  • 7. KnownFileTypes
  • 8. Result After Part.Load
  • 9. Key Files
Part.Dwg Part.Load to Part.Dwg

      Copyright © 2025 TRUMPF Metamation. All rights reserved.

    Compiled by Bento