- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi ,
I am trying to read the value of a family instance Shared Parameter. I can set it alright, but i cannot read it.
I created a TEXT Shared-Parameter named "KDS_PIPING_SYSTEM_TYPE" in the Document UI:
shared parmater file:
------------------------
# This is a Revit shared parameter file.
# Do not edit manually.
*METAVERSIONMINVERSION
META21
*GROUPIDNAME
GROUP1KDS_IDENTITY_PARAMS
GROUP2KDS_GROUP_
*PARAMGUIDNAMEDATATYPEDATACATEGORYGROUPVISIBLEDESCRIPTIONUSERMODIFIABLEHIDEWHENNOVALUE
PARAM d7196377-8d4d-4b25-8789-912f72cc2f80 KDS_PIPING_SYSTEM_TYPE TEXT 1 1 1 0
-----------------
Then I opened a Sleeve Family and i added the above Shared-parameter "KDS_PIPING_SYSTEM_TYPE" inside it, using the UI as well.
Now in the API, I did the following to print out the content of the Sleeve Shared-Parameter "KDS_PIPING_SYSTEM_TYPE"
I create a new instance of the sleeve family as:
using (Transaction insertSleeve_trx = new Transaction(actvDoc, "Insert Sleeves"))
{
insertSleeve_trx.Start();
sleeveFamSymbol.Activate();
sleeve_famInst = actvDoc.Create.NewFamilyInstance(intersection, sleeveFamSymbol, f, StructuralType.NonStructural);
insertSleeve_trx.Commit();
sleevesLocPnt_lst.Add(intersection);
}
Then I get the "KDS_PIPING_SYSTEM_TYPE" parameter as:
Parameter slv_SysType = sleeve_famInst.LookupParameter("KDS_PIPING_SYSTEM_TYPE");
Then i assign a Value to it:
slv_SysType.Set(p_SysType.AsValueString()); // "KDS_RWL_AG_CI"
I try to read it but i get nothing.
TaskDialog.Show("insrtSleeve", "AFTER set KDS_PIPING_SYSTEM_TYPE: " + sleeve_famInst.LookupParameter("KDS_PIPING_SYSTEM_TYPE").AsValueString());
But the UI shows that it DOES have the correct Value...
Realizing that it is a Shared-Parameter and it should be treated differently, i tried soso method.
Element element = actvDoc.GetElement(sleeve_famInst.Id);
Parameter p4 = element.get_Parameter(new Guid("d7196377-8d4d-4b25-8789-912f72cc2f80"));
TaskDialog.Show("insrtSleeve", "p4 AsString: " + p4.AsString());
But this gave me nothing as well.
I made sure that my code is using the correct family instance and correct shared parameter and it is:
Any idea on how to tackle this problem, i.e how do i "Read" the value of a shared Parameter in a Family instance?
thanks.. and sorry for the long post.
Solved! Go to Solution.