Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66664

Adding a shared parameter and edit the content

$
0
0

Hi there, im trying to learn the revit api, so now i see if i can add a shared parameter to objects, and as a next step edit the content of that (text) parameter. As a test i want to fill it with the revit ID

 

So far i managed to add a shared parameter to objects in the document by adding NewInstanceBindings

( Autodesk.Revit.DB.Binding binding = app.Create.NewInstanceBinding(cats);

 

but now im struggling to add the ID to that parameter.

i tried using this code: but it keeps throwing me errors that the paramater is a read-only.

 

 

DefinitionFile defFile = app.OpenSharedParameterFile();
Definition d = defFile.Groups.get_Item("4.Add-ins").Definitions.get_Item("RevitGUID");

FilteredElementCollector collector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls);
foreach (Element el in collector)
{
Parameter para = el.get_Parameter(d);
string elId = el.UniqueId;
para.Set(elId);
}

 

 

can someone push me in the right direction? thank you


Viewing all articles
Browse latest Browse all 66664

Trending Articles