import fs from 'fs' import { join } from 'path' import expect from 'expect' import { parseString } from '../../src' const dxfContents = fs.readFileSync( join(__dirname, '/../resources/testHatch.dxf'), 'utf-8', ) describe('HATCH', () => { it('can be parsed', () => { const entities = parseString(dxfContents).entities expect(entities.length).toEqual(1) expect(entities[0]).toEqual({ type: 'HATCH', elevation: { x: 0, y: 0, z: 0, }, extrusionDir: { x: 0, y: 0, z: 1, }, pattern: { length: [], lineCount: 1, angle: 225, x: -662.8253265723428, y: 775.7832757820479, offsetX: 0.0565685424949238, offsetY: -0.0565685424949238, dashCount: 0, }, boundary: { loops: [ { references: [], entities: [ { type: 'LINE', start: { x: 311.015568772401, y: -178.508187265139, }, end: { x: 311.015568772401, y: -155.7081872645399, }, }, { type: 'LINE', start: { x: 311.015568772401, y: -155.7081872645399, }, end: { x: 311.015568772401, y: -155.4081872645397, }, }, { type: 'LINE', start: { x: 311.015568772401, y: -155.4081872645397, }, end: { x: 310.8155687724011, y: -155.4081872645397, }, }, { type: 'LINE', start: { x: 310.8155687724011, y: -155.4081872645397, }, end: { x: 310.8155687724011, y: -155.4081872603497, }, }, { type: 'LINE', start: { x: 310.8155687724011, y: -155.4081872603497, }, end: { x: 311.015568772401, y: -155.4081872603497, }, }, { type: 'LINE', start: { x: 311.015568772401, y: -155.4081872603497, }, end: { x: 311.015568772401, y: -139.2081872302829, }, }, { type: 'LINE', start: { x: 311.015568772401, y: -139.2081872302829, }, end: { x: 310.8155687724011, y: -139.2081872302829, }, }, { type: 'LINE', start: { x: 310.8155687724011, y: -139.2081872302829, }, end: { x: 310.8155687724011, y: -140.508187226093, }, }, { type: 'LINE', start: { x: 310.8155687724011, y: -140.508187226093, }, end: { x: 310.2155687724011, y: -140.508187226093, }, }, { type: 'LINE', start: { x: 310.2155687724011, y: -140.508187226093, }, end: { x: 310.2155687724011, y: -138.9081872260931, }, }, { type: 'LINE', start: { x: 310.2155687724011, y: -138.9081872260931, }, end: { x: 314.7155687717408, y: -138.9081872260931, }, }, { type: 'LINE', start: { x: 314.7155687717408, y: -138.9081872260931, }, end: { x: 314.7360480408058, y: -137.273431183803, }, }, { type: 'LINE', start: { x: 314.7360480408058, y: -137.273431183803, }, end: { x: 314.741195876921, y: -137.1392154754781, }, }, { type: 'LINE', start: { x: 314.741195876921, y: -137.1392154754781, }, end: { x: 314.7274259512182, y: -137.0049997671517, }, }, { type: 'LINE', start: { x: 314.7274259512182, y: -137.0049997671517, }, end: { x: 314.6965983218462, y: -136.8274859325979, }, }, { type: 'LINE', start: { x: 314.6965983218462, y: -136.8274859325979, }, end: { x: 314.692522877388, y: -136.6456407884239, }, }, { type: 'LINE', start: { x: 314.692522877388, y: -136.6456407884239, }, end: { x: 314.7055038329431, y: -136.4897785119779, }, }, { type: 'LINE', start: { x: 314.7055038329431, y: -136.4897785119779, }, end: { x: 314.7055038329431, y: -136.4638006342389, }, }, { type: 'LINE', start: { x: 314.7055038329431, y: -136.4638006342389, }, end: { x: 314.7211054369855, y: -136.3598891232818, }, }, { type: 'LINE', start: { x: 314.7211054369855, y: -136.3598891232818, }, end: { x: 314.7048332193608, y: -136.1520710913578, }, }, { type: 'LINE', start: { x: 314.7048332193608, y: -136.1520710913578, }, end: { x: 314.7178141749159, y: -136.030844321901, }, }, { type: 'LINE', start: { x: 314.7178141749159, y: -136.030844321901, }, end: { x: 314.7145783118914, y: -136.00818727558, }, }, { type: 'LINE', start: { x: 314.7145783118914, y: -136.00818727558, }, end: { x: 314.1155687724005, y: -136.00818727558, }, }, { type: 'LINE', start: { x: 314.1155687724005, y: -136.00818727558, }, end: { x: 314.1155687724005, y: -136.1081872755799, }, }, { type: 'LINE', start: { x: 314.1155687724005, y: -136.1081872755799, }, end: { x: 312.915568772401, y: -136.1081872755799, }, }, { type: 'LINE', start: { x: 312.915568772401, y: -136.1081872755799, }, end: { x: 312.915568772401, y: -136.3081872755811, }, }, { type: 'LINE', start: { x: 312.915568772401, y: -136.3081872755811, }, end: { x: 312.3155687724011, y: -136.3081872755811, }, }, { type: 'LINE', start: { x: 312.3155687724011, y: -136.3081872755811, }, end: { x: 312.3155687724006, y: -135.8081872755797, }, }, { type: 'LINE', start: { x: 312.3155687724006, y: -135.8081872755797, }, end: { x: 313.9655687724005, y: -135.8081872755797, }, }, { type: 'LINE', start: { x: 313.9655687724005, y: -135.8081872755797, }, end: { x: 313.9658746831379, y: -135.7727006520699, }, }, { type: 'LINE', start: { x: 313.9658746831379, y: -135.7727006520699, }, end: { x: 313.9606763897579, y: -135.7233034304641, }, }, { type: 'LINE', start: { x: 313.9606763897579, y: -135.7233034304641, }, end: { x: 313.9632772938154, y: -135.6583018148481, }, }, { type: 'LINE', start: { x: 313.9632772938154, y: -135.6583018148481, }, end: { x: 313.9645742311092, y: -135.6115019870249, }, }, { type: 'LINE', start: { x: 313.9645742311092, y: -135.6115019870249, }, end: { x: 313.9645742311092, y: -135.5608027299759, }, }, { type: 'LINE', start: { x: 313.9645742311092, y: -135.5608027299759, }, end: { x: 313.9632772938154, y: -135.512707543814, }, }, { type: 'LINE', start: { x: 313.9632772938154, y: -135.512707543814, }, end: { x: 313.9619768417866, y: -135.468505109774, }, }, { type: 'LINE', start: { x: 313.9619768417866, y: -135.468505109774, }, end: { x: 313.9666303512087, y: -135.241096273136, }, }, { type: 'LINE', start: { x: 313.9666303512087, y: -135.241096273136, }, end: { x: 313.9699552907201, y: -135.1080015423627, }, }, { type: 'LINE', start: { x: 313.9699552907201, y: -135.1080015423627, }, end: { x: 313.9666303512087, y: -134.8950486377039, }, }, { type: 'LINE', start: { x: 313.9666303512087, y: -134.8950486377039, }, end: { x: 313.9666303512087, y: -134.6488237196277, }, }, { type: 'LINE', start: { x: 313.9666303512087, y: -134.6488237196277, }, end: { x: 313.9599804721857, y: -134.3094331577208, }, }, { type: 'LINE', start: { x: 313.9599804721857, y: -134.3094331577208, }, end: { x: 313.9466771994045, y: -134.1463849346351, }, }, { type: 'LINE', start: { x: 313.9466771994045, y: -134.1463849346351, }, end: { x: 313.9533446521037, y: -133.5247197656208, }, }, { type: 'LINE', start: { x: 313.9533446521037, y: -133.5247197656208, }, end: { x: 313.9533446521037, y: -132.6730483661868, }, }, { type: 'LINE', start: { x: 313.9533446521037, y: -132.6730483661868, }, end: { x: 313.9448354781531, y: -132.2472160050229, }, }, { type: 'LINE', start: { x: 313.9448354781531, y: -132.2472160050229, }, end: { x: 313.9533446521037, y: -131.821383643859, }, }, { type: 'LINE', start: { x: 313.9533446521037, y: -131.821383643859, }, end: { x: 313.9533446521037, y: -131.318898119132, }, }, { type: 'LINE', start: { x: 313.9533446521037, y: -131.318898119132, }, end: { x: 306.2493227293204, y: -131.318898119132, }, }, { type: 'LINE', start: { x: 306.2493227293204, y: -131.318898119132, }, end: { x: 306.2493227293204, y: -215.9280510586818, }, }, { type: 'LINE', start: { x: 306.2493227293204, y: -215.9280510586818, }, end: { x: 314.6355693047227, y: -215.9280510586818, }, }, { type: 'LINE', start: { x: 314.6355693047227, y: -215.9280510586818, }, end: { x: 314.6355693047136, y: -212.6058156960198, }, }, { type: 'LINE', start: { x: 314.6355693047136, y: -212.6058156960198, }, end: { x: 314.4856100363182, y: -212.6023202958868, }, }, { type: 'ARC', center: { x: 250.234983478892, y: -209.6023280493487, }, radius: 64.32062629126939, startAngle: 357.3266852976113, endAngle: 362.673324868837, counterClockWise: true, }, { type: 'LINE', start: { x: 314.4856095040046, y: -206.602324402309, }, end: { x: 314.6355687724009, y: -206.6058198024421, }, }, { type: 'LINE', start: { x: 314.6355687724009, y: -206.6058198024421, }, end: { x: 314.6355687724009, y: -203.6081872671989, }, }, { type: 'LINE', start: { x: 314.6355687724009, y: -203.6081872671989, }, end: { x: 314.4353299027021, y: -203.6081872755799, }, }, { type: 'LINE', start: { x: 314.4353299027021, y: -203.6081872755799, }, end: { x: 314.2837743447287, y: -200.5081872261258, }, }, { type: 'LINE', start: { x: 314.2837743447287, y: -200.5081872261258, }, end: { x: 311.2155687724011, y: -200.5081875463029, }, }, { type: 'LINE', start: { x: 311.2155687724011, y: -200.5081875463029, }, end: { x: 310.2155687724011, y: -200.508187783264, }, }, { type: 'LINE', start: { x: 310.2155687724011, y: -200.508187783264, }, end: { x: 310.2155687724011, y: -198.9081875463039, }, }, { type: 'LINE', start: { x: 310.2155687724011, y: -198.9081875463039, }, end: { x: 310.8155687724011, y: -198.9081875463039, }, }, { type: 'LINE', start: { x: 310.8155687724011, y: -198.9081875463039, }, end: { x: 310.8155687724011, y: -200.2081875421127, }, }, { type: 'LINE', start: { x: 310.8155687724011, y: -200.2081875421127, }, end: { x: 311.015568772401, y: -200.2081875421127, }, }, { type: 'LINE', start: { x: 311.015568772401, y: -200.2081875421127, }, end: { x: 311.015568772401, y: -178.8081872693301, }, }, { type: 'LINE', start: { x: 311.015568772401, y: -178.8081872693301, }, end: { x: 310.8155687724011, y: -178.8081872693301, }, }, { type: 'LINE', start: { x: 310.8155687724011, y: -178.8081872693301, }, end: { x: 310.8155687724011, y: -178.8081872651387, }, }, { type: 'LINE', start: { x: 310.8155687724011, y: -178.8081872651387, }, end: { x: 311.015568772401, y: -178.8081872651387, }, }, { type: 'LINE', start: { x: 311.015568772401, y: -178.8081872651387, }, end: { x: 311.015568772401, y: -178.508187265139, }, }, ], type: 1, count: 68, edgeType: 1, sourceObjects: 0, }, ], count: 1, }, seeds: { count: 1, seeds: [ { x: 309.9488650106455, y: -188.5840791640221, }, ], }, color: {}, handle: '7D', layer: '3 TRAMA SEC. M1', patternName: '_U', fillType: 'PATTERN', style: 1, hatchType: 0, shadowPatternAngle: 225, spacing: 0.08, double: false, }) }) })