CADViewer Technical Documentation, Installation Guide and Reference Samples Library

Space Objects - API Inteface & Guides

The CADViewer Space Object API and Interface is developed to:

1) Use geometrical elements in CAD files, such as polygons on layers, and block attributes, and give then “life” (click-handers and API interaction) through our back-end AutoXchange Conversion process. For this, please read the guide:

And the associated processing on the CAD converter AutoXchange back-end:

2) Through the CADViewer interface command to dynamically add and manipulate Space Objects. See the Interface API command list for Space Objects activated through the Icon menu or user activated.

SpaceObjectsIconMenu

3) Allow users to build custom menu with Space Object (Assets) loaded from a server side Configuration File. Images for Space Objects can be SVG or bitmaps (png, jpg, gif). Space Objects created in Inkscape can be dynamically controlled, see Inkscape State Layers for IWMS.

CusomSpaceObjectsIconMenu


This Space Objects - API Interace & Guides document will now describe the API commands available for Space Object Manipulation.


Callback method for Space Object interaction

When interacting with Space Objects, one of the most useful methods is the Callback method cvjs_graphicalObjectOnChange which captures any creation, edition or interaction on a Space Object:

Each Space Object is kept in a JSON structure, which can be retrieved through a metod call in the call-back Method, cvjs_returnSpaceObjectID(spaceID).



Space Objects JSON Commands

Each Space Object is kept in a JSON structure that contains information about the object. The Space Object can be created at load time through a processing of the CAD files, see above Guide - How to create hotspots in drawings and the associated processing on the CAD converter AutoXchange back-end, Database Linkage.

A JSON Space Object can be created with the API command cvjs_createNewJSonSpaceObject() , please see the guide on JSON structure:

Note that an ‘customContent’ tag has been introduced to the Space Object that allows application programmers to add higher level content to their individual Space Object.

See the list of API commands for JSON structures:


General Space Object Creation Methods:

Space Objects can be created in two ways:

1: Set the parameters for insertion and scale in separate methods, then insert the Space Object

2: or first create a higher level JSON object with parameter and scale information and insert the Space Object .

Replace Space Object(s):

Operations on Space Objects

Below are a number of operations to modify or update Space Objects, as well as extracting information from them.

Rules Based Space Management API

The CADViewer Space Management API provides a set of methods that allows application programmers to determine how spaces on the canvas relates to each others when inserting or moving content on the canvas.

The CADViewer Rules Based Space Management API uses the ‘customContent’ tag in the Space Object, that allows application programmers to add higher level content to the Space Object.

See the Guide:

Space Object Display Order

See how Space Objects display order can be changed dynamically.

Last updated on 14 Jul 2023
Published on 22 Mar 2020