Love the explanation and how you delved a bit further into the API for things that aren't just on the surface like others do. Also thank you for touching on filters, it's definitely a broad topic but another perspective is always informative.
Thank you! I will eventually cover filters in more depth, but for now you can check my guide for FEC and Filters with examples and explanation if you want to learn more about them.
This is super helpful! I went and made some collector functions based on this code and added them to my lib file I started. But you gotta let me know how to put a list in multiple lines like that when you are making you category list.
Thanks, I hope I understood your question right. It has been a while since I made the video. 1️⃣In python if we break a line and leave '\' in the end, then python reads next line as part of the current line. e.g. FilteredElementCollector(doc).OfClass(Wall).ToElements() FilteredElementCollector(doc) \ 👈 .OfClass(Wall) \ 👈 .ToElements() Usually IDE(at least pyCharm) adds this automatically when you break the line. 2️⃣ However, if you meant lists, then we don't need this sign because lists are covered with square brackets on both sides, and python knows. There you are free to break it into multiple lines. Just keep track of commas. e.g. [1,2,3,4,5,6] [1, 2,3, 4, 5, 6] I hope I answered your question. If not feel free to expand your question on that. Happy Coding!
Glad you liked it! Unfortunately, I have no time for that at the moment. But I will have a phase when I will write more guides and update this one along the way as well. P.S. If anyone know nice E-Book online writer let me know. I need something that supports code snippets, so it's not images but an actual text that can be copied. So far I think I might do it in Figma due to higher customizability, but that's not the final decision.
What I really need is to understand how to pass a list or filtered elements into a dialog like the PyRevit "Select From List (Single, Multiple)" dialog. Would also like a video on how you make the dialogs for your EF Tools commands.
Noted. I have a video in mind for pyRevit input forms, but I am quite busy with many other video ideas for now, hopefully get to that one in a few months. I create my GUI with WPF, and it's quite advanced from my opinion. I will eventually try to make some tutorials on the topic, but I will leave it for the end, I try to focus on more basic concepts for now.
Thanks, Appreciate that! Currently I am at the capacity. I wanted to make a small community as well, but then I realized I wouldn't have any time for that. There is an online pyRevit forum which is quite active. discourse.pyrevitlabs.io/
I have been struggling with selecting elements in a given view that is both in the current model and in linked models. Does the filter element collector work for linked models as well?
Usually, we need to provide doc variable of the project we want to get our elements. if you want to get Linked elements, then you need to find and pass doc from linked model. I am not sure if we can provide linked model and then provide a view from another project. I believe there should be a way to achieve that but I haven't tried to get it like this yet.
@@ErikFrits much appreciate response! I am interested in programmatic approach to grab elements from current doc and all visible linked elements as well…perhaps a topic of a future video if you ever are able to crack the code ;) 🙏
Hi, erik! i have seen your tutorial and by the way i have learned a lot, thanks! i have had some difficulties to understand the VARIABLES and i did not understand when you used active_view = doc.ActiveView. Do you know where i can learn more about it?
You might need to check some python basics course. CS50 Introduction to Python by Harvard is a popular free course on edx.org platform. I would recommend start there
I haven't worked with rebars in Revit API, but usually there is a property 'Host' that returns an element. Have a look inside of Revit Lookup For example: if I have a variable window. I can get its wall something like this: wall = window.Host Or if you have a list of windows and you need a list of hosts: walls = [window.Host for window in all_windows] If you new to parameters in Revit API, I have another video which will show you all you need to read and set parameters ;)
Hey Erik, I really learned a lot from your videos! I am really stuck at the moment with using a doc-changed hook, it seems to be impossible to use transactions with it (edit a parameter). Maybe you have some knowledge about this?
@@ErikFrits Thank you! There seems to be an issue where my comment keeps getting deleted whenever I send a link to a gist with the code... Is there any other way I can send this to you?
That could happen for sure!. CZcams comment moderation system is weird, because it does not even let mee see them to approve or disapprove... Reach out to me in LinkedIn.
Do you get other Revit API Autocomplete suggestions? If No, did you add Revit API stubs in your virtual environment in pyCharm? I have a video on adding Revit API Autocomplete in pyCharm for that.
Hello i would like to know if there is a way to install my plugin in a .exe file or a .msi file and not have to install pyrevit to add the extensions. thank you very much for everything.
python is not supported in Revit by default. you need pyRevit or RevitPythonShell to run python scripts, therefore you need pyRevit to have EF-Tools extension.
@@ErikFrits For example once I have made my own extension, then I could not create an .exe or .msi file type? Isn't there a way to do this? (move from python to C# language)
@@giancarloarciniegas8466 you can definitely make this with C#, but with python I don't think there is a ready solutions for that. You would need to create some custom plugin to display and run your python scripts in revit. You probably can use RevitPythonShell or pyRevit as a base and build on top of it something custom. Not an easy. Try searching in Google, maybe someone has solved this problem already and shared solution.
@ErikFrits based on what I did so far with linework it looks like it's possible to get everything I need for linework with importinstance. There is nothing for text however. I started implementing what it looks like everyone else does, export to dxf and read that file for text info.
Hey@@ErikFrits , I'm here again. Is there a way to retrieve all structural and architectural elements, or do I have to specify all the structural and architectural categories and use the FilteredElementCollector method?
@@FelanaDiamondraRANDRIAMADISON You still need to use FilteredElementCollector. You can use .OfClass or OfCategory to get desired elements. If you decide to use OfClass, be aware that certain classes are located in discipline namespaces like Autodesk.Revit.DB.Architecture, Autodesk.Revit.DB.Structure and others.
📘 Get your FilteredElementCollector Guide:
ko-fi.com/s/14b0b8e31c
Love the explanation and how you delved a bit further into the API for things that aren't just on the surface like others do. Also thank you for touching on filters, it's definitely a broad topic but another perspective is always informative.
Thank you!
I will eventually cover filters in more depth, but for now you can check my guide for FEC and Filters with examples and explanation if you want to learn more about them.
Easy, simple, powerful💪
This is the way! 😈
Yes, please It would be Great if you create a video for filters Like BoundingBoxIntersectsFilter
I might write a newsletter episode about that one 😉
This is super helpful! I went and made some collector functions based on this code and added them to my lib file I started. But you gotta let me know how to put a list in multiple lines like that when you are making you category list.
Thanks, I hope I understood your question right. It has been a while since I made the video.
1️⃣In python if we break a line and leave '\' in the end, then python reads next line as part of the current line.
e.g.
FilteredElementCollector(doc).OfClass(Wall).ToElements()
FilteredElementCollector(doc) \ 👈
.OfClass(Wall) \ 👈
.ToElements()
Usually IDE(at least pyCharm) adds this automatically when you break the line.
2️⃣ However, if you meant lists, then we don't need this sign because lists are covered with square brackets on both sides, and python knows. There you are free to break it into multiple lines. Just keep track of commas.
e.g.
[1,2,3,4,5,6]
[1,
2,3,
4,
5,
6]
I hope I answered your question. If not feel free to expand your question on that.
Happy Coding!
@@ErikFrits yup you understood it perfect! thanks for the reply. Those lists look so neat when you break lines like that
Great video like always. Thank you.
Thank you Pedro! 😇
Great video, if you could make one's about filters it would be perfect, thank you Erik
Thanks!
I have plans for it, but at the moment I need to cross many other things from the to-do list ;)
Great
Thanks!
Hi! I just bought the guide, and I find it amazing. When are you going to update it? I use Revit 2023. Thanks!
Glad you liked it!
Unfortunately, I have no time for that at the moment. But I will have a phase when I will write more guides and update this one along the way as well.
P.S. If anyone know nice E-Book online writer let me know. I need something that supports code snippets, so it's not images but an actual text that can be copied.
So far I think I might do it in Figma due to higher customizability, but that's not the final decision.
Which Guide it is?
Yes, please make a video for filters
Is there any specific filter you are interested in or just in general?
@@ErikFrits just in general.
What I really need is to understand how to pass a list or filtered elements into a dialog like the PyRevit "Select From List (Single, Multiple)" dialog.
Would also like a video on how you make the dialogs for your EF Tools commands.
Noted.
I have a video in mind for pyRevit input forms, but I am quite busy with many other video ideas for now, hopefully get to that one in a few months.
I create my GUI with WPF, and it's quite advanced from my opinion. I will eventually try to make some tutorials on the topic, but I will leave it for the end, I try to focus on more basic concepts for now.
Beautiful and smooth video… is there a discord community for pyrevit ? I ll love to join one, if no , do you mind to create one
Thanks, Appreciate that!
Currently I am at the capacity. I wanted to make a small community as well, but then I realized I wouldn't have any time for that.
There is an online pyRevit forum which is quite active.
discourse.pyrevitlabs.io/
I have been struggling with selecting elements in a given view that is both in the current model and in linked models. Does the filter element collector work for linked models as well?
Usually, we need to provide doc variable of the project we want to get our elements.
if you want to get Linked elements, then you need to find and pass doc from linked model.
I am not sure if we can provide linked model and then provide a view from another project. I believe there should be a way to achieve that but I haven't tried to get it like this yet.
@@ErikFrits much appreciate response! I am interested in programmatic approach to grab elements from current doc and all visible linked elements as well…perhaps a topic of a future video if you ever are able to crack the code ;) 🙏
Hi, erik!
i have seen your tutorial and by the way i have learned a lot, thanks!
i have had some difficulties to understand the VARIABLES and i did not understand when you used active_view = doc.ActiveView. Do you know where i can learn more about it?
You might need to check some python basics course. CS50 Introduction to Python by Harvard is a popular free course on edx.org platform.
I would recommend start there
@@ErikFrits Thank you, Erik
Great video. I have a question. How to set a value parameter from a host to elements that it contains? For example, from a beam to rebars. Thank you.
I haven't worked with rebars in Revit API, but usually there is a property 'Host' that returns an element. Have a look inside of Revit Lookup
For example:
if I have a variable window. I can get its wall something like this:
wall = window.Host
Or if you have a list of windows and you need a list of hosts:
walls = [window.Host for window in all_windows]
If you new to parameters in Revit API, I have another video which will show you all you need to read and set parameters ;)
Hey Erik, I really learned a lot from your videos! I am really stuck at the moment with using a doc-changed hook, it seems to be impossible to use transactions with it (edit a parameter). Maybe you have some knowledge about this?
Hi Wietse, Happy to help!
Can you share an example of what you have tried so far? It will be easier to point to an issue with the code.
@@ErikFrits Thank you! There seems to be an issue where my comment keeps getting deleted whenever I send a link to a gist with the code... Is there any other way I can send this to you?
That could happen for sure!. CZcams comment moderation system is weird, because it does not even let mee see them to approve or disapprove...
Reach out to me in LinkedIn.
Hello, I am not getting OST_Walls on my autocomplete. Can you tell the reason?
Do you get other Revit API Autocomplete suggestions?
If No, did you add Revit API stubs in your virtual environment in pyCharm? I have a video on adding Revit API Autocomplete in pyCharm for that.
Hello i would like to know if there is a way to install my plugin in a .exe file or a .msi file and not have to install pyrevit to add the extensions.
thank you very much for everything.
python is not supported in Revit by default.
you need pyRevit or RevitPythonShell to run python scripts,
therefore you need pyRevit to have EF-Tools extension.
@@ErikFrits For example once I have made my own extension, then I could not create an .exe or .msi file type?
Isn't there a way to do this?
(move from python to C# language)
@@giancarloarciniegas8466 you can definitely make this with C#, but with python I don't think there is a ready solutions for that.
You would need to create some custom plugin to display and run your python scripts in revit. You probably can use RevitPythonShell or pyRevit as a base and build on top of it something custom. Not an easy. Try searching in Google, maybe someone has solved this problem already and shared solution.
Is there any way to get this to work with a CAD link? I'm trying to get text from it.
No, FilteredElementCollecotr won't help with that.
I haven't tried to read the layers from a CAD link yet, but that's an interesting topic
@ErikFrits based on what I did so far with linework it looks like it's possible to get everything I need for linework with importinstance. There is nothing for text however. I started implementing what it looks like everyone else does, export to dxf and read that file for text info.
Hey! i am new to revit api .. how to get all elements objects in revit? without filter
FilteredElementCollector is probably the easiest approach. Try this:
all_instances = FilteredElementCollector(doc).WhereElementIsNotElementType().ToElements()
@@ErikFrits Thanks 😉
Hey@@ErikFrits , I'm here again. Is there a way to retrieve all structural and architectural elements, or do I have to specify all the structural and architectural categories and use the FilteredElementCollector method?
@@FelanaDiamondraRANDRIAMADISON
You still need to use FilteredElementCollector. You can use .OfClass or OfCategory to get desired elements.
If you decide to use OfClass, be aware that certain classes are located in discipline namespaces like Autodesk.Revit.DB.Architecture, Autodesk.Revit.DB.Structure and others.
I cannot join your newsletter without typing password
Try this:
temp.learnrevitapi.com/
Sorry I am remaking my main website for the course and I took my main domain right away to simplify it
many thanks @@ErikFrits