Introduction

To fully harness the power of a CAD system, it must be adjusted to fit to the specific needs of the organization that uses it. This can be done with scripts that automate the design process, special formatting tools that produce some very special documents, and with linking to other CAD systems. In CADMATIC, the solution is to use the CADMATIC script programming language, which has the necessary hooks to the underlying CAD software.

CADMATIC software includes three main applications: P&ID, Plant Modeller, and Piping Isometrics & Spools. The supporting modules (Datamatic, Database, 2D drafting, and so on) provide common utilities for the main applications.

The CADMATIC script language allows the user to specify repetitive or complex tasks using a programming language that is similar in appearance to the C programming language. The script language provides arithmetic expressions, looping and conditional control, variable storage, and run-time parameters. By calling external application functions, scripts can control drawing symbols, perform tasks for piping and instrumentation diagrams, perform database operations, and so on. CADMATIC delivers the script compiler (dm_sc) as an integral part of the standard software package.

The script syntax was developed with the following goals in mind:

  • Easy to use, even by beginners (simple syntax, type declarations not mandatory, run-time error trapping).
  • Effective enough to be used in building complicated scripts and script applications.
  • Fast learning of the language and its syntax.
  • Isolation from the application kernel – scripts are compiled to byte code that is executed by the script executor. Badly formed scripts do not normally crash the parent application, which makes scripts a safer way to implement customizations than what using native language libraries would be.

The CADMATIC script language is used in CADMATIC for the following:

  • To implement custom tools for designers: user interfaces and manipulation of the 3D model or documents.
  • To implement custom 2D drafting entities for document generation: 2D symbols, labels, and so on.
  • To implement integration with other software, for example via reading/writing and converting data in files.