0.1.3 • Published 3 years ago
dxf-composer v0.1.3
dxf-composer
A simple DXF generation library.
Usage
Install
yarn add dxf-composer
Import
import { DxfDocument, DxfBlock } from 'dxf-composer';
Entities
Document
const dxfDocument = new DxfDocument(units);
Basic Entities
dxfDocument.addLine(x1, y1, x2, y2, layer);
dxfDocument.addCircle(x, y, radius, layer);
dxfDocument.addArc(x, y, radius, startAngle, endAngle, layer);
Compound Entity Helpers
dxfDocument.addRectangle(width, depth, x, y, layer);
dxfDocument.addRoundedRectangle(width, depth, radius, x, y, layer);
Dimensions
dxfDocument.addAlignedDimension(x1, y1, x2, y2, extX, extY, textX, textY, layer);
dxfDocument.addSimpleAlignedDimension(x1, y1, x2, y2, 'up', layer);
dxfDocument.addDiameterDimension(x1, y1, x2, y2, textX, textY, layer);
dxfDocument.addSimpleDiameterDimension(x, y, diameter, angle, layer);
Blocks
const dxfBlock = new DxfBlock('aBlock');
dxfBlock.addRectangle(width, depth, x, y, layer);
dxfDocument.addBlock(dxfBlock);
dxfDocument.addBlockReference('aBlock', x, y, layer);
Generate
const dxfString = dxfDocument.toString();
Development
Project setup
yarn install
Compiles for development
yarn dev
Compiles and hot-reloads for development
yarn watch
Compiles and minifies for production
yarn prod