How to replace code "Name" in python

i would like to know that how can rewrite the below image in python

image

If the Element has the Name property, you can call it like this:

http://www.revitapidocs.com/ is a good place to explore stuff like this.

1 Like

thank you

how do we know an element have a Name property or not?
(May be my question is stupid, i am new in dyanamo and python)

Check the API docs as noted above, or ask it if it has a name via a quick code block:
a.Name!=null;

2 Likes

@shibujoseukken,

I know the ability to create your own stuff by utilizing Python scripting and interacting with the Revit API, is very exciting, and that it opens up almost endless possibilities regarding costumization of the software. That being said though, an old saying goes: You need to learn to crawl before you walk. A cliche perhaps, but it’s very much spot on.

Getting a Property from a Revit element is probably the most basic piece of information you can extract, and if this is causing you problems (judging from this post and the other one you made about rooms), then you need to do more research on your own. And I mean this in the nicest way possible :slight_smile:

So a general advice from this community is: You need to learn some basic Python at first, before you take on the beast that the Revit API is. And yes, the learning curve is steep in the beginning and a lot of the basic python tutorials will not be very exciting, but the payout in the end is worth every minute you put into it.

A good place to start could be something like this:

There’s a free basic python course.

There’s also Jeremy Grahams Dynamo Python course on Lynda.com if that is something you have access to.

Good luck.

1 Like