Basic Examples
Less than 1 minute
Basic Examples
WebCAD basic getting started examples to help you quickly understand the core features of WebCAD.
Online Examples
| Example | Description | Link |
|---|---|---|
| Initialize Engine | MainView initialization and configuration options | Online Demo{target="_blank"} |
| Wait for Loading | onLoad async await example | Online Demo{target="_blank"} |
| Viewer Mode | Display drawing area only, hide menu toolbar command line | Online Demo{target="_blank"} |
| Viewer Remote Drawing | Open backend drawing in read-only mode | Online Demo{target="_blank"} |
| Map Overlay Mode | Overlay WebCAD onto vjmap map | Online Demo{target="_blank"} |
Core Concepts
Initialize Engine
The entry point of WebCAD is the MainView class, which requires a service URL and access token:
const { MainView, initCadContainer } = vjcad;
const cadView = new MainView({
appname: "唯杰CAD",
version: "v1.0.0",
serviceUrl: env.serviceUrl,
accessToken: env.accessToken,
sidebarStyle: "none",
});
initCadContainer("map", cadView);
await cadView.onLoad();Viewer Mode
If you only need to view drawings without editing capabilities, you can use Viewer mode:
const cadView = new MainView({
// ... other options
viewerMode: true,
});