Hello people, i have a problem which i can’t resolve. I have a simple script and it goes well in RPS, but when i try to execute it in pyrevit i get an error that there is no attribute Name for Element. But it is not true.
Here is the code:
bar_type_name = '12 A500'
bar_shape_name = '00'
#++++++++++++++++++++++++++++++++++++++++++++++++
# збір типів арматури в колектор та вибір потрібного типу арматури
rc = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rebar).WhereElementIsElementType().ToElements()
rebar_forms = [bar for bar in rc if bar.FamilyName == 'Форма арматурного стержня' ]
if rebar_forms:
for i in rebar_forms:
print(i.Id)
print(i.Name)
print(30*'=')
else:
print('Немає типів арматури в списку')
And here is the error message:
IronPython Traceback:
Traceback (most recent call last):
File "E:\Clouds\Google Drive\Ревіт\PyRevitExtensions\TEST.extension\test.tab\Тестова панель.panel\Розміщення амратури.pushbutton\start_script.py", line 34, in <module>
AttributeError: Name
Script Executor Traceback:
System.MissingMemberException: Name
at CallSite.Target(Closure , CallSite , Object , CodeContext )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at Microsoft.Scripting.Interpreter.DynamicInstruction`3.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 PyRevitLabs.PyRevit.Runtime.IronPythonEngine.Execute(ScriptRuntime& runtime)