Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i am trying to access shared parameter file to create or get parameters from file based on an excel sheet
using PyRevit in Revit 2021
import Autodesk
from Autodesk.Revit.DB import *
doc = __revit__.ActiveUIDocument.Document
from Autodesk.Revit.ApplicationServices import Application
app=Application
group = 'test'
name = 'hitest'
type='Text'
visible=True
originalFile = app.SharedParametersFilename
tempFile = "C:\\SharedParameters.txt"
app.SharedParametersFilename=tempFile
defFile = app.OpenSharedParameterFile()
dg = defFile.Groups.Create(group)
d = dg.Definitions.Create(name, type, visible)
this is the code that i come up with by looking up api docs and its version of dynamo (github for dynamo version )
attached SharedParameters file
when i run the code in pyrevit i get the error
AttributeError: static property 'SharedParametersFilename' of 'Application' can only be assigned to through a type, not an instance
Script Executor Traceback:
System.MissingMemberException: static property 'SharedParametersFilename' of 'Application' can only be assigned to through a type, not an instance
at CallSite.Target(Closure , CallSite , Object , Object )
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)
i don't understand the error and how to fix it thank you.
Solved! Go to Solution.
Developer Advocacy and Support +