It seems to be a problem with Revit 2020 API and the command behind "Open in Excel.pushbutton\script.py":
The traceback:
IronPython Traceback:
Traceback (most recent call last):
File "C:\Users\...\...\...\...\...\PyRevitPlus.extension\pyRevitPlus.tab\Misc Tools.panel\Open In Excel.pushbutton\script.py", line 76, in <module>
AttributeError: 'ViewSchedule' object has no attribute 'ViewName'
Script Executor Traceback:
System.MissingMemberException: 'ViewSchedule' object has no attribute 'ViewName'
en IronPython.Runtime.Binding.PythonGetMemberBinder.FastErrorGet`1.GetError(CallSite site, TSelfType target, CodeContext context)
en System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
en Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
en Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
en Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
en IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
en PyRevitLabs.PyRevit.Runtime.IronPythonEngine.Execute(ScriptRuntime& runtime)
I've tested the substitution of the variable 'schedule_name' for a manually introduced one into the code and seemed to work OK.
What would be the 'ViewName' substitution in the line 'schedule_name = "".join([x for x in schedule.ViewName if x.isalnum()])' in Revit 2020 API?
Thanks in advance and congratulations for your amazing work!!! ;-)
Please use RevitLookup to get what you want
On Wed, Jan 1, 2020, 10:36 Pedro I. Hernández G. notifications@github.com
wrote:
It seems to be a problem with Revit 2020 API and the command behind "Open
in Excel.pushbutton\script.py":
The traceback:IronPython Traceback:
Traceback (most recent call last):
File "C:\Users...............\PyRevitPlus.extension\pyRevitPlus.tab\Misc Tools.panel\Open In Excel.pushbutton\script.py", line 76, in
AttributeError: 'ViewSchedule' object has no attribute 'ViewName'Script Executor Traceback:
System.MissingMemberException: 'ViewSchedule' object has no attribute 'ViewName'
en IronPython.Runtime.Binding.PythonGetMemberBinder.FastErrorGet1.GetError(CallSite site, TSelfType target, CodeContext context) en System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) en Microsoft.Scripting.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame)
en Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
en Microsoft.Scripting.Interpreter.LightLambda.Run2T0,T1,TRet
en IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
en PyRevitLabs.PyRevit.Runtime.IronPythonEngine.Execute(ScriptRuntime& runtime)I've tested the substitution of the variable 'schedule_name' for a
manually introduced one into the code and seemed to work OK.
What would be the 'ViewName' substitution in the line 'schedule_name =
"".join([x for x in schedule.ViewName if x.isalnum()])' in Revit 2020 API?Thanks in advance and congratulations for your amazing work!!! ;-)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/eirannejad/pyRevit/issues/784?email_source=notifications&email_token=AAHDQVGVKERVKZ2QAGMQ3ZTQ3QFVVA5CNFSM4KBZJNF2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IDROA2A,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAHDQVDJXGVD2GLXRGKSOX3Q3QFVVANCNFSM4KBZJNFQ
.
done!
After a little exploration on revitapidocs:
# Original line
schedule_name = "".join([x for x in schedule.ViewName if x.isalnum()])
# Updating code with newest API (at least 19 & 20):
schedule_name = "".join([x for x in schedule.Name if x.isalnum()])
Leaves it running in RVT 19 and 20 also!
Thanks!
I believe DB.View.ViewName was deprecated in 2019. I think the following would work better if you plan on still using older versions:
```
from pyrevit import HOST_APP
if HOSTAPP.is_newer_than(2018):
schedule_name = "".join([x for x in schedule.Name if x.isalnum()])
else:
schedule_name = "".join([x for x in schedule.ViewName if x.isalnum()])
@alexdaversa It would be great! 🥇
I'd try to keep compatibility with older versions as long as possible with that extra cost and effort!
Most helpful comment
I believe DB.View.ViewName was deprecated in 2019. I think the following would work better if you plan on still using older versions:
```
from pyrevit import HOST_APP
if HOSTAPP.is_newer_than(2018):
schedule_name = "".join([x for x in schedule.Name if x.isalnum()])
else:
schedule_name = "".join([x for x in schedule.ViewName if x.isalnum()])