Two questions: Element.Location node and Python Script


Just started using Dynamo for Revit a few days ago and I have something of a slightly embarrassing question at first:

1a. Where do I find the Element.Location node? I’ve seen it in multiple images and thought I’d use it but I thought I’ve scrolled through all nodes with “Location” without finding it and my search doesn’t seem to do the trick.

1b. Related to this. Is there some PDF, or similar, with all the nodes listed and in which sub-categories they are found?

  1. How do I get out data from lists. I’m a bit confused with how these objects/lists are structured.

How do I if I want to get the first element from the incoming list to a Python Script?

For example the notation [0] won’t get e the element with index zero, but rather the incoming nodes input value.

So if I’d for example be interested in getting the offset of the 26th element, then is that data available by doing something along the lines of “object[26].Offset” here? (Can’t post another image of what I mean)

(I’m using Dynamo 1.3.1)

1a) Element.Location is in the Clockwork package, which can be installed from the package manager (click add at the bottom of the library, and then click search for a package). You can sometimes use the Get.Location node in place of the Clockwork node.

1b) These sites have some really good content for learning what is available.

  1. This sounds like it is more of a Python question than a dynamo question. Data in lists is data. How you deal with the data depends on what you are trying to do with it in Python. I think a follow up image may be required here so I understand what you’re after.
1 Like

As @jacob.small said, you’ll have to show an example of what you mean for question 2. The notation that you mentioned is the correct way for getting objects in a list, in both Design Script and Python.

Thanks for the answers so far.

So this is what I try on in the 2nd case: I’d like to have the Offset for all the elements on a level, to make different adjustments to them in relation to what offset they are at now:

So this is one notation I attempted:

The Warning I get (and no output to the watch node) is: " File “”, line 8, in
AttributeError: ‘list’ object has no attribute ‘Offset’"

First, dataEnteringNode is a list of the node inputs. It’s stating that each input entering the node is a list IN. You’ll notice a Python node can have n number of inputs IN[n]. You have to define these inputs as such:

Second, elements to not have a member Offset. Offset is a parameter available to specific elements, so you’ll want to use Element.GetParameterValueByName to get the value of the input parameter Offset.

1 Like

Thanks for this. This clarifies it. I will just have to get used to this environment. :slight_smile:

@M1k3y, you may want to run through the dynamo primer, cover to cover, prior to getting too into the weeds with python. It will likely save you a lot of frustration down the line.

1 Like

you can also use the GET LOCATION oob node for your Revit elements.

1 Like

Thanks again, I will look at that option as well.

And I will definitely take read through the Dynamo Primer. I had started with the first chapters but had perhaps a little over-eagerly ventured out into this world.