COD Scripts are simple text files used to automate changing properties of Fabrication items in CADmep, ESTmep and CAMduct. Here’s a brief explanation of COD Scripts…

  • Written in ASCII Text (Windows Notepad, etc.)
  • Can use Script Editor in Fabrication but can be buggy when running scripts.
  • File extension for scripts =  *.COD
  • Text/Strings surrounded by double quotes
  • Double quotes from Word/Email (̏ “ ” ) are not the same as Notepad (” “)
  • Use ASCII Character codes to mimic Enter, Tab, Quotes within text strings
  • Variables must be declared with DIM
  • Variable names must be begin w/alpha character, no spaces odd characters
  • Functions/Properties/Variables are NOT CaSe SeNsItIvE
  • Scripts Read/Write properties, they don’t automate drawing.
  • ITEM is default object for items in drawing
  • JOB is default object for job properties
  • Unless using advanced processing tasks or functions, scripts are run on each selected object. E.g. 2 selected objects runs the script twice, once for each object.
  • Scripts can INCLUDE other COD script files.
  • Scripts can RUN other COD script files.
  • Scripts can contain reusable FUNCTIONs.
  • Script Functions can take additional arguments passed to them
  • Script Functions can return values to the function that called them
  • Script Functions can be called, passed values and/or return values even when Included from an external script file
  • COD scripts can build ARRAY objects for easier processing of large datasets
  • Use ASCII Carriage Return and Tab codes to format data
  • Scripts can read and write files
  • Both Binary and Text files can be read/written
  • Scripts can scan for Files and Folders to be processed
  • File and Folder scanning can match against wildcard/mask patterns
  • Scripts by default execute once for each item selected
  • Scripts can use a TASK SELECTION to execute once regardless of number of selected items (you are then responsible to process them in a loop in your own code)
  • Processing of large datasets can produce progress bars using a TASK
  • All scripts using TASKs must be declared at the beginning of the file with a REQUIRES statement.
  • Use the EXEC function to call other programs or DOS batch files to do more advanced, non-fabrication related functions.
  • COD Scripts can be called from AutoLISP using the (executescript) function to further enhance functionality.
  • Use Custom Data or Note fields to pass data to Lisp from the a COD script.
  • Use List Setup to access fabrication data via Lisp (entget) DXF codes.

Additional Resources

Help file installed locally:

C:\Program Files\Autodesk\Fabrication {year}\{product}\en-US\Scripting.chm 

{year} = 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
{product} = CADmep, ESTmep, CAMduct

Online Tutorial & Documentation:

https://tinyurl.com/COD-Script


Calling Scripts in CADmep…

  • Type EXECUTESCRIPT at the command line
  • Use (executescript <script name>) function from AutoLISP

Calling Scripts in ESTmep/CAMduct

  • Use Script Editor to Load & Run: File -> Open Script
  • Highlight Items from Takeoff: Right-Click -> Execute Script