Hey!
I've got a strange problem by setting the value of my shared parameter. Here is the shared file definition:
*META VERSION MINVERSION
META 2 1
*GROUP ID NAME
GROUP 1 CustomIdentification
*PARAM GUID NAME DATATYPE DATACATEGORY GROUP VISIBLE DESCRIPTION USERMODIFIABLE
PARAM e49de4da-0671-43de-ab2a-86734af45697 SuggestedStructure TEXT 1 1 0
I would like users to select all wall pieces, which get the same value, and by calling my command the shared parameter values should be updated.
ICollection<ElementId> sel = doc.Selection.GetElementIds();
foreach (ElementId id in sel)
{
Element elem = doc.Document.GetElement(id);
if (elem.Category.Name == "Walls")
{
Parameter param = elem.LookupParameter("SuggestedStructure");
if (param != null && !param.IsReadOnly && param.IsShared)
{
MessageBox.Show(String.Format("Guid: {0}", param.GUID.ToString()));
MessageBox.Show(String.Format("ReadOnly: {0}", param.IsReadOnly));
MessageBox.Show(String.Format("Shared: {0}", param.IsShared));
MessageBox.Show(String.Format("Type: {0}", param.StorageType.ToString()));
bool bRet = param.Set("Some Data");
if (!bRet)
{
MessageBox.Show("Data could not be set");
}
}
}
}
I get the right Guid, just like defined in .txt, ReadOnly: false, IsShared: true, StorageType: string
Set() function returns true, but the value does not get written in the object, and Properties dialog "SuggestedStructure" parameter stays empty.
I've tried SetValueString() also which however returns false, but I have no idea why, because no exception is thrown.
I've tried get_Paramater by Guid, and got the same result. I would appreciate any help, because I'm out of ideas.
I have to admit after 8 years of objectARX (c++) coding experience that Revit SDK is very chaotic:S.
I'm using Revit MEP 2015 on Windows 10 x64.
Thanks a lot!