Working with .sat and .sab Files in Teigha

Alex Rumjantsev
October 03, 2017

Tags: getting started geometry conversion

Native and modified .sat and .sab file versions

Standard ACIS Text (SAT) and Standard ACIS Binary (SAB) are file formats supported by 3D ACIS Modeler developed by Spatial Corporation. Spatial Corp. SAT® format is a text format and can be viewed by a text editor. SAB format is a compact version of the SAT format.

Teigha uses .sat and .sab files to define 3D geometry of 3D entities (OdDbRegion, OdDbBody, OdDb3dSolid, OdDbSurface, etc.).

The following table contains information about default SAT and SAB format versions used in different versions of .dwg and .dxf files.

R14 release 106
R15 (2000) release 400
R18 (2004) release 20800
R21 (2007) release 21200
R24 (2010) release 21500
R27 (2013) release 21800

And the following enum is a list of all SAT and SAB format versions that Teigha supports.

enum AfTypeVerEnum
{
  kAfVer105            = 105,
  kAfVer106            = 106,
  kAfVer107            = 107,
  kAfVer200            = 200,
  kAfVer201            = 201,
  kAfVer400            = 400,
  kAfVer500            = 500,
  kAfVer600            = 600,
  kAfVer700            = 700,
  kAfVer20800          = 20800,
  kAfVer21200          = 21200,
  kAfVer21500          = 21500,
  kAfVer21600          = 21600,
  kAfVer21700          = 21700,
  kAfVer21800          = 21800
};

It’s very important to note that versions up to 700 are compatible with Spatial Corp. ACIS®. Versions from 20800 and higher cannot be used inside the Spatial ACIS library without additional conversions. From 20800, Autodesk® AutoCAD® uses modified SAT and SAB formats, and these modified versions are not native to Spatial ACIS. All native Spatial ACIS SAT and SAB formats with versions higher than 700 are also incompatible with .dwg and .dxf file formats and cannot be used in Teigha as-is.

image1

A typical solution for exchanging 3D geometry data between Teigha and Spatial ACIS is to use version 7 as an intermediate. So get version 700 from Teigha and use it with Spatial ACIS. Or downgrade the Spatial ACIS version to 700 and use it with Teigha.

Accessing SAT and SAB data streams in Teigha

This static method loads .sat and .sab files and returns an array of entities.

static OdResult OdDbBody::acisIn(const OdString& filename, OdDbEntityPtrArray& solids);

Why does it return an array and not a single entity? A single .sat/.sab file can contain more than one 3D body. But .dwg files are limited to one 3D entity with one .sat/.sab file containing a single body. So the input of .sat/.sab files is checked for a count of bodies and a set of 3D entities is created according to the type of bodies in the .sat/sab file. The output array includes the set of 3D entities (OdDbRegion, OdDbBody, OdDb3dSolid, OdDbSurface, etc.). Importing wire bodies is not supported.

The symmetrical method to export 3D data in SAT and SAB format is:

static OdResult OdDbBody::acisOut(const OdString& filename, const OdDbEntityPtrArray& solids, AfTypeVer typeVer = kAfVer700|kAfTypeASCII);

There is an alternative way to get and set 3D data. Each 3D entity class has non-static methods with direct access to SAT and SAB data. These methods can be used only for valid data processing. For example:

OdResult OdDbRegion::acisIn(OdStreamBuf* pStreamBuf, AfTypeVer *typeVer = 0);
OdResult OdDbRegion::acisOut(OdStreamBuf* pStreamBuf, AfTypeVer typeVer = kAfTypeVerAny);

Example

OdaMFCApp is the main Teigha viewer sample application, and it contains an .sat/.sab helper. To start the helper, right-click an AcDb3dSolid object in the database.

image2

You can load and save .sat/.sab files, get SAT and SAB data from 3D entities, and create new 3D entities from .sat/.sab files.

image3

 

All posts