Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dxf-viewer

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dxf-viewer

JavaScript DXF file viewer

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
decreased by-37.63%
Maintainers
1
Weekly downloads
 
Created
Source

DXF viewer

This package provides 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.

The usage example and demo is available here:

The package is released under the MIT License.

This is community version of the viewer. It is initially published in the corporate repository and is used in production in Atlas project. There it will be mostly maintained for project-specific needs. The community version will receive all generic features and bug fixes.

TODO: npm

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. The example above demonstrates this technique.
  • 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.

Incomplete features

There are still many incomplete features. I will try to implement some of them when I have some time. Anything useful implemented in the corporate repository will be merged here as well.

  • Multiline text blocks (MTEXT group).
  • Text styling. Currently, text rendering is using just the specified fonts in the specified order. DXF style and font attributes are ignored. Text glyphs are always rendered infilled.
  • Line patterns - all lines are rendered in continuous style for now. I am going to use 1-D texture generated on preparation stage, texture coordinates (which should account pattern continuity flag in DXF vertices attributes), and a dedicated shader to implement this feature.
  • Line patterns with shapes (e.g. with circles).
  • Wide lines. Currently, all lines are rendered as thin lines. Physical width is not implemented.
  • Variable width lines (i.e. with start and end width specified).
  • Smoothed polyline (curve-fit/spline-fit addition vertices).
  • Hatching
  • Infilled polygons - everything is drawn with outlines now.
  • Block instancing in a grid. Grid attributes are ignored now.
  • Many less commonly used DXF features.

Keywords

FAQs

Package last updated on 18 Feb 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc