FILTER WITH SHARED PARAMETER. GUID ID.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone!
As matthew.taylor has suggested I'm creating a post with a query which I'm strugguling since a few days ago:
OBJECTIVE: Filter the elements in my model of a category I choose with a shared parameter yes/no.
ACTUAL SITUATION: At this moment, I know how get my objective but using the GUID number directly, looking at it in the .txt or the fantastic "Lookup" addin.
int ruleValInt = 1;
Element firstdoorElement = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors).FirstElement(); Parameter SharedParamGUIDID = firstdoorElement.get_Parameter(new Guid("6b79a46d-8d2a-4071-8069-86dc9c0f2c68")); ParameterValueProvider pvp = new ParameterValueProvider(SharedParamGUIDID.Id); FilterNumericEquals fnrv = new FilterNumericEquals(); FilterIntegerRule paramFr = new FilterIntegerRule(pvp, fnrv, ruleValInt); ElementParameterFilter epf = new ElementParameterFilter( paramFr ); FilteredElementCollector doors = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors).WherePasses(epf); doors.OfClass(typeof(FamilyInstance));
MAIN QUERY: I want to know how to get and use the GUID from the .txt or the category(or element). I have this code that dosen't give any error in Visual, but dosent work when I do the debugging:
Element firstdoorElement = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors).FirstElement(); var sharedParamGuid = firstdoorElement.LookupParameter(LabConstants.SharedParamsGroupAPI).GUID; Parameter SharedParamGUIDID = firstdoorElement.get_Parameter(sharedParamGuid); ParameterValueProvider pvp = new ParameterValueProvider(SharedParamGUIDID.Id); FilterNumericEquals fnrv = new FilterNumericEquals(); FilterIntegerRule paramFr = new FilterIntegerRule(pvp, fnrv, ruleValInt); ElementParameterFilter epf = new ElementParameterFilter( paramFr ); FilteredElementCollector doors = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors).WherePasses(epf); ; doors.OfClass(typeof(FamilyInstance));
SECOND QUERY: It's possible to write the GUID I want to use? Example: "7b7b77b-7b7b-7777-7777-77bb7b77bb77" I want to do this in case I use families created before with the same shared parameter name and group, but different GUID. My intention is to create always this parameter with the same GUID so I can filter independently from when it was created.
REFERENCES :
http://thebuildingcoder.typepad.com/blog/2015/12/shared-project-parameter-guid-reporter.html
Any comment is wellcome. Thanks for your time. Have a nice day.