Processing Materials lists

Hello all. I am brand-new to Dynamo, but have moderate experience with “old school” coding using tools such as AutoCAD Scripts, AutoLISP, and Visual Basic (the old form, not VB.net.) I work for a mechanical consulting firm, and one of my “sanity-challenging” tasks that would be better off if automated is the processing of Architectural files for linking into our Revit model. Specifically, my processing of these files involves:

  1. Removing non-essential views & all architectural sheets to cut down on file size.
  2. Stepping through the Architect’s material list, and changing the Surface and Cut patterns of all materials to “none”. This is done, in addition to Halftoning the Architect’s model, to lighten up the Architectural “Base Plan” in order to make MEP elements and features stand out better against the background on our drawings. This is also the step with the potential for error generation, because some Architectural and/or Electrical elements are dimensioned directly from a Surface Pattern feature. Therefore, what I’m looking to create is a Script that will:

A) Step through the materials list.
B) Test the Surface and Cut Pattern name of each material except Acoustic Ceiling Tiles for
"none" condition.
C) Change the Surface and Cut Patterns of each Material to “none”, if it is not already so.
C) “Apply” the change for each material, pausing for regeneration, and testing for error messages each time a change is made. (Typical error message: “Unable to cut an element out of its host…etc.”) If an error message is encountered, “Cancel” is invoked, and the process is repeated, skipping the material that caused the error.

When doing this process manually, I run into hundreds of materials sometimes, and the process involves clicking on the first material, then clicking alternatingly on the down arrow, and “Enter” keys, all the while watching the Material Browser dialogue box for patterns. If I find one, I change the pattern(s) to , then click Apply, waiting for an error message. If I don’t get an error message, I then have to manually click on the next material in the list, to shift the focus back to the material list. Then, it’s back to Down Arrow/ Enter until I encounter the next pattern. Lather/ rinse/ repeat, ad nauseum.

This manual process is maddening at times, and I have to repeat it every time the Architect updates their Revit model. I realize that this won’t be a simple “fix” so, if anybody can point me in the right direction to learn how to assemble the pieces of what I need, I’d be most appreciative.

Hi Wallace. I can give you a suggestion without Dynamo and then you can create a Dynamo routine to do it for you. Usually, when a file is linked in Revit, you can either created a template that you would apply to all views with the settings that you desire. In the template, there will be a tab that will manage Revit Links. Once you click on this tab you will be presented with a all linked files. Choose the desired linked file (Architectural model in your case) and click on the Display Settings of it, which by default displays the “By host view” value. Once opened, under the Basics tab choose the “Custom” option in order to allow users interaction with the displaying of elements from the linked file. Once done, you can change tabs, such as the “Model Categories” one, change the value to “” again, and make the necessary changes to Projection/Surface_Lines/Patterns/Transparency as well as to the Cut_Lines/Patterns to suit the desired graphics. This should help you to apply this template to all your projects without having to make any modifications to the materials themselves.

I hope this can be of a help.

Kind regards, Haley Bueno.
<img



<img src="//discourse-cloud-file-uploads.s3.dualstack.us-west-2.amazonaws.com/business6/uploads/dynamobim/original/2X/2/2e8dbfd32bbc51fb6dcf9a3cc1c1acec40129c77.PNG" width=“611”