/// <summary> /// Constructor /// </summary> /// <param name="doc"></param> /// <param name="instId"></param> /// <param name="hostId"></param> /// <param name="h"></param> /// <param name="i"></param> /// <param name="hName"></param> /// <param name="iName"></param> public ClsResults(Document doc, int instId, int hostId, ClsParameter h, ClsParameter i, String hName, String iName) { _Doc = doc; _InstanceId = instId; _HostId = hostId; _HostParameter = h; _InstanceParameter = i; _HostValue = h.Value; _InstanceValue = i.Value; _HostName = hName; _InstanceName = iName; }
/// <summary> /// Iterate through element collection of selected category /// </summary> void RunComparison() { ClsCategory catInst = this.comboInst.SelectedItem as ClsCategory; foreach (Element elem in catInst.InstanceElements) { try { FamilyInstance inst = elem as FamilyInstance; if (inst != null) { Element host = inst.Host; ClsParameter paramInst = new ClsParameter(inst.get_Parameter(this.comboInstProp.SelectedItem.ToString())); ClsParameter paramHost = new ClsParameter(host.get_Parameter(this.comboInstProp.SelectedItem.ToString())); if (paramInst.ParameterObject != null && paramHost.ParameterObject != null) { _Results.Add(new ClsResults(_Settings.Doc, inst.Id.IntegerValue, host.Id.IntegerValue, paramHost, paramInst, host.Name, inst.Name)); } else { Element instType = _Settings.Doc.GetElement(inst.GetTypeId()); Element hostType = _Settings.Doc.GetElement(host.GetTypeId()); paramInst = new ClsParameter(instType.get_Parameter(this.comboInstProp.SelectedItem.ToString())); paramHost = new ClsParameter(hostType.get_Parameter(this.comboInstProp.SelectedItem.ToString())); if (paramInst.ParameterObject != null && paramHost.ParameterObject != null) { _Results.Add(new ClsResults(_Settings.Doc, inst.Id.IntegerValue, host.Id.IntegerValue, paramHost, paramInst, host.Name, inst.Name)); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } LoadResults(); }