Configuring CADViewer

CADViewer is a third-party product which can be integrated into OpenKM to provide previsualization of AutoCAD documents.

Go to Administration > Utilities > Database query. At bottom right select option JDBC, paste into the box the SQL insert:

INSERT INTO OKM_EXTENSION (EXT_UUID, EXT_NAME) VALUES ('8e642680-0dcd-4ded-a501-2aa3e53b1286','CADViewer Preview');

Some configuration properties are needed:

Field / PropertyTypeDescription
extension.cadviewer.autoxchange String

Path to ax2017 utility. Used in thumbnail generation, preview and PDF conversion.

extension.cadviewer.linklist String

Path to ll2014 utility. Extract text and metadata from DWG documents.

extension.cadviewer.dwglist String

Path to dwglist utility. Get XREFs from DWG documents. Also used in thumbnail, preview and PDF conversion.

extension.cadviewer.sibling.xrefs Boolean

When this parameter is set to true the AutoCAD files's references have to be all in the same folder. If it is set to false the AutoCAD files's references can be stored in any place in the taxomony tree. In this case, keep on mind that you should avoid document name duplication. There is an automation called CheckUniqueDocumentName which can help you to maintain this restriction.

extension.cadviewer.debug Boolean

Set to true to view the commands executed to conversion in the log file. Only for debug purpose.

extension.cadviewer.remove.temp.files Boollean

Set to false to keep the temporary files creating during conversion. Only for debug purpose.

CADViewer has two kind of licenses:

  • axlic.key: This is the license for the executables. This one should be placed in the same directory of all these executables.
  • cvlicense.js: Used in the Javascript CAD previewer. Should replace the default license at $TOMCAT_HOME/webapps/OpenKM/preview/cadviewer/javascripts folder.

In addition, you have to configure a patch to preserve this license across future OpenKM updates. To do this, create a folder called $TOMCAT_HOME/patch and place the license at $TOMCAT_HOME/patch/preview/cadviewer/javascripts. Once copied, create an script called prepare.sh with this content:

#!/bin/bash

if [ -f "OpenKM.war" ]; then
  echo "Patching WAR..."
  jar uf OpenKM.war preview/cadviewer/javascripts/cvlicense.js
  echo "Done!"
else
  echo "Not able to patch file"
fi

Remember to check executable permissions of the prepare.sh script and the CADViewer's executables.

Also, some Tomcat configuration is needed in server.xml file:

<Context docBase="${catalina.home}/repository/cache/svg" path="/OpenKM/cadviewer" reloadable="true"/>

<Context docBase="${catalina.home}/repository/cache/pdf" path="/OpenKM/cadviewer/pdf" reloadable="true"/>

For multitenant instances, must add this sentences for each tenant:

<Context docBase="${catalina.home}/repository/tenant_{tenantId}/cache/svg" path="/OpenKM/cadviewer/tenant_{tenantId}" reloadable="true"/>

<Context docBase="${catalina.home}/repository/tenant_{tenantId}/cache/pdf" path="/OpenKM/cadviewer/pdf/tenant_{tenantId}" reloadable="true"/>

If you have problems with the conversion, try to execute from the command line. For example, this would make a PDF conversion:

$ ax2017 -i=test.dwg -f=pdf

In case of Linux, ensure you have configured the LD_LIBRARY_PATH properly. In case of Windows the program may fail because VCRUNTIME140.DLL is missing. If you see this error, download the Microsoft Visual C++ 2015 Redistributable from https://www.microsoft.com/en-us/download/details.aspx?id=52685 and install it.

To view external references for each AutoCAD document must set the value of the configuration key extension.external.tab.document. For do it, go to Administration > Configuration and set the appropiate value for this key:

extension.external.tab.document = References;/OpenKM/extension/xref_list.jsp

To enable this extension go to Administration > Utilities > Database query. At bottom right select option JDBC, paste into the box the SQL insert:

INSERT INTO OKM_EXTENSION (EXT_UUID, EXT_NAME) VALUES ('38a9d032-30b9-470d-93ad-47f5e4f93f97', 'External Tab Document');

Configuring Automations:

EventAtValidationsActions
Document create
post

Type: NameMatches
Param 0: .+\.[dD][wW][gG]

Type: NewCadReferences
Order: 0

Document update pre Type: NameMatches
Param 0: .+\.[dD][wW][gG]
Type: DelCadReferences
Order: 0
Document update post Type: NameMatches
Param 0: .+\.[dD][wW][gG] 
 Type: NewCadReferences
Order: 0
Document delete pre

Type: NameMatches
Param 0: .+\.[dD][wW][gG]

Type: DelCadReferences
Order: 0
Folder delete pre

Type: PathContains
Param 0: /okm:root

Type: DelCadReferences
Order: 0