npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dxf-viewer-hatch

v1.0.5

Published

JavaScript DXF file viewer with hatch support (Fork of dxf-viewer)

Downloads

82

Readme

DXF viewer with Hatch Support and Block Detection npm

This package is a fork of the original dxf-viewer with added support for hatches and a block detection system.

If you just need to view your DXF, click here.

This package provides an enhanced DXF 2D viewer component written in JavaScript. It renders drawings using WebGL (via three.js library). It was carefully crafted with performance in mind, intended for drawing huge real-world files without performance problems.

New Features

  • Hatch Support: This fork adds support for rendering hatch patterns in DXF files.
  • Block Detection System: Users can now click on elements in the drawing to get information about the associated block.

Install

npm install dxf-viewer-hatch

Features

  • File fetching, parsing and preparation for rendering is separated in such a way that it can be easily off-loaded to web-worker using provided helpers. So the most heavy-weight processing part does not affect UI responsiveness.
  • Geometry batching - minimal number of rendering batches is created during file processing, thus minimizing total required number of draw calls.
  • Instanced rendering - features which are rendered multiple times with different transforms (e.g. DXF block instances) are rendered by a single draw call using instanced rendering WebGL feature.
  • Multiple fonts support. List of fonts can be specified for text rendering. Raw TTF files are supported. Fonts are lazy-loaded, once a character encountered which glyph is not yet available through already loaded fonts, next font is fetched and checked for the necessary glyph.
  • Layers - layers are taken into account when creating rendering batches so that they can be easily hidden/shown.
  • Hatch support - rendering of hatch patterns in DXF files.
  • Block detection - ability to click on elements and get information about associated blocks.

Usage

import DxfViewer from 'dxf-viewer-hatch';

// Initialize viewer
const options = {
    autoResize: true,
    colorCorrection: true,
    sceneOptions: {
      wireframeMesh: true,
    },
  };
 const dxfViewer = new DxfViewer(
      canvasContainerRef.current,
      options,
    );

// Load and render DXF file
 await dxfViewer.Load({
        url: fileUrl,
        fonts,
        progressCbk: handleProgress,
        workerFactory: createWorker,
      });

Contributing

Contributions to this fork are welcome. Please refer to the contribution guidelines for details on how to make pull requests (PRs). The project also requires various example files for testing purposes. If you encounter any issues with DXF rendering, it would be greatly appreciated if you could provide an example file that demonstrates the problem by attaching it to a created issue. License This project is licensed under the terms of the Mozilla Public License 2.0. Acknowledgements This package is a fork of the original dxf-viewer by Artyom Lebedev. We are grateful for their work which made this enhanced version possible.