Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .cursor/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"mcpServers": {
"realdwg-web Docs": {
"url": "https://gitmcp.io/mlightcad/realdwg-web"
},
"cad-viewer Docs": {
"url": "https://gitmcp.io/mlightcad/cad-viewer"
},
"mtext-renderer Docs": {
"url": "https://gitmcp.io/mlightcad/mtext-renderer"
}
}
}
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ Lazy initialization: `AcApDocManager` is created on first file open, not at page
|------|------|
| `index.html` | With-plugins demo — upload UI, `viewerPane` host, dock mount, `#cad-container` |
| `no-plugin.html` | Bare-viewer demo — same open UI, no plugin registration |
| `.cursor/mcp.json` | Project MCP servers for RealDWG / cad-viewer / MTEXT docs (see [Ask the docs via MCP](#ask-the-docs-via-mcp)) |
| `src/styles/app.css` | Shared layout / upload-screen styles for both pages |
| `src/app.ts` | `CadViewerApp` + `bootCadViewerApp` — lazy init, worker checks, optional plugins |
| `src/main.ts` | Entry for with-plugins page (`enablePlugins: true`) |
Expand All @@ -656,6 +657,20 @@ Lazy initialization: `AcApDocManager` is created on first file open, not at page
- [Command wiki](https://github.com/mlightcad/cad-viewer/wiki/Command)
- [Example: `ellipseCmd.ts`](./src/ellipseCmd.ts)

## Ask the docs via MCP

If anything about the drawing / entity APIs or MTEXT rendering is unclear while you work in an AI coding tool, ask through these [GitMCP](https://gitmcp.io) doc servers instead of guessing from outdated training data:

| MCP server | Docs source | Use when |
|------------|-------------|---------|
| `realdwg-web Docs` | [mlightcad/realdwg-web](https://gitmcp.io/mlightcad/realdwg-web) | Database / entity APIs (RealDWG-style patterns used by this stack) |
| `cad-viewer Docs` | [mlightcad/cad-viewer](https://gitmcp.io/mlightcad/cad-viewer) | Viewer packages (`cad-simple-viewer`, plugins, commands, workers) |
| `mtext-renderer Docs` | [mlightcad/mtext-renderer](https://gitmcp.io/mlightcad/mtext-renderer) | MTEXT parsing, layout, and rendering |

**Cursor:** this repo already ships the servers in [`.cursor/mcp.json`](./.cursor/mcp.json). Open the project, enable the servers if prompted, then ask in chat (for example: how to create a polyline, or how MTEXT workers relate to `webworkerFileUrls`).

**Other vibe coding tools** (Claude Desktop, Windsurf, VS Code, Cline, etc.): open each GitMCP URL above in a browser. The page shows ready-made MCP config snippets for many clients — copy the settings for your tool into its MCP / settings file. No local install is required; GitMCP runs as a remote docs server.

## Related packages

- [`@mlightcad/cad-simple-ui-plugin`](https://github.com/mlightcad/cad-viewer/tree/main/packages/cad-simple-ui-plugin) — Framework-agnostic toolbar and Layer Manager dock panel used by this example
Expand Down
37 changes: 35 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,20 @@ <h3 class="setting-label">Access mode</h3>
</div>
</div>

<div class="setting-block setting-block--full">
<h3 class="setting-label">Curve quality</h3>
<div class="pill-segment" data-option-group="circleSides" role="radiogroup" aria-label="Curve quality">
<button type="button" class="pill-option is-active" data-value="50" role="radio" aria-checked="true" title="Fewer vertices, smaller files">Memory</button>
<button type="button" class="pill-option" data-value="100" role="radio" aria-checked="false" title="Balanced (100 sides per circle)">Standard</button>
<button type="button" class="pill-option" data-value="1000" role="radio" aria-checked="false" title="Smoother curves, more memory">Quality</button>
</div>
</div>

<div class="setting-block">
<h3 class="setting-label">Text rendering</h3>
<div class="pill-segment" data-option-group="textRendering" role="radiogroup" aria-label="Text rendering">
<button type="button" class="pill-option is-active" data-value="worker" role="radio" aria-checked="true" title="Faster, more memory">Worker</button>
<button type="button" class="pill-option" data-value="main" role="radio" aria-checked="false" title="Slower, less memory">Main thread</button>
<button type="button" class="pill-option" data-value="worker" role="radio" aria-checked="false" title="Faster, more memory">Worker</button>
<button type="button" class="pill-option is-active" data-value="main" role="radio" aria-checked="true" title="Slower, less memory">Main thread</button>
</div>
</div>

Expand All @@ -90,13 +99,37 @@ <h3 class="setting-label">Progressive</h3>
</div>
</div>

<div class="setting-block">
<h3 class="setting-label">Wait for text</h3>
<div class="pill-segment" data-option-group="waitForTextGeometry" role="radiogroup" aria-label="Hold open progress until text geometry finishes">
<button type="button" class="pill-option" data-value="true" role="radio" aria-checked="false" title="Keep “Rendering drawing ...” until deferred text is done">On</button>
<button type="button" class="pill-option is-active" data-value="false" role="radio" aria-checked="true" title="Hide progress after entity convert (default); export still waits for text">Off</button>
</div>
</div>

<div class="setting-block">
<h3 class="setting-label">Non-plottable</h3>
<div class="pill-segment" data-option-group="noPlotLayers" role="radiogroup" aria-label="Non-plottable layers">
<button type="button" class="pill-option is-active" data-value="false" role="radio" aria-checked="true" title="Web viewer default">Hide</button>
<button type="button" class="pill-option" data-value="true" role="radio" aria-checked="false" title="AutoCAD editor semantics">Show</button>
</div>
</div>

<div class="setting-block">
<h3 class="setting-label">Export</h3>
<div class="pill-segment" data-option-group="disableExport" role="radiogroup" aria-label="Export">
<button type="button" class="pill-option is-active" data-value="false" role="radio" aria-checked="true" title="Allow DXF/HTML/PDF/SVG/PNG export">Enable</button>
<button type="button" class="pill-option" data-value="true" role="radio" aria-checked="false" title="Hide export commands and File menu items">Disable</button>
</div>
</div>

<div class="setting-block">
<h3 class="setting-label">Paper background</h3>
<div class="pill-segment" data-option-group="paperSpaceBackground" role="radiogroup" aria-label="Paper background">
<button type="button" class="pill-option is-active" data-value="ffffff" role="radio" aria-checked="true" title="Desktop CAD / print preview">White</button>
<button type="button" class="pill-option" data-value="000000" role="radio" aria-checked="false" title="Web viewer preference">Black</button>
</div>
</div>
</div>
</section>
</div>
Expand Down
37 changes: 35 additions & 2 deletions no-plugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,20 @@ <h3 class="setting-label">Access mode</h3>
</div>
</div>

<div class="setting-block setting-block--full">
<h3 class="setting-label">Curve quality</h3>
<div class="pill-segment" data-option-group="circleSides" role="radiogroup" aria-label="Curve quality">
<button type="button" class="pill-option is-active" data-value="50" role="radio" aria-checked="true" title="Fewer vertices, smaller files">Memory</button>
<button type="button" class="pill-option" data-value="100" role="radio" aria-checked="false" title="Balanced (100 sides per circle)">Standard</button>
<button type="button" class="pill-option" data-value="1000" role="radio" aria-checked="false" title="Smoother curves, more memory">Quality</button>
</div>
</div>

<div class="setting-block">
<h3 class="setting-label">Text rendering</h3>
<div class="pill-segment" data-option-group="textRendering" role="radiogroup" aria-label="Text rendering">
<button type="button" class="pill-option is-active" data-value="worker" role="radio" aria-checked="true" title="Faster, more memory">Worker</button>
<button type="button" class="pill-option" data-value="main" role="radio" aria-checked="false" title="Slower, less memory">Main thread</button>
<button type="button" class="pill-option" data-value="worker" role="radio" aria-checked="false" title="Faster, more memory">Worker</button>
<button type="button" class="pill-option is-active" data-value="main" role="radio" aria-checked="true" title="Slower, less memory">Main thread</button>
</div>
</div>

Expand All @@ -90,13 +99,37 @@ <h3 class="setting-label">Progressive</h3>
</div>
</div>

<div class="setting-block">
<h3 class="setting-label">Wait for text</h3>
<div class="pill-segment" data-option-group="waitForTextGeometry" role="radiogroup" aria-label="Hold open progress until text geometry finishes">
<button type="button" class="pill-option" data-value="true" role="radio" aria-checked="false" title="Keep “Rendering drawing ...” until deferred text is done">On</button>
<button type="button" class="pill-option is-active" data-value="false" role="radio" aria-checked="true" title="Hide progress after entity convert (default); export still waits for text">Off</button>
</div>
</div>

<div class="setting-block">
<h3 class="setting-label">Non-plottable</h3>
<div class="pill-segment" data-option-group="noPlotLayers" role="radiogroup" aria-label="Non-plottable layers">
<button type="button" class="pill-option is-active" data-value="false" role="radio" aria-checked="true" title="Web viewer default">Hide</button>
<button type="button" class="pill-option" data-value="true" role="radio" aria-checked="false" title="AutoCAD editor semantics">Show</button>
</div>
</div>

<div class="setting-block">
<h3 class="setting-label">Export</h3>
<div class="pill-segment" data-option-group="disableExport" role="radiogroup" aria-label="Export">
<button type="button" class="pill-option is-active" data-value="false" role="radio" aria-checked="true" title="Allow DXF/HTML/PDF/SVG/PNG export">Enable</button>
<button type="button" class="pill-option" data-value="true" role="radio" aria-checked="false" title="Hide export commands and File menu items">Disable</button>
</div>
</div>

<div class="setting-block">
<h3 class="setting-label">Paper background</h3>
<div class="pill-segment" data-option-group="paperSpaceBackground" role="radiogroup" aria-label="Paper background">
<button type="button" class="pill-option is-active" data-value="ffffff" role="radio" aria-checked="true" title="Desktop CAD / print preview">White</button>
<button type="button" class="pill-option" data-value="000000" role="radio" aria-checked="false" title="Web viewer preference">Black</button>
</div>
</div>
</div>
</section>
</div>
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
"vite-plugin-static-copy": "^4.1.1"
},
"dependencies": {
"@mlightcad/cad-html-plugin": "1.6.0",
"@mlightcad/cad-pdf-plugin": "1.6.0",
"@mlightcad/cad-svg-plugin": "1.6.0",
"@mlightcad/cad-simple-ui-plugin": "1.6.0",
"@mlightcad/cad-simple-viewer": "1.6.0",
"@mlightcad/data-model": "1.13.0",
"@mlightcad/libredwg-converter": "^3.13.0"
"@mlightcad/cad-html-plugin": "1.7.1",
"@mlightcad/cad-pdf-plugin": "1.7.1",
"@mlightcad/cad-svg-plugin": "1.7.1",
"@mlightcad/cad-simple-ui-plugin": "1.7.1",
"@mlightcad/cad-simple-viewer": "1.7.1",
"@mlightcad/data-model": "1.14.8",
"@mlightcad/libredwg-converter": "^3.14.8",
"@mlightcad/mtext-renderer": "^0.12.12"
}
}
Loading
Loading