diff --git a/src/Metadata/LookupTables/Entities.ts b/src/Metadata/LookupTables/Entities.ts index b1e9f8d..a3e91c0 100644 --- a/src/Metadata/LookupTables/Entities.ts +++ b/src/Metadata/LookupTables/Entities.ts @@ -1256,6 +1256,52 @@ export const metadataLookupEntities: readonly ClassMetadata[] = [ "dxfName": "LINE", "dxfSubClassName": "AcDbLine" }, + { + "typeName": "LwPolyline", + "baseTypeName": "Entity", + "properties": [ + { + "propertyName": "constantWidth", + "valueCodes": [ + 43 + ], + "referenceType": 0 + }, + { + "propertyName": "elevation", + "valueCodes": [ + 38 + ], + "referenceType": 0 + }, + { + "propertyName": "flags", + "valueCodes": [ + 70 + ], + "referenceType": 0 + }, + { + "propertyName": "normal", + "valueCodes": [ + 210, + 220, + 230 + ], + "referenceType": 0 + }, + { + "propertyName": "thickness", + "valueCodes": [ + 39 + ], + "referenceType": 0 + } + ], + "systemVariables": [], + "dxfName": "LWPOLYLINE", + "dxfSubClassName": "AcDbPolyline" + }, { "typeName": "Mesh", "baseTypeName": "Entity", diff --git a/tests/IO/DXF/DxfReader.test.ts b/tests/IO/DXF/DxfReader.test.ts index 7efba15..957fe31 100644 --- a/tests/IO/DXF/DxfReader.test.ts +++ b/tests/IO/DXF/DxfReader.test.ts @@ -4,6 +4,7 @@ import { DxfReader } from '../../../src/IO/DXF/DxfReader.js'; import { ACadVersion } from '../../../src/ACadVersion.js'; import { DxfBinaryReader } from '../../../src/IO/DXF/DxfStreamReader/DxfBinaryReader.js'; import { encodeCadString, getDecoderEncodingLabel } from '../../../src/IO/TextEncoding.js'; +import { LwPolyline } from '../../../src/Entities/LwPolyline.js'; const dxfAsciiFiles = getDxfAsciiFiles(); const dxfBinaryFiles = getDxfBinaryFiles(); @@ -122,6 +123,41 @@ describe('DxfReaderTests', () => { expect(streamReader.find('layer-säöü')).toBe(true); }); + it('ReadLwPolylineSubclassFields', () => { + const data = createAsciiDxf([ + '0', 'SECTION', + '2', 'HEADER', + '9', '$ACADVER', + '1', 'AC1015', + '0', 'ENDSEC', + '0', 'SECTION', + '2', 'ENTITIES', + '0', 'LWPOLYLINE', + '5', '1F', + '100', 'AcDbEntity', + '8', '0', + '100', 'AcDbPolyline', + '90', '2', + '70', '1', + '38', '5.0', + '39', '2.0', + '43', '0.5', + '10', '0.0', '20', '0.0', + '10', '10.0', '20', '0.0', + '0', 'ENDSEC', + '0', 'EOF', + ], 'ANSI_1252'); + + const doc = new DxfReader(data).read(); + const polyline = [...doc.entities].find(e => e instanceof LwPolyline) as LwPolyline; + + expect(polyline.vertices.length).toBe(2); + expect(polyline.isClosed).toBe(true); + expect(polyline.elevation).toBe(5); + expect(polyline.thickness).toBe(2); + expect(polyline.constantWidth).toBe(0.5); + }); + describe.each(dxfAsciiFiles.map(f => [f.fileName, f]))('ASCII: %s', (_name, test) => { it('ReadHeaderAscii', () => { const data = readFileAsUint8Array(test.path);