public void AplicarLookAHead(string restricao, revitDB.Element elemento) { string psaId = ""; psaId = elemento.LookupParameter(CampoMark).AsString(); if (psaId == "") { return; } parametros.PSA_ID = Convert.ToInt32(psaId); parametros.INICIO = dtpInicio.Value; parametros.TERMINO = dtpTermino.Value; parametros.PERCENT_META = 1; string resultado = ""; manipulacao.PRC_LOOKAHEAD(parametros, false); if (string.IsNullOrEmpty(restricao)) { Util.AlterarGraficoElemento(vistasDeAvanco, orgLookahead, elemento.Id); } else { Util.AlterarGraficoElemento(vistasDeAvanco, orgRestricao, elemento.Id); elemento.LookupParameter("L7Restricao").Set(restricao); } }
public Elbow(PCFData data, Autodesk.Revit.DB.Element element) : base(data, element) { this.getPrimaryandSecondaryPoint(element); this.getCentrePoint(element); //TODO: (하) 패밀리의 변수 이름 "각도"가 한글이면 한글로 변수 값을 찾아야 하는 문제가 있다. if (element.LookupParameter("Angle") == null) { this.Angle = element.LookupParameter("각도").AsDouble(); } else { this.Angle = element.LookupParameter("Angle").AsDouble(); } }
public static object GetParameterValueByNameCaSeiNSeNSiTiVe(global::Revit.Elements.Element element, string parameterName) { Autodesk.Revit.DB.Document doc = DocumentManager.Instance.CurrentDBDocument; //create a list to hold the element ids and add them to it Autodesk.Revit.DB.Element internalElement = element.InternalElement; global::Revit.Elements.Parameter[] elementParams = element.Parameters; string paramToSet = null; //score of each match list List <int> values = new List <int>(); //score the match in the parameter list foreach (var param in elementParams) { values.Add(StringComparisonUtilities.Compute(parameterName, param.Name)); } //get the closest matching parameter name int minIndex = values.IndexOf(values.Min()); paramToSet = elementParams[minIndex].Name; //lookup and get the parameter value var result = internalElement.LookupParameter(paramToSet); var parameterValue = global::Revit.Elements.InternalUtilities.ElementUtils.GetParameterValue(result); return(parameterValue); }
public static global::Revit.Elements.Element SetParameterByNameTypeOrInstance(global::Revit.Elements.Element element, string parameterName, object value) { //create a list to hold the element ids and add them to it Autodesk.Revit.DB.Element internalElement = element.InternalElement; Autodesk.Revit.DB.Document doc = internalElement.Document; //declare variable to assign object paramValue; //looks up the parameter to see if it exists var result = internalElement.LookupParameter(parameterName); //if parameter exists as instance obtain it, otherwise try for type if (result != null) { paramValue = element.SetParameterByName(parameterName, value); } else { paramValue = doc.GetElement(internalElement.GetTypeId()) .ToDSType(true) .SetParameterByName(parameterName, value); } return(element); }
public double qtdeElemento(revitDB.Element element) { double qtde = 0; DataRow [] linhas = dtQtdePSA.Select("PSA_ID = " + element.LookupParameter(CampoMark).AsString()); if (linhas.Length >0) { qtde = Convert.ToDouble(linhas[0]["UNIDADE_PRINCIPAL"]) - Convert.ToDouble(linhas[0]["QTDE_REALIZADA"]) - Convert.ToDouble(linhas[0]["QTDE_PROJECAO"]) - Convert.ToDouble(linhas[0]["QTDE"]); } else { qtde = -1000; } return qtde; }
public static void SetValue(this Autodesk.Revit.DB.Element e, string param, object obj) { e.LookupParameter(param).SetValue(obj); }
public static Model.ParameterValue AsValue(this Autodesk.Revit.DB.Element element, string param) { return(element.LookupParameter(param).AsValue()); }
public string AtualizaTabela(int servicoId, double qtde, revitDB.Element ele) { string pendencias = ""; double consumoInusmo = 0; string psaId = ""; string insumoid = ""; foreach (DataRow row in dtGrid.Select("SERVICO_ID like '%" + servicoId.ToString() +"%' and ORIGEM = 0" )) { if (!string.IsNullOrEmpty(ele.LookupParameter(CampoMark).AsString())) { try { psaId = ele.LookupParameter(CampoMark).AsString(); insumoid = row["INSUMO_ID"].ToString(); consumoInusmo = Convert.ToDouble( manipulacao.PRC_EXECUTAR_DIRETO(" SELECT coalesce(CONSUMO_INSUMO,0) FROM GET_CONSUMO_INSMO(" + insumoid + "," + psaId + ")").Rows[0][0]); row["QTDE_SOLICITADA_LOOK_A_HEAD"] = Convert.ToDouble(row["QTDE_SOLICITADA_LOOK_A_HEAD"]) + qtde * + consumoInusmo; } catch (Exception e) { } } } foreach (DataRow row in dtGrid.Select("SERVICO_ID like '%" + servicoId.ToString() + "%' and ORIGEM = 1")) { if (!string.IsNullOrEmpty(ele.LookupParameter(CampoMark).AsString())) { try { psaId = ele.LookupParameter(CampoMark).AsString(); insumoid = row["INSUMO_ID"].ToString(); consumoInusmo = Convert.ToDouble(row["CONSUMO_INSUMO"]); row["QTDE_SOLICITADA_LOOK_A_HEAD"] = Convert.ToDouble(row["QTDE_SOLICITADA_LOOK_A_HEAD"]) + qtde * + consumoInusmo; } catch { } } } if (!string.IsNullOrEmpty(ele.LookupParameter("L7InsumoVinculado").AsString())) { // MessageBox.Show("SERVICO_ID like '%" + servicoId.ToString() + "%' and origem = 3 " // + " and insumo = '" + ele.LookupParameter("L7InsumoVinculado").AsString().ToString() + "'"); foreach (DataRow row in dtGrid.Select("SERVICO_ID like '%" + servicoId.ToString() + "%' and origem = 3 " + " and insumo = '" + ele.LookupParameter("L7InsumoVinculado").AsString().ToString()+"'")) { try { consumoInusmo = ele.LookupParameter("L7ConsumoInsumoVinculado").AsDouble(); row["QTDE_SOLICITADA_LOOK_A_HEAD"] = Convert.ToDouble(row["QTDE_SOLICITADA_LOOK_A_HEAD"]) + qtde * consumoInusmo; } catch (Exception e) { } } } foreach (DataRow row in dtGrid.Select("SERVICO_ID like '%" + servicoId.ToString() + "%' and ORIGEM = 0 and SALDO < 0")) { pendencias = pendencias + ";" + row["INSUMO"].ToString(); } foreach (DataRow row in dtGrid.Select("SERVICO_ID like '%" + servicoId.ToString() + "%' and ORIGEM = 1 and SALDO < 0")) { pendencias = pendencias + ";" + row["INSUMO"].ToString(); } foreach (DataRow row in dtGrid.Select("SERVICO_ID like '%" + servicoId.ToString() + "%' and origem = 3 " + " and insumo = '" + ele.LookupParameter("L7InsumoVinculado").AsString().ToString() + "' and SALDO < 0")) { pendencias = pendencias + ";" + row["INSUMO"].ToString(); } return pendencias; }