Skip to main content

Does the parameter exist?

I'm back after a while with a new article on Dynamo. This time I'll try to explain how to check if a list of parameters are available in the project. This can be used as starting point to QA a model against a pre-defined template.

The idea is pretty simple: we need to extract all the parameters from the model and to do this we list all the elements of type "ParameterElement". You'll get the list of both shared and project paraemters in this way.
Then we can extract the paraemters names and create a list of paraemter that we want to check (this list can be also an input from Excel).
Whit a simple Python script that compares all the parameters name, agains the list of predifined parameters, we can easily extract two lists: the first is the list of matched and the second is the list of unmatched.
This is the python code.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

paramAvailable = UnwrapElement(IN[0])
listOfParam = UnwrapElement(IN[1])
lstFound = []
lstNotFound = []

for p in listOfParam:
    c = 0
    for l in paramAvailable:
        if (l==p):
            c = 1
    if (c == 1):
        lstFound.append(p)
    else:
        lstNotFound.append(p)

#Assign your output to the OUT variable.
OUT = (lstFound, lstNotFound)

Are you sure you don't want to learn how to code?
Enjoy,
Cesare

Comments

  1. I cant seem to get this to work at all. Breaks at the first run.

    ReplyDelete
    Replies
    1. Never mind it worked used the parameter Element type and not Element Types

      Delete
  2. Kenco Electric India Private Limited is a trusted and reliable (EPC) Contractor. This company is one of the top Electrical EPC Contractor In the Northern Region and other parts of India.
    Kenco Electric

    ReplyDelete
  3. Kenco Electric India Private Limited is a trusted and reliable (EPC) Contractor. This company is one of the top Electrical EPC Contractor In the Northern Region and other parts of India.
    Kenco Electric

    ReplyDelete

Post a Comment

Popular posts from this blog

Tunnel modeling with Dynamo

Introduction Last week I had a nice conversation with one of my Italian friends. The focus of the conversation was how to model a tunnel in Revit starting from an Excel list of points coming out from Civil 3D. So the answer was: Dynamo of course! First input, the section of the tunnel with his diameter; I can't share the details but lets say that we have: Theoretical excavation profile: 200 mm  Precast segment thickness: 500 mm Whit this two elements and the excel of the theoretical cent alignment, we can do everything! Revit profile family The first family we're going to create is a simple circle profile with a diameter parameter. This family will be as a mass category to be able to nest it later in an adaptive component family for the tunnel.  Just save this family...easy! Tunnel model Now we can create a new family as generic adaptive component and load the profile just created. It's important that the family is able to host rebars for future st

Dynamo, Revit, Excel, UI...what a wonderful day!

Introduction Today I'll show you two examples of how to use Dynamo to export existing Revit schedules and how to compose a custom schedule on the fly, to be exported to Excel. Both of them with a very nice graphical user interface thanks to Data-Shapes (https://data-shapes.net/) package. Export Schedules Let's start from the easier. The idea behind this script is to export a list of existing schedules to an Excel file, creating for each schedule a separate tab. To be able to complete this script you'll need two packages: Data-Shapes for the graphical interfaces BimorphNodes to extract schedules data The script is very easy and you have to focus only on how to create an interface Then you can use your input to feed the next nodes. Finished! So just push the run button (or use Dynamo Player is you are in Revit 2017.1 or 2017.2) and enjoy the interface. Export parameters to Excel In the second script I'll focus on something more int

Multi-pipe support configurator with Dynamo

As always everything is coming from my childhood…ops no, that's another story. As always everything starts on a white recycled paper just in front of my keyboard; a simple idea becomes immediately a sketch with Revit parameters. I tried many times different kind of plugins for automatic supports placement, but no one of these is able to create a multi-pipes supports (if I'm wrong, please let me know the name of the plugin). The idea for this script in Dynamo, is to create a support for a bounce of pipes going parallel for a while, and create a group that is possible to copy along the path. I'll not focus on the creation of the families that you need for the support but just to explain the main idea, I have 3 different pieces (steel bar, u-bolt and threaded rod) that I'll compose together to create the final support. The first challenge is to align the pipes to the same BOP (bottom of pipe) because they have to stand on the steel bar and locked with the