Creates a new 2D CAD viewer instance.
Configuration options for the viewer
Options to customize view
Optional
background?: numberBackground color
Optional
calculateSizeCallback?: AcEdCalculateSizeCallbackCallback function used to calculate size of canvas when window resized
Optional
canvas?: HTMLCanvasElementCanvas HTML element used by renderer
Protected
_canvasThe HTML canvas element for rendering
Readonly
eventsEvents fired by the view for various interactions
Fired when mouse hovers over an entity
Fired when mouse moves over the view
Fired when mouse stops hovering over an entity
Fired when the view is resized
The block table record id associated with the active layout
The active layout view
The bounding box to include all entities in this viewer
The canvas HTML element used by this view
Gets the center point of the current view in world coordinates.
The view center point
Gets the center point of the current view in world coordinates.
The view center point
Postion of current mouse in world coordinate system
Postion of current mouse in screen coordinate system
Gets the input manager for handling user interactions.
The editor provides high-level methods for getting user input like point selection, entity selection, and cursor management.
The editor instance
Height of canvas (not height of window) in pixel
Gets whether the view needs to be re-rendered.
True if the view is dirty and needs re-rendering
Sets whether the view needs to be re-rendered.
True to mark the view as needing re-rendering
Gets information about missing data during rendering (fonts and images).
Object containing maps of missing fonts and images
Gets the current view mode.
The view mode determines how the view responds to user interactions:
The current view mode
Sets the view mode (selection or pan).
The view mode to set
The block table record id of the model space
Gets the Three.js renderer wrapper used for CAD rendering.
The renderer instance
Gets the size of the selection box used for entity picking.
This determines how close the mouse needs to be to an entity to select it, measured in screen pixels.
Selection box size in pixels
Sets the size of the selection box used for entity picking.
Selection box size in pixels
The selection set in current view.
The statistics of the current scene
Width of canvas (not width of window) in pixel
Add the specified entity in drawing database into the current scene and draw it
Input the entity to add into the current scene
Clear the scene
Protected
createConverts a point from client window coordinates to world coordinates.
The client window coordinate system has its origin at the top-left corner of the canvas, with Y increasing downward. World coordinates use the CAD coordinate system with Y typically increasing upward.
Point in client window coordinates
Point in world coordinates
Select the specified entities
Protected
initializeProtected
Initializes the viewer after renderer and camera are created.
This method sets up the initial cursor and can be overridden by child classes to add custom initialization logic.
Protected
onCalled when hovering the specified entity
Protected
onCalled when unhovering the specified entity
Protected
onPick entities intersected with the specified point in the world coordinate system.
Optional
point: AcGeVector2dLikeInput the point to pick objects. If not provided, the position of current cursor is used.
Return ids of entities intersected with the specified point
Remove the specified entity from this view.
Input the object id of the entity to remove
Re-render points with latest point style settings
Input display mode of points
Search entities intersected or contained in the specified bounding box.
Input the query bounding box
Return query results
Select entities intersected with the specified point in the world coordinate system, add them to the current selection set, and highlight them.
Optional
point: AcGeVector2dLikeSelect entities intersected with the specified bounding box in the world coordinate system, add them to the current selection set, and highlight them.
Input one bounding box in the world coordinate system.
Set callback function used to calculate size of canvas when window resized
Input callback function
Set layer's visibility
Input layer name
Input visibility of the layer
Unhighlight the specified entities
Update the specified entity
Input the entity to update
Converts a point from world coordinates to client window coordinates.
This is the inverse of cwcs2Wcs()
, converting from the CAD world
coordinate system to screen pixel coordinates.
Point in world coordinates
Point in client window coordinates
A 2D CAD viewer component that renders CAD drawings using Three.js.
This class extends AcEdBaseView and provides functionality for:
Example