Skip to content

Latest commit

 

History

History
85 lines (63 loc) · 2.21 KB

README.md

File metadata and controls

85 lines (63 loc) · 2.21 KB

IxMilia.Step

A portable .NET library for reading and writing STEP CAD files.

Build Status

Usage

Open a STEP file:

using System.IO;
using IxMilia.Step;
using IxMilia.Step.Items;
// ...

//------------------------------------------------------------ read from a file
StepFile stepFile;
using (FileStream fs = new FileStream(@"C:\Path\To\File.stp", FileMode.Open))
{
    stepFile = StepFile.Load(fs);
}

// if on >= NETStandard1.3 you can use:
// StepFile stepFile = StepFile.Load(@"C:\Path\To\File.stp");

//---------------------------------------------- or read directly from a string
StepFile stepFile = StepFile.Parse(@"ISO-10303-21;
HEADER;
...
END-ISO-103030-21;");
//-----------------------------------------------------------------------------

foreach (StepRepresentationItem item in stepFile.Items)
{
    switch (item.ItemType)
    {
        case StepItemType.Line:
            StepLine line = (StepLine)item;
            // ...
            break;
        // ...
    }
}

Save a STEP file:

using System.IO;
using IxMilia.Step;
using IxMilia.Step.Items;
// ...

StepFile stepFile = new StepFile();
stepFile.Items.Add(new StepDirection("direction-label", 1.0, 0.0, 0.0));
// ...

//------------------------------------------------------------- write to a file
using (FileStream fs = new FileStream(@"C:\Path\To\File.stp", FileMode.Create))
{
    stepFile.Save(fs);
}

// if on >= NETStandard1.3 you can use
// stepFile.Save(@"C:\Path\To\File.stp");

//------------------------------------------------------- or output as a string
string contents = stepFile.GetContentsAsString();

Building locally

Requirements to build locally are:

sudo apt-get install dotnet-sharedframework-microsoft.netcore.app-1.0.3

Specification

Using spec from steptools.com here.

STEP Application Protocols here.