Thank you. I know how hard to create videos like yours, and I am so grateful that you did this classes for pyrevit. You are awesome. I hope you keep doing these tutorials. I just started, and I have a lot to learn.
@pyRevit5 жыл бұрын
Thank you! 😁
@tadeh14 жыл бұрын
I was not expecting to get an intro to Revit API class out of this. Thanks for the information it helped a lot in my understanding of the API.
@JonnyD0005 жыл бұрын
This lecture has been super helpful, you're very good at explaining this stuff. Now I'm excited to watch the rest of the Python for Revit Course!
@martinspence4067 жыл бұрын
Thank you so much for this, Ehsan. You are presenting this in an extremely informative, thorough and nicely paced manner :-)
@ArsenSafaryan6 жыл бұрын
Thank you!!! This is the most user friendly video to get started with Revit and Python for someone who knows Revit well and knows the basics of Python!! I would really like to see more similar videos from you on this channel discussing different challenges such as PartUtils. etc.
@michaeljones14103 жыл бұрын
Halfway through session #2, learning much and enjoying the process! Thank you so much.
@thomastakeuchi9854 жыл бұрын
I dont know how to thank uou more then liking all your videos and subscribe! Thank you very much! Alos, your didatic is very good ! Keep up the good work!
@Thepeopleofsyria7 жыл бұрын
Thank you so much for this video. More and more, please, of these very usefull Python with Revit skills.
@AlbrechtJ3 жыл бұрын
Ehsan, thanks for explaining your masterpiece work.
@timetostudy64433 жыл бұрын
This thing gave me a headache. Tho don’t know if I should continue, thanks you for the invaluable tutorial
@leonardillerhaus42366 жыл бұрын
Thank you so much for your great work! I really appreciate the way you explain how things work. Looking forward to the next sessions!
@mehdinourollah7 жыл бұрын
Thank you so much for this tool and for these AWESOME videos and tutorials that you provide ...Thx Again and Dame Shoma ham garm :D
@martinchen96676 жыл бұрын
Thank you so much for this! A really good video for API newbie.
@engahmedsalah2 жыл бұрын
you're simply Great 👏🏻👍🏻
@yuanlin41395 жыл бұрын
Thanks a lot for the video!!! One newbie question, what's the editor you use to type out script before running in Python Shell? (its convenient to be able to reference to Revit API) Thanks a lot!
@pyRevit5 жыл бұрын
I use VisualStudio Code at the moment. But I don't use autocompletion for Revit API
@tonyiommisg4 жыл бұрын
When I try to run CL, I get the error stating that FilteredElementCollector is not defined. If I make it DB.FilteredElementCollector, it works. Same with BuiltInCategory. Why is that? Thank you!
@pyRevit4 жыл бұрын
FilteredElementCollector is under Autodesk.Revit.DB namespace
@eda42413 жыл бұрын
i am very excited, but it doesnt work 'el'. i do all step correct. but 'el' says: >>> el Traceback (most recent call last): File "", line 1, in NameError: name 'el' is not defined how can ı defıne 'el'? or sth else?(vers.2018)
@pyRevit3 жыл бұрын
Use this script as the RPS "init" script: gist.github.com/eirannejad/4e275166bf2015f4f844bb1d087ca4d6
@eda42413 жыл бұрын
@@pyRevit I embed script ın 'init.py' file. It works. Thanks.
@jamiehutchings28692 жыл бұрын
Here's a stupid error I made that might be tripping up someone else: please note that it's "OfCategory", not "ofCategory" ... I'm not used to method names beginning with an uppercase letter, and of course in English, "of" is almost never capitalized in titles, so I mistyped it and it took me forever to find my error!
@throwaway39464 жыл бұрын
Hello, I have followed your tutorial. It has been incredibly helpful! However, following the method used the total volume printed is incorrect? The volume being printed is 1712, when manually calculated the result is: 48.4 m^3. I am commenting here as a last resort, please can somebody assist? thank you in advance. wall_collect = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType() total_volume = 0.0 for wall in wall_collect: vol = wall.LookupParameter('Volume') if vol: total_volume = total_volume + vol.AsDouble() print("Total volume is: {}".format(total_volume))
@throwaway39464 жыл бұрын
Please ignore me. this is the correct result in Cubic feet!
@DinkeyMalcho4 жыл бұрын
Hi, I kind of got stuck around 33 - I keep getting a message: 'Exception : IronPython.Runtime.UnboundNameException: name 'FilteredElementCollector' is not defined' Could it be that there is something wrong with the 'rps_init.py' startup script?
@pyRevit4 жыл бұрын
FilteredElementCollector is in the Autodesk.Revit.DB namespace. Make sure to import that first. "from Autodesk.Revit import DB" then use it like "DB.FilteredElementCollector"
@sepidehroohi32334 жыл бұрын
hi, i have the same problem,did you solve that?
@HuyLeAEC3 жыл бұрын
@@sepidehroohi3233 you can try cl = DB.FilteredElementCollector(doc) cl.OfCategory(DB.BuiltInCategory.OST_Walls)
@doodlslee6 жыл бұрын
Thank you so much. That's very helpful for me.
@ChristianJGentry6 жыл бұрын
Awesome video, does a lot of this information transfer over to Dynamo users as well?
@pyRevit6 жыл бұрын
Definitely specially if you're using the python node in Dynamo. pyRevit and Dynamo with the same Revit API. Dynamo however has built in collectors for different categories as well as many other collectors and addons
@ChristianJGentry6 жыл бұрын
Very cool! What features does pyRevit offer that Dynamo doesn't? I am not trying to downplay pyRevit's capabilities, I am just genuinely curious about the differences.
@pyRevit6 жыл бұрын
There is no direct comparison honestly. Dynamo is a visual programming platform that brings programming to people with no actual programming experience. pyRevit is a rapid-prototyping platform in IronPython for Revit. pyRevit helps with creating powerful tools and distributing them to your company teams very quickly since it does not need compilation. It's a better platform if you're building a toolbar of tools and don't want to use C#.
@ChristianJGentry6 жыл бұрын
Thanks for the info! I will definitely try to get well versed in pyRevit then. I have been using Dynamo for a while, but after learning a bit of Python I can feel Dynamo encouraging bad habits and holding me back. Thanks again, great work!
@alexandraleclerc46516 жыл бұрын
Thank you so much for this video ! You called the parameter with a STR ("Volume"), but if my Revit got another langage, it can't find this parameter ?
@pyRevit6 жыл бұрын
In this example I'm using the parameter name directly. If this parameter is called something else in your language you should use the proper name. But for all Revit standard parameters you can use BuiltInParameter enum. This way no matter what the language is, Revit will always return the correct parameter. See www.revitapidocs.com/2018.1/fb011c91-be7e-f737-28c7-3f1e1917a0e0.htm
@alexandraleclerc46516 жыл бұрын
Thank you so much !
@chandumadgula9424 Жыл бұрын
Hi..the video was insightful.. How to get the wall element out of the revit object in the pyrevit console...Thanks in advance
@Shawshank085 жыл бұрын
Hi Ehsan, just getting started with this series. I am trying to do the same example but instead with ducts (total length of all ducts). But the builtincategory has "ost_ductsystem" which returns a null value when looking up the length parameter. There is no ost_duct or pipe. Any other way ?
@pyRevit5 жыл бұрын
I haven't worked with ducts but seems like you are collecting Duct Systems instead of duct instances. Draw a Duct in Revit and check its Category.Name and Category.Id to see what Builtin Category you need to specify. You can also use the .OfClass filter on the FilteredElementCollector to collect by the duct element class instead
@Shawshank085 жыл бұрын
Hi Ehsan, this might be a stupid question. So i used OfClass filter but it still won't work on ducts. I get "Exception : IronPython.Runtime.UnboundNameException: name 'Duct' is not defined". I checked on RevitApiDocs and Duct Class inherits class MEPCurve. Could that be a reason ?
@pyRevit5 жыл бұрын
Send me your code or a snippet please. It’s hard to debug without seeing 😁
@Shawshank085 жыл бұрын
@@pyRevit Oh Yeah ! sorry about that. Here is the code and error Code: from Autodesk.Revit.DB import * length_collector=FilteredElementCollector(doc).OfClass(Duct) #iterate over ducts and collect total length total_length=0 for le in length_collector: length_param=le.LookupParameter('Length') if length_param: total_length= total_length + length_param.AsDouble() print(total_length) Error: Exception : IronPython.Runtime.UnboundNameException: name 'Duct' is not defined at IronPython.Runtime.Operations.PythonOps.GetVariable(CodeContext context, String name, Boolean isGlobal, Boolean lightThrow) at IronPython.Compiler.LookupGlobalInstruction.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) at Microsoft.Scripting.Hosting.ScriptSource.ExecuteAndWrap(ScriptScope scope, ObjectHandle& exception)
@Shawshank085 жыл бұрын
@@pyRevit Ehsan, it worked. I had to add "import Autodesk.Revit.DB.Mechanical"
@andyoohhh20616 жыл бұрын
Thank you Ehsan!!!
@jo1992816 жыл бұрын
vary helpful tutorial !
@ganesankathiravan77106 жыл бұрын
Thank you very much for the very informative tutorial. If i want to count total number of windows in the model, what filter need to be used?
@pyRevit6 жыл бұрын
You need to filter for OST_Windows using OfCategory method on the FilteredElementCollector. www.revitapidocs.com/2018.1/ba1c5b30-242f-5fdc-8ea9-ec3b61e6e722.htm
@ganesankathiravan77106 жыл бұрын
Thank you very much for your help. I got it and works perfect.
@titobandito60606 жыл бұрын
When importing modules what is the most efficient way to know which modules to import? Do you write your code and then go back and look for the modules they are contained within?
@pyRevit6 жыл бұрын
Not really. overtime you learn slowly which modules to use by looking at their documentation a lot and testing them. But for tasks that I don't know there is a module, I generally do a search on Stackoverflow or Pypi to see if there is anything available and read their docs.
@titomoura70144 жыл бұрын
Hi everyone, How could I create a command that calculate total weight of a scaffold according to the items selected? Thank you.
@feri4life1772 жыл бұрын
nice.
@billmoresso9087 жыл бұрын
Thank you so much! How to select elements of linked RVT document in current project?
@selincelen4713 жыл бұрын
Why don't we use "GetMaterialVolume" method? Thanks!
@pyRevit3 жыл бұрын
The intention was to talk about the underlying API and explaining how it works.
@selincelen4713 жыл бұрын
@@pyRevit Thank you for your explanation and great video. This helps me a lot.
@adryjanek6 жыл бұрын
Hi! Thanks for great tutorials! I'm having problem with unit conversion in that example. When I add to this loop additional prints I get something like this: for wall in wall_collector: vol_param=wall.LookupParameter('Volume') if vol_param: total_volume = total_volume + vol_param.AsDouble() print(vol_param.AsValueString()) print(vol_param.AsDouble()) Output: 36.80 m³ 1299.57973535 21.28 m³ 751.496107833 18.40 m³ 649.789867675 10.64 m³ 375.748053917 Do you know what can be cause of that?
@pyRevit6 жыл бұрын
These are 4 pairs of prints for 4 elements being processed. Remember you're in a loop. Each loops isprinting AsValueString() and AsDouble() values
@pochuncheung5696 жыл бұрын
Very Good!!!!!!!!!!!
@musalah16 жыл бұрын
Thanks, I have been enjoying going through this. When I do the for loop to print (for el in cl:...etc) I dont get anything back. no errors but nothing is printed either. I do have a couple of walls modeled. Any idea what Im doing wrong?
@musalah16 жыл бұрын
nevermind! figured it out lol
@bongbong26d5 жыл бұрын
Sorry to interrupt, but i face the same problem, may i ask how did you solve this problem?? Much thanks!!
@TheMido6883 жыл бұрын
Thank you so much for this session , Ehsan. I tried the code in the session but the result of the volume is in cubic feet , i asking if there is a method to represent the volume in cubic meter as the Revit model is in metric unit
@abduls93162 жыл бұрын
You could convert like this total_volume = (total_volume + vol_param.AsDouble())*0.0283
@thomas_lex_inc6 жыл бұрын
Thank you so much sir :D
@konstantinshyshkin43146 жыл бұрын
Hello. Thank you for your tutorial. Trying recode it, but have one trouble. In my system i use m3 units, but when i get values by AsDouble, system return to me Volume in CF not in m3, but if i try get values by string, i got it in m3 but in string format. Please help me, is it possible get Volume in m3 by method AsDouble?
@pyRevit6 жыл бұрын
No. AsDouble() always returns values in internal API units. You need to do a quick CF to m3 conversion obviously. The AsValueString() however returns the string value with representing unit sign based on the model unit settings. That is good for quickly displaying pre-formatted results.
@stijncox85035 жыл бұрын
I get an Exception "LookupParameter() takes exactly 2 arguments (1 given)". What did I wrong?
@pyRevit5 жыл бұрын
The first parameter is the object instance. LookupParameter is a method on the type Element. So call that from the element instance. e.g el.LookupParameter(param_name)
@mtbfun29605 жыл бұрын
I have this in my script "wall.LookupParameter('Volume')" and it didn't work?
@pyRevit5 жыл бұрын
Not sure then. Please submit your test model and script in issues to I can take a look. github.com/eirannejad/pyRevit/issues
@stijncox85035 жыл бұрын
It works! 😀 Thanks a lot, I wrote everything of the beginning on my own and it works. I have also convert it to cubic meters!
@sbr4897 Жыл бұрын
Stop sayingg ammmmm ummmmm uhmmmmmm it sooo annoyinggggg
@feri4life177 Жыл бұрын
Hi, i got the following error. >>> Exception : IronPython.Runtime.UnboundNameException: name 'BuildInCategory' is not defined bei IronPython.Runtime.Operations.PythonOps.GetVariable(CodeContext context, String name, Boolean isGlobal, Boolean lightThrow) bei IronPython.Compiler.LookupGlobalInstruction.Run(InterpretedFrame frame) bei Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) bei Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) bei IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) bei Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) bei Microsoft.Scripting.Hosting.ScriptSource.ExecuteAndWrap(ScriptScope scope, ObjectHandle& exception)