Fabrication COD Script Library – Updated

If you’ve not downloaded the Autodesk Fabrication Script Libraries lately, you might want to grab an updated copy. There’s been several updates over the last month. Here’s what’s changed…

  • Damper Rotation Property (undocumented) has been added to all Debug, Job and Library scripts. Support for this property was added in 2017 but never documented. It’s there to support the rotation of Dampers on Fabrication Parts in Revit. It should be noted, that this value is Added to the Angle property of the assigned damper. As such, it acts as an Adjust and not an Override. e.g. Damper w/Angle of 90 + Rotation Property in the ITM of 90 results in a damper rotated 180 degrees.
  • Stiffener Group Property added to the Autodesk Fabrication 2022.0 and later versions of the Debug, Job and Library scripts.
  • Airturn Group Property added to the Autodesk Fabrication 2022.0 and later versions of the Debug, Job and Library scripts.
  • Splitter Group Property added to the Autodesk Fabrication 2022.0 and later versions of the Debug, Job and Library scripts.
  • Insulation StatusLock Property added but listed as “Unavailable” as it stopped working in 2017. Added in the hopes it gets fixed in future versions.
  • StructureType Property added to the Autodesk Fabrication 2022.0 and later versions of the Debug, Job and Library scripts. Property was “Write Only” in 2021 and prior versions so was unable to display in prior versions.
  • Product List HasCustomData Property has been added to all Debug, Job and Library scripts.
  • Product List HasFlow Property has been added to all Debug, Job and Library scripts.
  • Item PCFSKey Property has been added to all Debug, Job and Library scripts.
  • Item CostByLength Property removed from Material Debug scripts (never really belonged there).

You can find the updated scripts here….Script Library.

New Properties are documented here…Item Property Reference.

Fabrication 2022 Bug – Configure Users

If you run Autodesk Fabrication as a multi-user installation, there’s a defect in the Configure Users utility. When you run the utility from a 2022 installation, it won’t read any of the user accounts you have configured.

In fact, the only way to login, is to use the Default Administrator account Autodesk uses if there are no users configured. It won’t read your Administrative account regardless of what the login is. To see the issue, you can use the following to login and see the problem…

User Name: Administrator
Password:  Admin

Once logged in, there will be one account. You can make more but when you exit and come back in, those accounts don’t show up. IN fact, even the original Administrator account isn’t there, it’ll make a new one. The following image shoes the users accounts that were created in 2022 be repeatedly going into it. Next to it is the 2021 utility showing those same accounts. As you can see, they are there, its just 2022 won’t show them.

Note that all the other Fabrication products will read/honor the accounts properly. It only seems to be the Configure Users utility that had the issue.

How to Determine Which Version of Configure Users To Run

To make things ‘easy’, Autodesk chose not to add the version in the name of the shortcut. Simply looking for ‘Configure Users‘ shows a lot of indeterminate results.

To pick a particular version, Right-Click on one of the shortcuts and select ‘Open file location‘.

This will display a File Explorer window to the location of the shortcut you selected. As you can see below, the one I happened to pick was for CAMduct Components 2016. The product doesn’t matter, only the version, You can navigate back a folder then pick one of the Fabrication products for any version you want. 2021 and earlier will work.

Not sure if or when they’ll get around to fixing this. While 2022 has had a few issues fixed, they didn’t release any updates (yet) for 2021. Regardless if they fix it or not, it’s easy to work around by using any other version.

Shop Math 101: 1/100″ = 1/4″

Does your fabrication shop lack confidence in your drafting/detailing department?

Have you struggled to get buy-in when trying to roll out new processes, technology or deliverables?

Did you wonder why? More importantly, do you KNOW why?

Getting to the Root of Trust Issues

My entire career spanning manufacturing to construction, fabrication shops have had trouble trusting the information they’re given. And there’s good reason. It takes time to master a domain and learn the work. And production staff are busy building and fabricating. They don’t have time to run into the office every time something is wrong. As a result, office staff take longer to train and often persist with producing lower quality work.

But there’s also a lot of reasons that are not good. Downright bad in fact because they’re simple to resolve. Things you’re NOT doing wrong but are causing problems. These trust issues are easily corrected if they’re understood properly. One such issue is fabrication tolerances that I categorize as Shop Math.

The Dynamic Between Tolerance and Rounding

I’ve had trouble explaining this verbally so I figured a more graphic (yet generic) representation would be in order. In basic terms, you need to use a rounding factor 1/2 the amount of your fabrication tolerance to achieve the desired result. As the title of this post suggests, a value of 1/100″ of an inch, can result in a deviation of 1/4″. That’s real Shop Math in practice.

My example uses both fractional inch and decimal to more clearly illustrate the point. You don’t want to get me started in why everyone should use decimal, that’s another post. But decimal also has the same dynamic, it’s just less hidden and more easily fixed. You get a lot less pushback in a shop by adding an extra decimal than by changing the denominator of a fraction to a number the shop says they don’t fabricate to.

Let’s take the following example..,

In this example, lets assume our tolerance is 1/8″ (construction field tolerances, that’s fairly common).

The TOP RED dimensions are all ROUNDED to the nearest 1/8″ to match our target Tolerance. A fairly common practice. The BOTTOM GREEN dimensions are all ROUNDED to the nearest 1/16″ which is half our target Tolerance.

Each graphic shows a line 6″ long. Half that is 3″. We’re going to make a gap and dimension from each end to that gap. Maybe it’s a weld joint in pipe or perhaps a mortar joint in concrete block. Doesn’t matter what to illustrate the problem.

For the graphics on the LEFT (Quadrants 2 & 3), the gap is just shy of 3/16″ of each side of middle to forced the dimension to round UP. For the graphics on the RIGHT (Quadrants 1 & 4), our gap just heavy of 3/16″ of middle to force the dimensions to round DOWN.

Rounding = Tolerance = Confusion = Mistrust

Let’s focus on the TOP RED in the following illustration…

If you take the two parts and add them, they vary by 1/4″. Adding 3/8″ (our rounded gap size) to either of them does not equal 6″ either.

Quadrant 1: 2 3/4″ + 2 3/4″ + 3/8″ = 5 7/8″
Quadrant 2: 2 7/8″ + 2 7/8″ + 3/8″ = 6 1/8

Between these 2 examples, a mere 1/100″ difference in our gap results in a 1/4″ difference and neither adds up to the 6″ of the total length. This is a 1/4″ TOLERANCE because we set ROUNDING to 1/8″ to match our fabrication accuracy.

If you ever wondered why your shop doesn’t trust your drafting/detailing, this is one reason. The Shop Math just doesn’t add up. They see the sum doesn’t add up to the whole and leads them to question the accuracy of your drawing and your staff.

Rounding = 1/2 Tolerance = Trust

Now lets focus on the BOTTOM GREEN portion of our illustration…

Between the left and right (Quadrants 3 & 4) we’re still making the gap just shy and just heavy of 3/16″ from the center. As you recall, we said our fabrication tolerance target was 1/8″ but here, the dimensions are ROUNDED to 1/16″. This is HALF of our target fabrication Tolerance.

Here, it doesn’t matter of the dimensions round UP or DOWN due to the slight variation in the gap, the dimension are the same. Furthermore, if you add the parts, you get 6″.

Quadrant 3: 2 13/16″ + 2 13/16″ + 3/8″ = 6″
Quadrant 4: 2 13/16″ + 2 13/16″ + 3/8″ = 6″

Same Geometry – Different Clarity

As you can see, we had different results between rounding UP and DOWN when our ROUNDING value equals the Tolerance we’re trying to achieve. When we round to HALF the Tolerance, those small variations are masked and all our numbers add up.

So if you’re dimensioning for the shop, it’s important to realize this little change can mean questioning or trusting your data and staff. Additionally, if you take the time on the shop floor to explain WHY they see these differences, they quickly realize that the information that leads them to question the data (and your people), is also the very same data that’s most likely to be wrong. What IS accurate and didn’t change, is the geometry itself. This is an extremely critical point to highlight if you’re trying to get your shop to use automation and drive machine tools from CAD/BIM geometry.

The model/geometry, is the MOST right data we have. It’s just not human readable and what we provide as human readable is prone to errors such as these. This is one reason you’re seeing terms like “Model Based Enterprise” starting to float around in the Manufacturing space. It’s also a reason you’re seeing more shop go paperless, eliminating dimensions when possible by leveraging automation.

These efforts can be challenging and often require a leap of faith. But if everybody understands dynamics like this, it can be extremely helpful in moving all of your staff to more digital workflows. Because they trust the geometry and you eliminate what’s confusing them.

Autodesk Fabrication 2022 Updates

Autodesk Fabrication 2022 marks a decade that I’ve been updating various documentation for the program. As usual, in recent years not a lot has changed but there are a few changes. Here’s a review of the changes for the data I track…

Revit 2022 – Missing Fabrication Addins (temporary fix)

Update (2020.04.08): Autodesk released the Extension for MEP Fabrication 2022 on April 8th. You can get it from the Autodesk Desktop App or from your Autodesk Accounts Portal (manage.autodesk.com). This restores the MAJ Import/Export functionality and access to Fabrication Reports. It does NOT install the RME to FAB add-in. So part of the below guidance is still needed. You’ll want to copy the ADSK_Export.addin file per the below instructions. The other file is no longer needed and Autodesk’s newly released Extension will overwrite what’s needed if you used the below guidance.


If you’re an Autodesk Fabrication user and loaded up Revit 2022, you may have noticed some key Fabrication Add-ins are missing. It happens most every release. Deadlines for product releases always trump add-ins. This year, all the installers were reworked too so there was extra work I’m sure.

Don’t fear, they’ll get to them eventually. Just keep an eye on the Desktop App for when the updated Add-ins are release. In the mean time, here’s a temporary fix…

Enabling Fabrication Add-ins

To get the Fabrication Add-ins, you’ll need Revit 2021 installed and have those add-ins loaded in there. From there, there’s 2 files you’ll need to copy to a different folder.

Autodesk.MEPFabricationPart.Commands.Application.addin
ADSK_Export.addin

The first file enables MAJ Import/Export and Fabrication Reports. The second file enables the Fabrication RME Extension in the Add-ins Ribbon.

You copy them from this folder…

C:\ProgramData\Autodesk\Revit\Addins\2021

…to this folder…

C:\ProgramData\Autodesk\Revit\Addins\2022

Here’s what that looks like in Windows Explorer….

What This Looks Like in Revit

Once you copy those files, restart Revit to see the changes. Here’s a review of what that looks like…

MAJ Exports

MAJ Import

Fabrication Reports

A Parting Word

It should be noted that this work around should be considered “temporary”. You’re running 2021 Add-ins in 2022. The files you coped should be removed once the official 2022 Add-ins are released. This will ensure you get any fixes they may have added to the 2022 versions.

Script Library Updated / Enhanced

COD Script Library was updated for JOB and LIBRARY Scripts. You can download them for free here. Here’s a summary of changes.


Script Consolidation

In the past, there were 69 to 75 COD Scripts to export all the various properties to separate TXT files. Properties that have multiple entries per ITM like Connectors or Seams are still exported to separate files because the data columns don’t line up between them and there are multiple lines per ITM.

All other properties where it’s a single property per ITM like Spool or Material have all been consolidated to a single script and single TXT file. The WriteAllMiscProperties(Job).cod and WriteAllMiscProperties(Library).cod scripts are where you can extract all other properties so no matter what combination of properties you want, there’s less data files to sort through or scripts to run.


Improved Script Properties Display

The properties scripts were displayed script settings before running the script. They still are but additional properties are displayed where appropriate along with some additional properties the scripts now support (both covered later). In addition to the additional items, you’ll note that clicking the No button no longer cancels the script. Instead, clicking No takes you to the Advanced Configuration (also covered later) where you can change some of those settings.


Advanced Configuration – Scan Folder (LIBRARY Scripts Only)

By default, the script looks to the root of your ITM Library folder of your database. This value can now be changed to point anywhere else. You may want to point to a folder of ITM’s outside your Configuration if that’s where you store your ITM’s. You can also scan further down the folder structure so you can perhaps skip exporting Duct ITMs but instead scan and export Piping ITMs.

Here’s what this looks like. Note that the path may use forward slashes ( / ). You can however paste a new path that uses backslashes ( \ ) and it should still work. There’s no option in COD Scripts to allow you to browse to a folder so make sure you type or copy/paste carefully.


Advanced Configuration – Export File (JOB and LIBRARY Scripts)

Similar to the Scan folder configuration, you can now also change the default export file name and location. Specifications for specifying paths are the same as above.

Also note that while you CAN specify “CSV” as the file extension, I recommend using “TXT“. When Excel sees a CSV file, it just opens it without giving you the ability to specify how data is interpreted. Using a “TXT” extension makes Excel prompt you for “How” the file should be read like which character is used as the delimiter or defining which columns are Text vs other data types.

Some numerical data or values can be interpreted incorrectly by Excel if you don’t explicitly tell Excel to treat them like Text. A good example of this is the size 1-1/2″ or 1-1/4″. Excel thinks these are dates and will display them as 1/1/2012 or 1/1/2014 respectively if you don’t explicitly tell Excel to treat them as Text. Using that “TXT” extension on the export file is a safe guard against this issue.

A lot more detail that you likely wanted but hopefully it’s helpful, here’s what that looks like….

Note you may see an extra slash character between the path and file name. This is can happen if your MAP.INI (Edit Configuration Utility) includes or doesn’t include an ending slash. I may add code to clean this up later but COD Scripts and Fabrication seem tolerant of this extra slash so no need to worry about it (or edit it out if you like).


Advanced Configuration – Folder/Path Wildcard (LIBRARY Scripts Only)

Instead of editing the folder you’re going to scan, alternatively you can specify a wildcard to use to limit which folders to export data from. As an example, you could specify *WELDBEND* and properties will only be extracted for ITM’s within folders containing the name “Weldbend”. Wildcard specification is not CaSe SeNsItIvE. By default, the wildcard is ( * ) to extract from all folders. Here’s what that looks like…


Advanced Configuration – File Wildcard (LIBRARY Scripts Only)

Just like the Folder/Path Wildcard specification, you can specify a wildcard for which ITM files to extract properties from. As an example, you could enter *PIPE* and you would export only from ITM files that contained the work “Pipe”. Again, the wildcard is not CaSe SeNsItIvE. You can use both Folder and File wildcards to very narrowly specify your data export scope. Default wildcard is an ( * ) to extract from all ITM files. Here’s what that looks like…


Advanced Configuration – Delimiter (JOB and LIBRARY Scripts)

Data exports by default use a Comma ( , ) to create a Comma Separated Value file. If your Fabrication Database uses commas in folder names or ITM file names this can cause data fields to shift in Excel when opening the export file. If this is the case for you, you can specify a different character to use to separate the data fields in the export file. The Pipe ( | ) character is always a good “rarely used” character for this purpose.

As a side note, it’s not a good practice to have commas in folder or file names. You can read more about that here. This option is really here in case you’re stuck with commas and haven’t fixed them yet.


Advanced Configuration – Max Custom Data Index (Only Scripts that export Custom Data)

Only used for scripts that export Custom Data, you can specify the maximum Custom Index value. Unfortunately, COD scripts have no ability to determine how many custom data entries you have or which index numbers are used without jumping through some hoops. To work around this, you need to specify the maximum Custom Data Index value. The script will then loop through all those numbers and find which ones contain values and remembers them. It then exports only those custom index values so that the script runs efficiency.

By default the script uses 5000 as the maximum index number. But as you can see from the below example, the maximum index number is 10000 so we need to specify that. We look at all 10000 possibilities (it goes fairly quick) and takes note that there’s only 8 indices used and then extracts only those 8 from the ITM’s. In the past, the script would loop through all 10000 for each ITM really slowing things down. Now, even if your largest number is 6 or 7 digits (not recommended) the script will still be fairly quick.

Here’s what that Delimiter Character configuration option looks like…


Summary

In the past, if you didn’t like the export files names, where they went, or wanted to change the scope of which files or folders you extract data from, you could have always changed the COD script code yourself. You now shouldn’t have to. Hopefully this makes running these scripts a little more flexible and user friendly.

COD Script Extension for VS Code

If you write COD Scripts for Autodesk Fabrication, take note. There’s now an Extension for Microsoft Visual Studio Code (VS Code) which is Microsoft’s free code editor. If you use Notepad or Notepad++ to edit your code today you may want to consider switching. The COD Extension has some really nice features. Color coding of your code is the most obvious as shown below. However, there’s a lot more than just color coding. Features like Auto-Complete, Folding Sections and Dimension/Option Picker are nice additions in addition to a lot more robust documentation.

Installing The Fabrication COD Extension

If you don’t already have it, you can download and install VS Code here…https://code.visualstudio.com/. Once installed, go to the Extension section, type FABCOD and click the Install button.

Extension Summary

Once you’ve installed the Extension, you can review a summary of extension details here…

From here, you can review a couple of the key features and their keyboard shortcuts….

VS Code Feature – Mini-Map

Not a feature of the extension, but one reason VS Code is a nice editor is the Mini-Map which helps you visualize where you are your code.

FABCOD Extension Feature – Folding

One of the features the FABCOD extension exposes in VS Code is the ability to collapse/expand sections of code for Looping and Conditional function and other areas. When you move your cursor to the left margin, you see symbols that activate this functionality called Folding.

In addition to Folding sections of code, you can create your own areas of code to collapse/expand. These are Folding Regions and can be inserted (or typed manually using the proper syntax) by highlighting the code and pressing CTRL+SHIFT+/.

FABCOD Extension Feature – AutoComplete

Auto-Complete is another core feature of any code editor. VS Code’s Auto-Complete features is leveraged by the FABCOD extension. You’ll need to be editing a saved file with a COD file extension so the VS Code extension knows which code extension to use.

ABCOD Extension Feature – Hover Tips

If you hover over known functions/properties and their context can be determined, VS Code will display a tooltip for the function you’re hovering over. This can be a great way to learn coding as it’ll help you with the syntax.

FABCOD Extension Feature – DIM / OPTION Picker

One of the best features of the FABCOD extension is the ability to get suggestions for the Dimension (DIM) and Options. You can activate the DIM picker with SHIFT+F1 and the OPTION picker using SHIFT+F2 keyboard shortcuts. When using these features, you are presented with an edit box. You type the CID/Pattern Number you’re interested in and press Enter. You are then given a list of Dimensions or Options you’re interested in. It’s not fool proof because some patterns have variable DIM/OPTION values but it seriously helps none the less. Take a look here…

FABCOD Extension Feature – Additional Help

Sometimes you need added help for a function. The FABCOD extension is an open source project on GitHub (https://github.com/AgileBIM/FabCOD). This project contains added help for every function and property and is Auto-Generated and updated as the extension is developed. You can access this help from any of the popup ToolTips by clicking on the BLUE hyperlinked text.

FABCOD Extension Feature – AutoCAD Launcher

One of the other neat features of the FABCOD extension is the AutoCAD Launcher. Pressing F5 in the editor will initiate the script in CADmep. Simply Alt-Tab to AutoCAD and press enter. AutoCAD and CADmep must be loaded at the time for this to work. Due to Autodesk’s limitations in their API’s, this functionality does not work with ESTmep or CAMduct.

VC Code FABCOD Extension – Wrapup

There’s a lot more to VS Code that I won’t get into here. I’ve only covered the highlights of how it and the FABCOD extension can be used to help edit COD file in Autodesk Fabrication. As it’s an open source project, there’s instructions on how to become involved if you have the coding skills. You can also just head over and log issues or suggestions. (https://github.com/AgileBIM/FabCOD)

Fabrication Job Contains No Parts – Possible Fix?

Have you ever tried importing an MAJ into Revit and received the following error….Fabrication Job Contains No Parts.

There’s a lot of reasons this can occur and it’s NEVER because there are no parts. So much for Autodesk’s QA/QC and Error checking.

You may see this most commonly because parts used in the model contain data that’s no longer in your database. You’ve likely noticed from time to time database entries with curly braces around parts of the name like the following…

This happens when an entry in the database is used by an ITM but the database entry itself later gets deleted. Information is cached within the ITM so when it’s accessed, it creates a Proxy entry in your database if it was missing. Within the {Curley Braces} is the name of the object that created the entry.

While CADmep, ESTmep and CAMduct handle this fairly gracefully, Revit on the other hand does not. When it attempts to load an MAJ, it sees these entries and notices they’re missing from your database and prohibits you from importing the MAJ file. Revit thinks the database doesn’t match the MAJ and stops you cold!

A Possible Fix

If this is cause for the import error, you can use the following COD script to potentially work around the issue….

Take the following script and run in in CADmep, ESTmep or CAMduct. You should be logged in with Administrative Permissions while doing this. This script isn’t fixing Revit or the MAJ. What it’s doing is loading ALL the ITM’s from your Database Library into memory.

The process of loading all these ITM’s into memory creates all these proxy entries in your database. This way, when Revit attempts to import the MAJ, the data associated with those ITM’s are most likely present in your Database configuration. In many cases then results in a successful import of the MAJ.

If the Revit file you are importing the MAJ into already points to a Fabrication Configuration, you should reloaded the configuration FIRST before attempting to import the MAJ.

If for some reason this process still doesn’t work, verify that Revit is reading from the same database location as the version of CADmep, ESTmep or CAMduct where you ran the COD script.

In the event it still doesn’t work, there may be other reasons for the failure but this is often the most common, especially with MAJ’s created recently.

If it does work, you’ll want to use the other scripts I provide on this site to help analyze your database. You likely deleted those database entries in the first place for a reason. You either didn’t realize they were needed, or you didn’t know where they were used to repoint those ITM’s to a proper substitute. Those scripts can help you find which ITM’s use which database entries.

Hope this helps.

More Fabrication Scripting Updates

Autodesk Fabrication Scripting resources have had a few updates more updates. Believe it or not, the 22 ADD/REMOVE functions that apply to ITM Product Lists have been on my “Undocumented Functions To Research” list for over a decade. I’ve finally gotten around to figuring out how they work and documenting. Here’s a summary of the changes…

  • Global Miscellaneous Functions
    • Added ERROR function
  • Item Function Reference
    • Added function ADDALIAS()
    • Added function ADDAREA()
    • Added function ADDBOUGHTOUT()
    • Added function ADDCADBLOCK()
    • Added function ADDCUSTOMDATA()
    • Added function ADDDATABASEID()
    • Added function ADDDIM()
    • Added function ADDFLOW()
    • Added function ADDOPTION()
    • Added function ADDORDER()
    • Added function ADDWEIGHT()
    • Added function REMOVEALIAS()
    • Added function REMOVEAREA()
    • Added function REMOVEBOUGHTOUT()
    • Added function REMOVECADBLOCK()
    • Added function REMOVECUSTOMDATA()
    • Added function REMOVEDATABASEID()
    • Added function REMOVEDIM()
    • Added function REMOVEFLOW()
    • Added function REMOVEOPTION()
    • Added function REMOVEORDER()
    • Added function REMOVEWEIGHT()
    • Added function SETDONOTCUTFLAG()
    • Added function ADDLINK()
    • Added function DELETELINK()
  • File Object Function Reference
    • Added function SEEKENTRY()
    • Added function SEEKLINE()