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()

Autodesk Fabrication Scripting – Did You Know?

In the list of COD Scripting updates I just posted, there’s a couple undocumented functions that have been on my list to explore for more than a few years. I’ve finally gotten to them and figured out what they do.

I won’t comment on how long it took me to actually explore what I had listed in my “To Research” list for years other than to say, Procrastination is a Virtue for those with no Patience.

So without further delay…here you go….


Output Function

This first one is the OUTPUT function. You can call it a couple different ways, with and without parenthesis just like the DEBUG function. It doesn’t really seem to matter. It’s really kind of a worthless function in my opinion.

Not only does it only work in CAMduct and ESTmep (not CADmep) it really isn’t that helpful. It just outputs a message to the Console window. I was initially hopeful it would allow me to “script” some of the secret Console command but no such luck. It’s just a message.

You can see in the COD Code editor the below with both syntax examples…

When you run the script, it’ll call up the Console and display the text you specified. You can see from the following example, it doesn’t even space the text when you call it multiple times. Even tried embedding a Carriage Return in the string and still no luck automating via the Console.


Breakpoint Command

The other command is much more helpful and something most folks don’t know about. I have run into a couple now who knew but most it’s not known. I wish I knew years ago…it’s actually a small step closer to what you’d expect in a modern IDE (Integrated Development Environment).

The Breakpoint function calls up the panel on the right. It displays the values of all your variables. You can see how the value of the “z” variable is displayed. When you hit a Breakpoint, code execution stops until you hit the green arc’d arrow. Code execution then continues until you get to the next Breakpoint if any.

You can access the COD Script editor in CAMduct or ESTmep using the FILE pulldown menu. You can also use the editor in CADmep but unfortunately, there’s no way to display it without writing intentionally wrong code to cause your program to fail and display it. You can then use the editor like you do in ESTmep or CAMduct.

One thing to note, BREAKPOINT only appears to work when you execute code from the Script Editor. If you call it from AutoLISP using (executescript “myscript.cod”) or the EXECUTESCRIPT command in CADmep or by right clicking in your Takeoff items in ESTmep or CAMduct, it runs without stopping your code. This means you can leave the breakpoints in your code and edit/debug via the script editor but not have to remove them when executing them un a production setting.

Fabrication Scripting Updates

Autodesk Fabrication Scripting resources have had a few updates. Here’s a summary of the changes…

Fabrication “Edit Configuration” Utility Documentation

I’ve added documentation for thee Autodesk Fabrication Edit Configuration utility to the site. You can find it here or in the Fabrication menu.

This utility is fairly misleading. Because it prompts for a Database Configuration, most people think the settings apply to the selected configuration. While some of the settings are saved in the MAP.INI and therefor specific to a database configuration, not all are. Many are saved in the Windows Registry.

How Settings Work

Settings stored in the registry need to be made for each program, program version and user. That is, if you make changes to settings stored in the registry using CADmep, they only apply for CADmep. If you’re using ESTmep, you need to make the changes there too. Additionally, if you use the utility that ships with the 2020 version of CADmep, they won’t apply in the 2021 version of CADmep without making the changes there too. Lastly, the only apply for the user who is currently logged in. Log in as another user and all those settings needs to be changed again.

This is the reason I typically make the changes directly using registry edits or automation that imports the registry changes. This allows me to ensure I’ve not missed anything and that they get set no matter the user.

Edit Configuration Utility Tricks

The Edit Configuration utility itself is confusing. The utility ships with each Fabrication Program (CADmep, ESTmep, CAMduct, CAMduct Components, Remote Entry and Tracker). The same utility will present slightly different options depending which folder it is run from. And to add to the confusion, the shortcuts are all named identically.

To make it easier, I go to the folder with the shortcuts and rename them. From “Edit Configuration” to “Edit Config (CAD21)” and similar. This helps me know which program I’m calling the utility for.

Even if you don’t edit the MAP.INI file or Windows Registry directly and instead use the utility the documentation is helpful for letting you know where the settings are stored. This helps you know how to edit them to your needs.

Updated From Prior Documentation

If you’ve attended any of my prior Autodesk University or MEP Force conference presentation, you may already have a copy of this documentation. However, I’d encourage you to use the version I’ve posted no this site. Not only did I add information for the CAMduct Components, Remote Entry, Tracker and Fab Review applications, I’ve also fixed some errors and typos in the prior existing data.

Stratus Dashboard Header Trick

Quick little Stratus tip. This on for headers on your Dashboards. A normal dashboard doesn’t have the ability to customize the header. However, being Stratus is a web based application, you can inject some simple HTML tags to perform some limited modifications.

Take a look at the following headers….

These headers are a result of inserting some very simple HTML tags. Here’s a look at the Report configuration for these header modifications…

Here’s an explanation of these HTML Tags…

HTML Tag(s)DescriptionUsage
<br>Break Line / Carriage ReturnPlace between text to create a
new line
<i> </i>Italics Text placed between these tags will be italic
<u> </u>UnderlineText placed between these tags will be underlined

A few things to note…

  • You can nest <i>Italics</i> and <u>underline</u> to transform text to <i><u>both</u></i>.
  • More complex HTML tags don’t work, there’s just too many special characters.
  • HTML tags may (will) show in other places like in the output of CSV files and/or other types of reports.

The usage of HTML tags in your Dashboard headers is likely not supported. If you find any errors within Stratus on pages that you’ve used these, you may want to remove them to verify the special characters aren’t the cause of your issues.

Autodesk Prior Version Access – A Bad Good Idea

Autodesk recently made a policy change to its prior version usage policy. Previously Autodesk’s policy was to allow customers current on subscription or maintenance to run the current release and the prior 3 versions. However this policy recently changed on November 2, 2020 to allow 5 prior versions.

You can read about that policy here.

One important thing to note however, is this change does NOT affect support. Autodesk Support will only help you with the 3 prior versions.

Because it was likely what customers wanted, it sounds like a good change . But it’s really bad news for the industry. The intent was to help customers who were not able to upgrade for some reason. But this change wasn’t needed to serve that purpose. Autodesk would (and did) grant exceptions from the “3 prior version” terms on an as-need basis. Whenever you needed an exception, just ask your reseller. They could then request an exception from your regional Autodesk rep.

Unintended Consequences

This change is bad because it’s one more reason customers can use to not upgrade. That’s not the purpose of the policy but it will be the result. Because most customers are now on subscription, the policy really doesn’t affect Autodesk’s revenue. As such, it was really not hard for them to do. You still have to be on a subscription plan.

When customer’s don’t upgrade, they don’t benefit from new features and functionality. In the case of MEP, Fabrication Parts are still relatively new to Revit. This means there are significant functionality improvements in newer versions. But because there’s not as many improvements for Architects, they may not upgrade. And because they lead on the project, MEP has no choice but to use the version the project team is on. This easily leads to a significant lost productivity and added cost for MEP contractors.

Policy Summary

VersionOld PolicyNew Policy
2021 (Current Version)Allowed / SupportedAllowed / Supported
2020 (1 Prior Version)Allowed / SupportedAllowed / Supported
2019 (2 Prior Version)Allowed / SupportedAllowed / Supported
2018 (3 Prior Versions)Allowed / SupportedAllowed / Supported
2017 (4 Prior Versions)Prohibited / No SupportAllowed / No Support
2016 (5 Prior Versions)Prohibited / No SupportAllowed / No Support
2015 (6 Prior Versions)Prohibited / No SupportProhibited / No Support

Digital Transformation for the Average Contractor (Part 4)

This is my 4th and last article on Digital Transformation for the average contractor. The whole point of this series was to help companies understand that they don’t need to know what the future holds to prepare for it. If you missed them, the other 3 articles can be found here…

In this article, we’ll look at an action plan. By using this plan, you can help focus your efforts.

A 5 Step Action Plan

It can help to prioritize with any effort. Because there’s a lot to do, it’s easy to get lost in all the work. Your action plan may look different and it should be if your needs are different. However, these 5 steps are a good starting point.

Step 1 – Mitigate Current Risks

You might have existing risks because of prior actions. You can only mitigating these risks if you identify them. Review what you’re currently doing because that’s likely where they are. However some risks may be due to what you’re not doing. Here’s some ideas to get you thinking….

  • Is your data backed up? Not just server data but cloud systems, machine tools, etc.
  • Are you managing user accounts in all your technology systems?
  • Do your advanced or complex configurations have documentation?
  • Is your data accurate (BIM Content, Models, Standards, etc.)?
  • Are users trained in proper processes and technology usage?
  • Do all your technologies have an “owner” or responsible party?
  • Is Staff cross trained or does your technology and processes rely on only one person?
  • Who is maintaining your standards? Is there even governance around them?
  • Are there things critical to your organization controlled by others outside your organization?
  • What things have “Single points of failure”?

Step 2 – Reduce Waste and Inefficiencies (Create Value)

Your next step is really something you likely do already. Reducing waste and inefficiency. However it’s a good idea to revisit occasionally. After you’ve documented your workflow, developed a new workflow or changed your technology. It’s good to revisit how these things impact your efficiency and drive value. Some general thoughts that can apply to most company…

  • Are users aware of how your technology should be used (training)?
  • Do you have under utilized or misused technology or processes?
  • Duplicate technology for the same purpose?
  • Are there things you do that are easily outsourced?
  • What can be automated but isn’t?
  • Do new cloud workflows represent what should happen or did you simply move your existing processes into the cloud?
  • Are your computers or hardware setup consistently, maintained proactively or built with automated processes?

Step 3 – Missed Opportunities

One area people don’t think about enough is missed opportunities. You’re always watching costs vs benefits. Results of doing things. But what’s the cost of not doing something? What’s the cost of missed opportunities? These could come in many forms. It’s best to build your own list but here’s a few examples…

  • Leverage knowledge from existing staff
  • Free or joint marketing from vendors or customers
  • Missed value you could sell if you were leading edge with technology
  • R&D opportunities with technology vendors
  • Existing competencies not marketed properly

Step 4 – Prepare for the Future

This step is really what Part 2 and Part 3 of my series was about. These are things you can do now, despite an unknown future. There’s a lot you can do right now that sets you up for success down the road. However you don’t need to wait until the first three steps are done. You can start chipping away at these now. They just shouldn’t be your primary focus until Steps 1 through 3 are well underway. Here’s a few ideas, feel free to add your own…

  • Document existing processes
  • Develop ideal workflows
  • Start building missing competencies in staff and departments
  • Restructuring existing technology stacks
  • Capture wisdom of staff nearing retirement
  • Reverse mentor older staff by tech savvy younger generation

Step 5 – New Strategic Opportunities

This step is the hardest to provide guidance on. It really depends where your company sees itself going. The skills they have can help differentiate itself in the market place from others.

Here’s were an ear to the ground can be helpful. Trying to anticipate what trends in construction may be fads vs long lasting or even transformational. How can you leverage them? How can you change your business to remain relevant? Regardless of the future, if you’ve followed all the other guidance, you should be able to easily adapt when these trends emerge.

  • Will you be a manufacturer in an “Industrialized Construction” economy?
  • Do you have staff capable of developing prefabrication or modularization strategies?
  • Are you able to be an efficient supply chain provider?
  • Can you help your customers with smart building technology?
  • Will Machine Learning or Artificial Intelligence render you obsolete or is it simply a tool you use?
  • Who are the new players in the construction economy and is there value you can bring to them?
  • How can you capitalize on the struggles of your competition?

Summary

Aside from here in Step 5, everything in this series of posts are things you can start doing right now. They’re things that don’t require a prognosticator’s view of the future. Yet they’re all things that will help you be more agile and able to adapt when trends or disruption comes knocking.

You don’t have to worry about the future to prepare for it. There’s enough to do right now that you can stop worrying. More than likely, at some point you’ll take notice and see you’re living the future. The actions and choices you’ve used to prepare you allowed you to tackle the future without even realizing it.

Make smart choices. Stay busy. Stay Relevant. You can eat the future one small bite at a time.