AutoCAD Validation and Quality Assurance

Liz Sanderson
Liz Sanderson
  • Updated

Safe Software has announced plans to deprecate the FME Server JavaScript API. Please review the JavaScript API Deprecation notice for updates.

The FME Server Playground is also scheduled for permanent removal. Content may be removed from the website without notice. Moving forward, interactive FME demos will be accessible from

Live Demo | Download Data | Fork on GitHub


This example demonstrates how to validate a dataset through an online form using FME. This particular example takes an AutoCAD DWG file that contains data about water mains and then validates them. A workspace containing the validation rules is uploaded to FME Server. Then using the FME Server REST API, the workspace will be triggered anytime a DWG file is uploaded. After the workspace has been run, the user will get a report back containing information about any errors in the dataset.


How it Works

When an AutoCAD DWG file containing water main data is added to the workspace, the workspace will check for the following criteria:

  • Checks AutoCAD geometry to ensure it is a line

  • Then using the GeometryValidator it checks to see if it passes the OGC test.

    • If it passes the OGC test, then the workspace tests to ensure the pipe diameter is larger than 0. If the diameter is smaller than 0, it gets labeled with the “Invalid Attribute: Diameter” error.

    • If the OGC test failed, then the workspace assigns the error label “Invalid Geometry.”

  • The remainder of the workspace creates an HTML report that presents the errors to the user as well as a map showing the exact location of the error.

  • The workspace is uploaded to FME Server and using an FME Server token a webpage is created to interact with the workspace.


Step-by-step Instructions

The workspace and all of the code is available for download from GitHub.

After you download the source files for this demo, you will need to complete the following steps to configure it to run with your own FME Server installation.


1. Publish the Workspace to FME Server

Open the validate-direct.fmw workspace in FME Workbench. Publish the workspace to FME Server and create a new Repository called Demos and ensure the workspace name is validate-direct.fmw. Register to the Job Submitter and Data Streaming services. Click Publish.


2. Move Directory Files

Copy the ‘www’ folder from the download package to a web-accessible ROOT location. It can be hosted by a web server like IIS or Apache. Additionally, you could make use of a service like Amazon S3 to host the page. To learn more about web hosting and FME Server check out this article.


Note: If you are using FME Server on premises, you can host the web page from its web server root directory. Although this method isn’t recommended for security reasons, it is an easy way to get this demo up and running while a more secure method is developed. Copy the ‘www’ folder into <FMEServerDir>/Utilities/tomcat/webapps/ROOT/.


3. Set up an FME Server Token

We need to set up an FME Server Token to be able to connect the javascript with an FME Server. To create a token, go to the FME Server Web User Interface, and in the top right corner, click on your username to open the menu drop-down then select Manage Token.

In the Manage Token dialog, click on New Token to open up the parameters. Name the token Validation Token, then change your duration to however long you would like this token to be active, for this example, the token is set to 30 days. For Permission, enable the Run Workspace Advanced permission, and then click OK. Copy this token for use in the next step.

For more information on FME Server Tokens, see the documentation.


4. Modify the Javascript to point to your repository and workspace

Open the following file as an Administrator in a text editor: \www\js\cadValidation.js Ensure that you are opening it from the ROOT folder hosted by your web server.

Under the config function, change the server and token to match your server URL and the token.


5. Save the changes

Save the changes you made to cadValidation.js. If you get an error when saving the javascript file, ensure that you opened your text editor as an Administrator.


6. Set up CORS (only if using your own web server to host)

You only need to complete this step if you are using your own web service (Apache, IIS, S3) to host your demo. Back in the FME Server Web User Interface on the side menu bar, click on CORS. Once you are on the Configure Cross-origin Resource Sharing (CORS) page, in the top right corner, click on Load Template, then click on Allow All Hosts. For the more advanced user, you can set up Specific Hosts.


7. Run the demo

To run the live demo, enter the following URL into a web browser and input your FME Server name:


Note: This URL assumes that you copies the entire ‘www’ folder to your web service, change the URL accordingly if the folder or file names were changed.


Then upload one of the sample data files to test the validator.

Was this article helpful?



Please sign in to leave a comment.