CADViewer Technical Documentation, Installation Guide and Reference Samples Library

CADViewer Space Objects - Solution Flow

This is a small check-list for the solution flow when setting up a CADViewer solution flow for any application usage for Space Management-, IWMS- and IOT-solutions and many many more. Most of the items in this check-list references other parts of the documentation.

CADViewer consists of the CADViewer Front-End supported by one or more CAD Data Converters (AutoXchange, DwgMerge) and CAD Data Extractors (LinkList, DwgList) implemented on the server-side and acccessed either through our CADViewer RESTFUL API or directly spawned as a command-line executable.

Back-End Processing

The first decision to be made is to convert drawings on-the-fly or ahead of time. For drawings that change often, on-the-fly conversion is preferred. If the base drawings are static in nature (of course the Space Object Overlays on top of the CAD drawing can and will dynamically change), then it is better to apply a CAD conversion ahead of time and use the pre-converted floor-plan.

1) For convertion on-the-fly, then the CADViewer Solution Architecture, will specifically be as outlined in the CADViewer Architecture Overview. Use the Platform Handlers overview to select your particular back-end/front-end combination. The Platform Handlers overview list will link into our GitHub Repository which contains a large number of sample implementations of Front-end/Back-end combinations depending on platform combination.

2) If converting ahead of time, there are two ways of approching this:

Space Object Processing

The CADViewer Space Object Interface can be used in the following ways to process Space Objects:

  • 3A: Pre-processing of polygons and blocks in the CAD drawing into clickable objects.
  • 3B: Adding Space Object Icons or drawn space polygons on top of the drawing.
  • 3C: A combination of 3A) and 3B).

Typically, the pre-processing under 3A: will be done as part of the general process under 2A: or 2B:. The conversion process is described in the Database Area Linkage section of the AutoXchange AX2023 documentation, where the detailed (RL/TL) parameters are described in the Database Linkage Parameter Interface.

When the pre-processed Space Objects are loaded into CADViewer they are processed as JSON Objects. Typically, the application programmer will extract these JSON Objects with all processed spaces using the API command cvjs_returnAllSpaceObjects in the call-back cvjs_OnLoadEnd(). The available API commands to manipulate Space Objects are here: JSON Structure & JSON Commands.

There is an API cvjs_setSpaceObjectProcessing() to select not to process JSON Objects at load time of the drawing, so the complete JSON Object consistent of the operations 3A:, 3B: and 3C: can then be inserted after load call-back cvjs_OnLoadEnd() on the base CAD drawing using the API cvjs_setSpaceObjectsStructureDirect(). Obviously the pre-processing process needs to be repeated in case the underlying floor-plan changes.

Template Samples for the Front-End

The following online samples all contains sample code to manipulate Space Objects , see below. Note that the complete list of combination is found at Platform Handlers.

For the Platforms ReactJS, AngularJS, VueJS, they typically work with either the NodeJS or Apache PHP back-end, please see Back-End Processing above on which back-end setting to use.

Front-End Implementation Notes

The samples contains the standard initialization settings, which can be found in CADViewer Front-End, but some quick notes below:

1: When loading a drawing from CADViewer use the API command cvjs_LoadDrawing(). The FileName parameter is the server location of the display file and needs to be passed over from the application programmers code. If using on-the-fly the filename will be a CAD (DWG/DXF/PDF) file on the server, if file is converted ahead of time, it will be an SVG file. Note, if drawing is pre-processed and navigation between views is needed, then the full SVG bundle must be present the folder passed over.

2: The application programmer must always set the URL to the Back-end location, the URL of the front-end itself as well as an optional setting of ServerLocation (should be an empty string in production).

var ServerBackEndUrl = http(s)://mybackendcadviewerserver;
var ServerUrl = window.location.protocol+"//"+window.location.hostname+"/cadviewer/";
var ServerLocation = "";

3: Use the CADViewer Call-Back method cvjs_OnLoadEnd() to add specific processing. For example, programmers can add processing flags in cvjs_OnLoadEnd() so on the first run cvjs_returnAllSpaceObjects is used to extract all pre-processed content, on re-load of the drawing, cvjs_setSpaceObjectsStructureDirect is used to insert all content.

4: The CADViewer Call-Back method cvjs_graphicalObjectOnChange() captures any change or creation of Space Objects on the CAD Canvas. This CADViewer Call-Back is therefore used to monitor all user actions, the API command cvjs_returnSpaceObjectID(spaceID) can be called to fetch the Space Object, so it can saved into the application programmer’s back-end for re-use. All samples contains reference code for implementing cvjs_graphicalObjectOnChange();

HAVE FUN! - Please contact us and please let us Help You with your implementation!

Last updated on 8 Dec 2022
Published on 21 Sep 2022