Message 1 of 9
Get instance and type value for same parameter in family.

Not applicable
10-20-2017
12:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So I am working on a routine that will place values into door families based on width, but I am struggling with extracting the width values from the door. The problem comes back to how i built my families. My curtain panel doors have width parameter as instance because it adjust to the panel location in the wall but the remainder of my doors for standard walls have a type parameter for width. I am struggling to find a way to extract the width parameter (type and instance) to one value no matter which family i select.
public static double Doorwidth; public void DoorOccValues() { UIDocument uidoc=this.ActiveUIDocument; Document doc= uidoc.Document; using(FrmOcc frmocc= new FrmOcc()) { if(frmocc.ShowDialog()==DialogResult.OK) { bool sprinkler=frmocc.Radio_Sprinkler; bool nonsprinkler=frmocc.Radio_NonSprinkler; bool swing90=frmocc.Radio_90swing; bool swing180=frmocc.Radio_180swing; try // try/catch block with PickObject is used to give the user a way to get out of the infinite loop of while (true) { // while (true) { IList<Reference> refs=uidoc.Selection.PickObjects(ObjectType.Element,new ValidTargetFilter(), "Select a Door. ESC when finished."); //retrieve the parameters of the target Reference foreach(Reference r in refs) { door = doc.GetElement(r); doort=door.Document.GetElement(door.GetTypeId()); Parameter paramWidth=door.get_Parameter(BuiltInParameter.DOOR_WIDTH); Parameter paramWidthType=doort.get_Parameter(BuiltInParameter.DOOR_WIDTH); getWidth(door,out Doorwidth); if((sprinkler=true)&&(swing90=true)) { //DoorEgress(door,"test"); TaskDialog.Show("tEST","Length instance is"+Doorwidth); } else if((nonsprinkler=true)&&(swing90=true)) { TaskDialog.Show("tEST","Length instance is"+Doorwidth); } else if((sprinkler)&&(swing180)) { TaskDialog.Show("tEST","Sprinkler+180"); } else if((nonsprinkler)&&(swing180)) { TaskDialog.Show("tEST","Non-Sprinkler+180"); } } } } catch(Exception) { } } uidoc.RefreshActiveView(); } } public double getWidth(Element elem, out double result) { Parameter paramWidth=elem.get_Parameter(BuiltInParameter.DOOR_WIDTH); Parameter paramWidthType=elem.Document.GetElement(elem.GetTypeId()).get_Parameter(BuiltInParameter.DOOR_WIDTH); if(null != paramWidth && !paramWidth.IsReadOnly) { result=paramWidth.AsDouble(); } if(null != paramWidthType && !paramWidthType.IsReadOnly) { result=paramWidthType.AsDouble(); } return result; }