My idea is to transfer Shared parameters from linked file (doc_link) to the host file (doc = Revit.ActiveDBDocument) in order to be able to make room colour schemes based on the parameters, which were created in the nested file.
The action sequence is following:
1.find out if the parameter i need is shared
2.get it’s definition and GUID
3.create new shared parameter in current shared parameters file (or create temporary shared parameters file as it was made in Rhino.Inside.Revit official repository). If such shared parameter already exists in SharedParametersFile, we are to get it
^^^everything goes great until this moment, the shared parameters are appearing in SharedParametersFile^^^
4.add new shared parameter to Project Parameters
^^^when i’m trying to conduct this transaction i am getting an Error with no description:
Here are the most important methods i am using:
categories_set = DB.CategorySet()
binding = DB.InstanceBinding(categories_set)
for cat in categories:
binding.Categories.Insert(cat)
ex_def = spfg.Definitions.Create(ex_def_opts)
result = doc.ParameterBindings.Insert(ex_def,binding)
The reason why i am not using RIR gh nodes is because there’s no chance to pick certain categories for the parameter to be present in.
What am i doing wrong? Thanks in advance for any attention!
Of course, i’ve seen the documentation, but there’s nothing about system classes. Now i’m trying to transfer Revit Shared Parameter from the RIR node and proceed working with it in my ghPython script, but the objects from RIR nodes are considered to be strings, not objects.
For instance if i will query all the objects of class DB.SharedParameterElement in first ghpython node and output it through the node-output, i will be able to work with those API objects in another node
It also works with the most of the objects which are coming out of the RIR nodes, but the parameter (and related objects) are not readable and are not recognized by python as programming objects (classes). The are interpreted as strings (text)
It seems like there’s no tool to convert those objects through the API that you’ve provided
okay, but why i can’t read this RiR parameter in my ghPython?
The thing that is missing – is generally to create a new Shared parameter with specific GUID. For instance, there is a document (file A) which i got from another architectural bureau. I only have a *RVT file, and have no access to their shared parameter file (*TXT). But the shared parameters they have initiated are still working and present. My purpose is to duplicate those shared parameters to my new file (file B).
Usually i do it by going to A-file’s Manage > project parameters and doing “Export”. After that there would be a new Shared parameter in MY shared_parameters_file (*TXT) on my computer. And then i can easily open up my file B and create a new project parameter, using a definition from “Exported parameters” group. This makes possible to apply filters and make schedules (for both objects from file A and file B simultaneously). This becomes possible only when the GUID of corresponding parameters are identical. And there is no RIR functionality for this very case at the moment
‘Query Parameters’ will return you all the parameters in the source document.
We are thinking to add an additional input to filter shared-parameters and don’t need the cluster I used here after it.
One thing left to transfer are the Categories binding and if it varies across groups on each parameter.
The component ‘Project parameter’ gets and sets those values.