Visual Query Callback Methods
CADViewer Visual Query in it’s implementation uses the CADViewer call-back methods when an action has been performed on the canvas or a file has loaded. These methods are implemented in the main /scr/components/CADViewer/CADViewer.js class in Visual Query.
When exporting the callback over helper components, for example in CADViewer.js implement:
import * as RedlineAreaMethods from "../CADViewerHelperMethods/components/RedlineAreaMethods.component.tsx";
// and in the general callback, call the impementation in the helper component
const cvjs_graphicalObjectOnChange = useCallback((type, graphicalObject, spaceID, evt) => {
RedlineAreaMethods.graphicalObjectOnChange(type, graphicalObject, spaceID, evt);
and in the helper component RedlineAreaMethods.tsx, implement:
// internalcallback01 is the method that implements the callback when it's been fired off on the main canvas
export function graphicalObjectOnChange(type: any, graphicalObject: any, spaceID: any, evt: any) {
internalcallback01(type, graphicalObject, spaceID, evt)
}
All links below links to the general CADViewer callback documentation.
General Functional Callback Methods
-
cvjs_OnLoadEnd() - callback when a drawing has been loaded
-
cvjs_OnLoadEndRedlines() - callback when a redline has been loaded
-
cvjs_graphicalObjectOnChange() - callback for any interaction on the canvas. NOTE: used for Redlines, StickyNotes and SpaceObjects
-
cvjs_change_space() - callback for change of focus on Space Object
-
cvjs_graphicalObjectCreated() - callback for space Object created, use vjs_graphicalObjectOnChange in general case
-
cvjs_ObjectSelected() - callback for space Object selected, use vjs_graphicalObjectOnChange in general case
These Java Script callback methods must be implemented as placeholders.
Canvas Interaction Callback Methods
CADViewer provides the ability to add click-handlers to graphical objects in display CAD file. These objects are defined by the Entity Handle in the originating AutoCAD or MicroStation file being displayed by CADViewer. The *Entity Handles are parsed by adding the following conversion control parameter -hlall , see more in the section Conversion Control Parameters and AutoXchange 2023 parameter interface.
cadviewer.cvjs_conversion_addAXconversionParameter("HLALL", "");
These Java Script callback methods should be implemented as placeholders. In the npm based CADViewer GitHub repository samples, these are all implemented as defined callback methods.
- cvjs_dblclick() - CADViewer canvas handler
- cvjs_mouseout() - CADViewer canvas handler
- cvjs_mousedown() - CADViewer canvas handler
- cvjs_click() - CADViewer canvas handler
- cvjs_mouseover() - CADViewer canvas handler
- cvjs_mouseleave() - CADViewer canvas handler
- cvjs_mousenter() - CADViewer canvas handler