Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
three-dxf-viewer
Advanced tools
DXF viewer made using dxf parser and threejs. It generates a threejs object that can be used in any scene. It also has some utility classes such as a merger and a snap helper.
npm install three-dxf-viewer
To use it just initialize the main class and launch getFromFile
or getFrompath
methods.
// Suppose we have a font in our application
let font = 'fonts/helvetiker_regular.typeface.json';
// Suppose we have a file input and a loading div
var file = event.target.files[0];
// Get all the geometry generated by the viewer
let dxf = await new DXFViewer().getFromFile( file, font );
// Add the geometry to the scene
scene.addDXF( dxf );
For a more detailed explanation, there is an example on how to use the viewer. To launch it just run:
npm run dev
The application will be available on http://localhost:8080
There are 2 utilities that can be used optionally with the viewer:
Merger class can merge all entities to optimize drawing big DXF files.
import { Merger } from 'three-dxf-viewer/utils/Merger';
let dxf = await new DXFViewer().getFromPath( dxfFilePath, fontPath );
const mergedObject = new Merger().merge( dxf );
scene.add( mergedObject );
There is an example on how to use it in the main example file in /example/index.js.
Snaps classes can store all the vertices in an efficient way to in the scene.
import { Merger } from 'three-dxf-viewer/utils/Merger';
let dxf = await new DXFViewer().getFromPath( dxfFilePath, fontPath );
let snaps = new Snapshelper( dxf, renderer, scene, camera, controls );
There is an example on how to use it in the main example file in /example/index.js.
FAQs
DXF viewer using ThreeJS
The npm package three-dxf-viewer receives a total of 72 weekly downloads. As such, three-dxf-viewer popularity was classified as not popular.
We found that three-dxf-viewer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.