@ifc-lite/encoding
v2.0.0
Published
IFC string encoding/decoding and property value parsing for IFC-Lite
Readme
@ifc-lite/encoding
IFC string encoding and decoding, GlobalId (GUID) utilities, and property value parsing. Small, dependency-free helpers for the text-level details of IFC STEP files: the \X2\...\X0\ escape sequences used for non-ASCII characters, the 22-character base64-like IFC GUID format, and typed STEP property values like IFCBOOLEAN(.T.).
Install
npm install @ifc-lite/encodingUsage
import {
decodeIfcString,
encodeIfcString,
generateIfcGuid,
ifcGuidToUuid,
parsePropertyValue,
} from '@ifc-lite/encoding';
decodeIfcString('Gew\\X2\\00E4\\X0\\chshaus'); // 'Gewächshaus' (real umlaut)
encodeIfcString('Tür'); // 'T\\X\\FCr'
const guid = generateIfcGuid(); // 22-char IFC GlobalId
const uuid = ifcGuidToUuid(guid); // standard UUID form
parsePropertyValue(['IFCBOOLEAN', '.T.']); // { displayValue: 'True', ifcType: ... }Exports
decodeIfcString/encodeIfcString: STEP\X2\,\X\,\S\escape handlinggenerateIfcGuid,generateUuid: new identifiersuuidToIfcGuid,ifcGuidToUuid: convert between UUIDs and 22-char IFC GUIDsisValidIfcGuid,isValidUuid: validationparsePropertyValue: turn a parsed STEP property value (typed arrays,.T./.F., enums) into a display string plus optional IFC type name. It does not decode\X2\-style escapes: every ifc-lite parse path already decodes exactly once, at the parse boundary, and decoding a second time would collapse an authored\\a second time. Pass a still-encoded literal throughdecodeIfcStringfirst.
Links
- Docs: https://ifclite.dev/docs/
- Source: https://github.com/LTplus-AG/ifc-lite
License
MPL-2.0
