CADViewer Technical Documentation, Installation Guide and Reference Samples Library

JSON - Dynamic Modification of Title Blocks in Output

Try out this CADViewer Dynamic Modification of Title Block Output using JSON Sample on our onlinedemo.cadviewer.com server. Make sure to allow pop-up’s in your web-browser for this server.

URL parameters

This CADViewer sample uses the Url parameter interface to pass over the drawing to display, as well as the location of a JSON file which is used to modify the Drawings Title Block information when printing to PDF.

The URL parameter call is (the Url and exact file-paths will change depending on the implementation platform):

http://127.0.0.1:8081/html/CADViewer_json_610.html?drawing_name=http://127.0.0.1:8081/content/drawings/dwg/base_xref_json.dwg&json_location=c:/nodejs/cadviewer/content/TitleBlock-helloworld.json&print_modal_custom_checkbox=add_json

Please see Load Parameters from URL on the internal API call to retrive the URL parameters.

Title Block

The sample drawings consists of a base drawing base_xref_json.dwg which in turn loads in two external references ( Xref’s) , where the Xref’s are placed in the same server folder as the base drawing.

AutoXchange 2020 includes the feature to dynamically modify Block Attributes when performing a conversion operation on a given drawing.

The drawing in this sample has a Title Block, TTLB-ANNO defined, which contains multiple entries. The first three block attributes are TITLE1, TITLE2 and TITLE3.

We therefore pass over a JSON file to AutoXchange 2020 to modify the three Title Block entries as part of a Print to PDF Operation in CADViewer.

JSON Syntax

The syntax of the JSON file TitleBlock-helloworld.json is:

CADViewer Operation

Choose the following settings for CADViewer Print Modal and Print:

Print Settings

In Adobe Acrobat, zoom into the PDF Output to verify the Title Block content has been dynamically changed:

PDF

Source Code

The Source file for CADViewer_json_610.html is:

Please visit our comprehensive Online CADViewer Demos section other File Demos with CADViewer 4.1 and AutoXchange 2020

Last updated on 9 Apr 2020
Published on 9 Apr 2020