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.Dwg

Part.Dwg

Part.Dwg holds the complete 2D representation of a sheet-metal part after it has been unfolded from its 3D model (or imported directly from a flat format such as DXF). It is an instance of Drawing2 — a container that stores every geometric and semantic element of the flat blank.

File: Core/Drawing/Drawing.cs — class Drawing2

The Big Picture

Drawing2
 ├── AList<Layer2>     Layers      ← named groups with display and semantic roles
 ├── AList<Entity2>    Entities    ← all geometry and annotation
 │    ├── E2Pline[]               ← contours  (blank outline, holes, slots …)
 │    ├── E2Bendline[]            ← bend marks (where to fold, at what angle)
 │    ├── E2Point[]               ← pierce points, forming centres, approach markers
 │    ├── E2Text[]                ← text labels, part numbers, engrave text
 │    ├── E2Insert[]              ← block references (DXF blocks / sub-assemblies)
 │    ├── E2Spline[]              ← free-form spline curves (from DXF)
 │    └── E2Dimension[]           ← dimension annotations
 ├── List<Block2>      Blocks      ← reusable block definitions (referenced by E2Insert)
 └── List<FormInfo>    FormInfos   ← 3D press-form metadata (from .geo import)

Every entity knows which Layer2 it lives on. The layer carries both display information (colour, line type, visibility) and a semantic role (EUse) that tells the rest of the system how to treat the entity — whether to cut it, mark it, skip it for nesting, etc.

Drawing2 — Top-Level Properties

File: Core/Drawing/Drawing.cs

Property Type Meaning

Entities

AList<Entity2>

All geometry and annotation in the drawing

Layers

AList<Layer2>

All layers; every entity belongs to one

Blocks

List<Block2>

Reusable block definitions (referenced by E2Insert)

FormInfos

List<FormInfo>

Press-form metadata from imported .geo files

Owner

Part

Back-reference to the owning Part

Bound

Bound2

Bounding box of all non-auxiliary entities

Area

double

Net enclosed area (outer minus holes), in mm²

Centroid

Point2

Centre of gravity of the flat blank

AreBendsSequenced

bool

Whether bend-lines have been put in processing order

BaseTileMarker

Point2

Hint used to keep the base plane stable across fold operations

Computed Shape Properties

Property Meaning

OuterPline

The single outer boundary contour (throws if there is more than one)

OuterPlines

All outer boundary contours (for multi-body drawings)

OuterPlinesStd

Outer contours relevant to CAM (excludes auxiliary layers)

ClosedPlines

All closed E2Pline entities (outer + holes)

OpenPlines

All open E2Pline entities (approach paths, etch lines)

Bendlines

All E2Bendline entities

NarrowestFlange

Width of the narrowest flange (used for tool selection)

Size

Width × height of the pline bounding box

Layers — Layer2

File: Core/Drawing/DwgAux.cs — class Layer2

A Layer2 is a named group. Every entity in the drawing belongs to exactly one layer. Layers serve two purposes: display (colour, line style) and semantics (what this entity is used for).

Property Type Meaning

Name

string

Layer name, e.g. "Cut", "Bend", "Mark", "Footprint"

Color

Color32

Default display colour for entities on this layer

LineType

ELType

Line style: Continuous, Dot, Dash, DashDot …

Use

EUse

Semantic role (see table below)

Visible

bool

Whether entities on this layer are shown

Locked

bool

Prevents accidental editing

Layer2.EUse — Semantic Roles

EUse Meaning

Std

Normal layer — geometry here is cut by laser or punch

Aux

Auxiliary / construction — ignored by CAM and nesting

MBend

Mountain (upward) bend lines

VBend

Valley (downward) bend lines

Inner

Used for inside/outside classification only — not tooled

Outer

Used for inside/outside classification only — not tooled

Mark

Engrave / mark — not cut through; becomes a laser marking path

ApproachMarker

User-placed point that locks where the laser enters the contour

SequenceMarker

Text marker that forces a specific cutting order

FormCenter

Centre point or small L-mark of a press-form feature

FormFootprint

Outline (footprint) of a press-form feature; moved to auxiliary during CAM

CutTooling

Approach and exit paths generated by laser tooling; not rendered in the 2D view

Evaporate

Path to be evaporated (very light laser pass, no kerf)

DotMarking

Path to be dot-punched (Trumpf marking method)

Info

Informational — shown in reports but not tooled

Tooling

Tooling outlines created by Flux or MetaCAM

Note
Auxiliary is a computed property that returns true for Aux, ApproachMarker, SequenceMarker, FormCenter, and Info. Auxiliary entities are excluded from bounding-box computation, nesting outlines, and most CAM operations.

The Entity Hierarchy

File: Core/Drawing/2DEntity.cs — class Entity2 (abstract base)

Every object in Drawing2.Entities inherits from Entity2. The base class provides:

Property / Method Type Meaning

UID

int

Stable numeric identity assigned when added to the drawing

Layer

Layer2

The layer this entity belongs to

Color

Color32

Per-entity colour override (Nil means use the layer colour)

Flags

E2Flags

Bitfield of entity-level state (see below)

Dwg

Drawing2

Back-reference to the owning drawing

Bound

Bound2

Axis-aligned bounding box (abstract — each subtype computes its own)

XForm(m)

—

Transform the entity by a Matrix2 (rotate, translate, scale)

E2Flags — Per-Entity State Bits

Flag Meaning

Selected

Entity is currently selected in the editor

Error

This entity has a problem (e.g. a bend-line with non-collinear points)

IllFormed

Structural defect: odd number of bend-line points, or degenerate geometry

PreBent

Bend-line was already bent by a punch press before this operation

PostBent

Bend-line is processed after the current bend sequence

FoldTooled

Bend-line has been assigned to a panel-bender operation

BendOnBaseplane

Bend-line connects directly to the base plane

RadiusLocked

Bend radius was set explicitly and must not be auto-adjusted

ZCoining

This is a Z-bend with coining

BevelCut

Contour has a chamfered (bevel) edge from a .geo import

SkipLaserTooling

Contour is on the back face and must not receive laser tooling

E2Pline — Contours

File: Core/Drawing/2DEntity.cs — class E2Pline

E2Pline is by far the most common entity. It wraps a Pline — a 2D polyline made of line and arc segments.

Property Type Meaning

Pline

Pline

The underlying geometric contour

HighQualitySegments

List<int>?

Indexes of segments that must not be simplified during cleanup

The Pline itself carries the geometry:

Property Type Meaning

Segs

Segment[]

Line and arc segments that make up the contour

IsClosed

bool

Whether the contour is a closed loop

IsOuter

bool

Outer boundary (true) vs. hole (false) — set by PrepareForCAM

Bound

Bound2

Axis-aligned bounding box

Area

double

Enclosed area (positive; holes subtract from the part area)

How Inner and Outer Is Determined

Drawing2.PrepareForCAM() calls DoQuickMarkInOut() (or DoSlowMarkInOut() for complex drawings). The algorithm sorts all closed plines by descending area and marks a pline as IsOuter = true if it is not contained inside any other outer pline.

The largest closed pline that is not contained inside another closed pline becomes the outer blank boundary. Every closed pline that lies inside the outer boundary is a hole (IsOuter = false).

What Contours Are in the Drawing

Contour Origin

Outer blank boundary

Unfolded from E3Plane.Contours via Unfolder.AddPlaneLoops

Holes and cutouts

Unfolded from inner contours of E3Plane faces, or imported from DXF

Open paths (slots, etch)

Imported from DXF, or from markings on the 3D model

Approach paths

Added by LaserAutotooler on layer CutTooling

E2Bendline — Bend Marks

File: Core/Drawing/2DEntity.cs — class E2Bendline

An E2Bendline marks where the part will be bent. It stores all the parameters a press-brake or panel-bender needs to reproduce the bend from the flat blank.

Property Type Meaning

Pts

Point2[]

The bend-line path as pairs of points (always an even count)

Angle

double

Exterior bend angle in radians (+ve = valley / up, −ve = mountain / down)

InteriorAngle

double

Interior angle (π − |Angle|) — what most operators measure

Radius

double

Inner bend radius in mm

Thickness

double

Sheet thickness (copied from Part.Thickness)

KFactor

double

Neutral fibre ratio (default 0.35; affects flat-width calculation)

FlatWidth

double

Width of the deformed zone in the flat blank

Deduction

double

Bend deduction (how much shorter the flat is vs. the unfolded length)

SeqNo

short

Bend sequence number (1 = first bend, set after sequencing)

Kind

EKind

Type of bend (see below)

PunchName

string?

Name of the assigned punch tool (filled after bend tooling)

DieName

string?

Name of the assigned die (filled after bend tooling)

Airgap

float

Air gap used by the panel-bender (filled after fold tooling)

PrebendAngle

double

Angle of first phase in a two-phase bend (0 = single phase)

BumpCount

short

Number of bumps for a step-bend (> 1 = bump-bend)

Moniker

string?

Tag name from CAD system (used by Boost / MetaCAM)

IsPreBent

bool

Already bent by a punch press — skip in press-brake sequence

IsPostBent

bool

Processed after the current sequence

PairedFlex

E3Flex?

The matching 3D bend element (looked up by UID)

E2Bendline.EKind — Bend Types in the Drawing

Kind Meaning

Std

Normal air bend (most common)

Coining

High-pressure coining bend

OpenHem

Fold back with a gap

ClosedHem

Fold flat onto itself

FlatBend

Two-phase helper bend to avoid tool collision

ZBendHalf

One half of a Z-bend pair

ZBend

Synthesised Z-bend (two parallel ZBendHalf merged together)

DoubleSheetBendHalf

One half of a double-sheet bend

How Bend-Line Points Work

Pts always has an even number of entries. Each pair [i, i+1] is one contiguous segment of the bend line. A bend line that is interrupted by a hole will have multiple segments (4 or 6 points). The segments are always collinear — they all lie on the same straight line.

// Iterate bend-line segments:
for (int i = 0; i < bendline.Pts.Length; i += 2) {
    Point2 start = bendline.Pts[i];
    Point2 end   = bendline.Pts[i + 1];
    // draw or process this segment
}

Connection Back to the 3D Model

Every E2Bendline has the same UID as the E3Flex that produced it during unfolding. This lets the system navigate in both directions:

// From drawing → 3D model:
E3Flex flex = bendline.PairedFlex;     // looks up by UID in Part.Model

// From 3D model → drawing:
E2Bendline bl = drawing.Bendlines
    .FirstOrDefault(b => b.UID == flex.BendlineUID);

E2Point — Points

File: Core/Drawing/2DEntity.cs — class E2Point

A single 2D point. Its meaning depends on its layer:

Layer use Meaning

Std

Generic point (forming centre, pierce reference)

ApproachMarker

User-locked laser entry point for the nearest contour

FormCenter

Centre of a press-form feature

CutTooling

Pierce point generated by laser tooling (a PointCut step)

Property Type Meaning

Pt

Point2

The 2D coordinate

Mode

EPDMode

Display mode override (cross, circle, etc.)

Tag

object?

Arbitrary user data attached by tooling algorithms

E2Text — Text Labels

File: Core/Drawing/E2Text.cs — class E2Text

Text labels are stored as E2Text entities. During PrepareForCAM, text on non-auxiliary layers is converted to E2Pline contours so it can be laser-engraved or marked.

Property Type Meaning

Text

string

The text content

Pt

Point2

Insertion point

Height

double

Character height in mm

Fontname

string

Vector font name

Angle

double

Text rotation in radians

Alignment

ETextAlign

Horizontal and vertical alignment

A common use is embedding part metadata that ExplodeDrawing can read back:

// Text format understood by ExplodeDrawing:
"PN: MyPartNumber"       // sets Part.Info.Name
"THICKNESS: 2.0"         // sets a custom property in Part.Info.Dict

E2Insert — Block References

File: Core/Drawing/2DEntity.cs — class E2Insert

E2Insert is an instance of a reusable Block2. Blocks come from DXF imports or from assembly drawings. An insert stores a position, rotation, and scale; the actual geometry lives in the block definition.

Property Type Meaning

Block

Block2

The block definition (looked up by name from Drawing2.Blocks)

Pt

Point2

Insertion point

Angle

double

Rotation angle in radians

XScale

double

Horizontal scale factor (negative = mirrored)

YScale

double

Vertical scale factor

Xfm

Matrix2

Computed combined transform matrix

E2Insert.Explode() replaces the insert with copies of the block’s entities transformed into drawing space. Drawing2.ExplodeDrawing() uses this to split an assembly drawing into individual parts.

E2Spline — Spline Curves

File: Core/Drawing/2DEntity.cs — class E2Spline

Wraps a Spline2 (B-spline or NURBS curve) imported from DXF. Splines are discretised to line segments when needed for nesting or tooling.

Property Type Meaning

Spline

Spline2

The underlying spline curve

Block2 — Reusable Geometry Definitions

File: Core/Drawing/DwgAux.cs — class Block2

A Block2 is a named, reusable group of entities — the same concept as a DXF block or AutoCAD block reference.

Property Type Meaning

Name

string

Block name (used to look it up from Drawing2.Blocks)

Base

Point2

Origin point of the block

Entities

List<Entity2>

The geometry inside the block

FormInfo — Press-Form Metadata

File: Core/Drawing/Drawing.cs — class FormInfo

When a part is imported from a .geo file that contains press-form features, their 3D metadata is stored in Drawing2.FormInfos.

Property Type Meaning

Position

Point3

3D position of the form feature on the part

Angle

double

Rotation angle of the form punch

Mesh

Mesh3

3D mesh of the formed shape (for visualisation)

OnBackFace

bool

Whether the form is applied from the underside

PunchName

string

Name of the punch tool that creates this form

DieName

string

Name of the die

DuringBending

bool

Whether this form is applied at the same time as bending

Internal State Flags (EFlags)

Drawing2 tracks its own preparation state with an internal EFlags bitfield. These flags prevent redundant work when CAM algorithms call PrepareForCAM multiple times:

Flag Meaning

OrientedCCW

All closed plines have been oriented counter-clockwise

InOutMarked

IsOuter has been computed for all plines

CleanedPlines

Duplicate nodes and collinear segments have been removed

SingleOuter

There is exactly one outer pline (fast path for tooling)

BendSequenced

Bend-lines carry a valid SeqNo processing order

BendAnnotated

Bend-lines have been updated with punch/die names from BendTech

FoldAnnotated

Bend-lines have been updated with air-gap from FoldTech

PreprocessForCAM

Counter-sinks identified, text converted to plines

PrepareForCAM — Making the Drawing Ready for Tooling

Before laser tooling (or any CAM operation) reads the drawing, PrepareForCAM() is called. It runs a sequence of normalisation steps, each guarded by a flag so it only runs once:

PrepareForCAM()
 ├── DoCleanupPlines()         — remove degenerate segments, collinear nodes
 ├── SplitCircleToArcInOpenPlines() — convert full circles in open plines to two arcs
 ├── DoOrientCCW()             — ensure all closed plines wind counter-clockwise
 ├── DoQuickMarkInOut()        — mark IsOuter for simple drawings (one outer pline)
 │    └─ DoSlowMarkInOut()     — fallback for multi-outer drawings
 └── DoCAMPreprocessing()
      ├── Identify counter-sinks (concentric circles) → move outer to FormFootprint layer
      └── Convert E2Text on cut layers → E2Pline (so they can be laser-engraved)

Complete Memory Layout

Drawing2
 │
 ├── Layers: [Layer2, Layer2, …]
 │    each: Name, Color, LineType, EUse (Std/Aux/Mark/CutTooling/…), Visible, Locked
 │
 ├── Entities: [Entity2, Entity2, …]
 │
 │   ┌─ E2Pline ──────────────────────────────────────────────────────────┐
 │   │  Layer → Layer2 (e.g. Std = to be cut)                             │
 │   │  Flags → E2Flags.BevelCut, SkipLaserTooling, …                    │
 │   │  UID   → stable int used by tooling to find its cut steps          │
 │   │  Pline → Segment[] (lines + arcs)                                  │
 │   │           IsOuter, IsClosed, Bound, Area                           │
 │   └────────────────────────────────────────────────────────────────────┘
 │
 │   ┌─ E2Bendline ───────────────────────────────────────────────────────┐
 │   │  Pts[]    → pairs of Point2 (each pair = one bend fragment)        │
 │   │  Angle    → exterior bend angle (radians, ± = valley/mountain)     │
 │   │  Radius   → inner bend radius (mm)                                 │
 │   │  Thickness → sheet thickness                                       │
 │   │  KFactor  → neutral-fibre ratio (default 0.35)                     │
 │   │  FlatWidth → developed width of bent zone                          │
 │   │  Deduction → bend deduction                                        │
 │   │  SeqNo    → processing order (1 = first)                           │
 │   │  Kind     → Std / Coining / Hem / ZBend / …                        │
 │   │  PunchName, DieName → set by BendTech after tooling                │
 │   │  Airgap   → set by FoldTech after tooling                          │
 │   │  UID      → same as paired E3Flex.BendlineUID in the 3D model      │
 │   └────────────────────────────────────────────────────────────────────┘
 │
 │   ┌─ E2Point ──────────────────────────────────────────────────────────┐
 │   │  Pt    → Point2 coordinate                                         │
 │   │  Layer → ApproachMarker / FormCenter / CutTooling / …              │
 │   └────────────────────────────────────────────────────────────────────┘
 │
 │   ┌─ E2Text ───────────────────────────────────────────────────────────┐
 │   │  Text, Pt, Height, Fontname, Angle, Alignment                      │
 │   │  Converted to E2Pline during PrepareForCAM if on a cut layer       │
 │   └────────────────────────────────────────────────────────────────────┘
 │
 │   ┌─ E2Insert ─────────────────────────────────────────────────────────┐
 │   │  Block → Block2 (look up by name from Drawing2.Blocks)             │
 │   │  Pt, Angle, XScale, YScale → placement transform                   │
 │   └────────────────────────────────────────────────────────────────────┘
 │
 │   ┌─ E2Spline ─────────────────────────────────────────────────────────┐
 │   │  Spline → Spline2 (NURBS / B-spline from DXF)                      │
 │   └────────────────────────────────────────────────────────────────────┘
 │
 ├── Blocks: [Block2, …]
 │    each: Name, Base (Point2), Entities (List<Entity2>)
 │
 └── FormInfos: [FormInfo, …]
      each: Position, Angle, Mesh, PunchName, DieName, OnBackFace, DuringBending

Key Files

File Responsibility

Core/Drawing/Drawing.cs

Drawing2 class — container, PrepareForCAM, in/out marking

Core/Drawing/2DEntity.cs

Entity2 base, E2Pline, E2Bendline, E2Point, E2Insert, E2Spline, E2Solid

Core/Drawing/E2Text.cs

E2Text — text labels

Core/Drawing/DwgAux.cs

Layer2, Block2, Layer2.EUse — layers and block definitions

Core/Drawing/Dimension.cs

E2Dimension — dimension annotations

Core/Model/Ops/Unfolder.cs

Produces the drawing from a 3D model

Contents

  • The Big Picture
  • Drawing2 — Top-Level Properties
  • Computed Shape Properties
  • Layers — Layer2
  • Layer2.EUse — Semantic Roles
  • The Entity Hierarchy
  • E2Flags — Per-Entity State Bits
  • E2Pline — Contours
  • How Inner and Outer Is Determined
  • What Contours Are in the Drawing
  • E2Bendline — Bend Marks
  • E2Bendline.EKind — Bend Types in the Drawing
  • How Bend-Line Points Work
  • Connection Back to the 3D Model
  • E2Point — Points
  • E2Text — Text Labels
  • E2Insert — Block References
  • E2Spline — Spline Curves
  • Block2 — Reusable Geometry Definitions
  • FormInfo — Press-Form Metadata
  • Internal State Flags (EFlags)
  • PrepareForCAM — Making the Drawing Ready for Tooling
  • Complete Memory Layout
  • Key Files
Part Part.Load

      Copyright © 2025 TRUMPF Metamation. All rights reserved.

    Compiled by Bento