Skip to content

Commit 4179e01

Browse files
authored
Merge pull request #21 from thingraph/feature/readme
Update readme
2 parents e126d20 + 285677a commit 4179e01

1 file changed

Lines changed: 49 additions & 13 deletions

File tree

README.md

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,56 @@
1-
# dxf-viewer-examples
2-
Examples for viewing DXF files using Three.js.
3-
- [Online examples](https://dxf.thingraph.site/)
1+
## dxf-viewer-examples
2+
3+
Examples showing how to view **2D DXF/DWG drawings** in the browser using the `@x-viewer/core` 2D viewer engine (WebGL/Three.js based).
4+
5+
- **Online demos**: [Online examples](https://dxf.thingraph.site/)
46

57
## Run examples
6-
```
8+
9+
```bash
10+
npm install
711
npm start
812
```
913

10-
# dxf-viewer
11-
This example project is built on a WebGL based JS SDK, which provides a Viewer2d.
14+
The dev server will start and you can open the examples in your browser.
15+
16+
---
17+
18+
## About @x-viewer/core
19+
20+
The examples in this repo are built on top of `@x-viewer/core`, focusing on the **Viewer2d** for DXF/DWG drawings.
21+
It includes DXF/DWG parsing and 2D rendering, layer control, layouts, measurements, markups and other utilities for building 2D drawing applications.
22+
23+
### Features
1224

13-
### Viewer2d
14-
The Viewer2d class is utilized for viewing 2D drawings and PDF. To work with DWG files, they need to be converted to DXF format first using the dwg2dxf.exe worker. The tool supports most common entity types, OLE, and regions via dwg2dxf conversion. It also supports common line types, hatch styles, and line widths.
25+
- High-performance 2D rendering: WebGL-based rendering engine built on Three.js
26+
- DXF/DWG support: Parse and render DXF/DWG files entirely in the browser without backend server
27+
- Rich 2D tools: layers, layouts, osnaps, distance/area/angle measurements, markups, comparison, screenshots, etc.
28+
- Modular architecture: Designed for extensibility and seamless integration
29+
- TypeScript: Full TypeScript support with comprehensive type definitions
1530

16-
### Example
17-
``` typescript
18-
import { Viewer2d, Viewer2dConfig, ModelConfig } from "dxf-viewer";
31+
### Install @x-viewer/core (use in your own project)
1932

20-
const viewerCfg: Viewer2dConfig = {
33+
```bash
34+
npm install @x-viewer/core
35+
# or
36+
pnpm add @x-viewer/core
37+
# or
38+
yarn add @x-viewer/core
39+
```
40+
41+
### Quick Start – Viewer2d (DXF/DWG Viewer)
42+
43+
```typescript
44+
import { Viewer2d } from "@x-viewer/core";
45+
46+
// Create a 2D viewer
47+
const viewerCfg = {
2148
containerId: "myCanvas",
2249
enableSpinner: true,
2350
enableLayoutBar: true,
2451
};
25-
const modelCfg: ModelConfig = {
52+
53+
const modelCfg = {
2654
modelId: "id_0",
2755
name: "sample",
2856
src: "http://www.abc.com/sample.dxf",
@@ -79,3 +107,11 @@ viewer.goToHomeView();
79107

80108
### Contact Us
81109
- For any inquiries or support, please contact us at [thingraph@outlook.com](mailto:thingraph@outlook.com).
110+
111+
---
112+
113+
## Related Packages
114+
115+
- `@x-viewer/core` – Core viewer engine (2D/3D)
116+
- `@x-viewer/plugins` – Extensible functionality modules
117+
- `@x-viewer/ui` – Reusable UI components

0 commit comments

Comments
 (0)