Example #1
0
        private string GetUnitSymbol(DisplayUnit unitSystem)
        {
            UnitsTypeAssignment assignment;

            switch (unitSystem)
            {
            case DisplayUnit.IMPERIAL:
                if (!imperialSettings.TryGetValue(unitType, out assignment))
                {
                    return("");
                }
                break;

            case DisplayUnit.METRIC:
                if (!metricSettings.TryGetValue(unitType, out assignment))
                {
                    return("");
                }
                break;

            default:
                return("");
            }

            if (UnitSymbolType.UST_NONE == assignment.SymbolType)
            {
                return("");
            }
            return(LabelUtils.GetLabelFor(assignment.SymbolType));
        }
Example #2
0
        public ParameterData(
            BuiltInParameter bip,
            Parameter parameter,
            string valueStringOrElementDescription,
            bool containedInCollection,

            /*
             * Edited by Chekalin Victor 13.12.2012
             */
            string parameterName)
        {
            _enum      = bip;
            _parameter = parameter;

            /*
             * Edited by Chekalin Victor 13.12.2012
             */
            _parameterName = parameterName;

            ValueString = valueStringOrElementDescription;
            Value       = GetValue;


            Definition d = _parameter.Definition;

            ParameterGroup        = d.ParameterGroup.ToString();
            GroupName             = LabelUtils.GetLabelFor(d.ParameterGroup);
            ContainedInCollection = containedInCollection ? "Y" : "N";
        }
Example #3
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Types.ParameterKey parameter = null;
            if (!DA.GetData("ParameterKey", ref parameter))
            {
                return;
            }

            if (Enum.IsDefined(typeof(BuiltInParameter), parameter.Value.IntegerValue))
            {
                var builtInParameter = (BuiltInParameter)parameter.Value.IntegerValue;
                DA.SetData("Name", LabelUtils.GetLabelFor(builtInParameter));
                DA.SetData("StorageType", Revit.ActiveDBDocument.get_TypeOfStorage(builtInParameter));
                DA.SetData("Visible", true);
                DA.SetData("Guid", Guid.Empty);
            }
            else if (Revit.ActiveDBDocument.GetElement(parameter.Value) is ParameterElement parameterElement)
            {
                var definition = parameterElement.GetDefinition();
                DA.SetData("Name", definition?.Name);
                DA.SetData("StorageType", definition?.ParameterType.ToStorageType());
                DA.SetData("Visible", definition?.Visible);
                DA.SetData("Guid", (parameterElement as SharedParameterElement)?.GuidValue ?? Guid.Empty);
            }
        }
Example #4
0
        /// <summary>
        /// Create a Frequency measure property from the element's or type's parameter.
        /// </summary>
        /// <param name="file">The IFC file.</param>
        /// <param name="exporterIFC">The ExporterIFC.</param>
        /// <param name="elem">The Element.</param>
        /// <param name="revitParameterName">The name of the parameter.</param>
        /// <param name="revitBuiltInParam">The built in parameter to use, if revitParameterName isn't found.</param>
        /// <param name="ifcPropertyName">The name of the property.</param>
        /// <param name="valueType">The value type of the property.</param>
        /// <returns>The created property handle.</returns>
        public static IFCAnyHandle CreateFrequencyPropertyFromElementOrSymbol(IFCFile file, ExporterIFC exporterIFC, Element elem,
                                                                              string revitParameterName, BuiltInParameter revitBuiltInParam, string ifcPropertyName, PropertyValueType valueType)
        {
            IFCAnyHandle propHnd = CreateFrequencyPropertyFromElement(file, exporterIFC, elem, revitParameterName, ifcPropertyName, valueType);

            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
            {
                return(propHnd);
            }

            if (revitBuiltInParam != BuiltInParameter.INVALID)
            {
                string builtInParamName = LabelUtils.GetLabelFor(revitBuiltInParam);
                propHnd = CreateFrequencyPropertyFromElement(file, exporterIFC, elem, builtInParamName, ifcPropertyName, valueType);
                if (!IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
                {
                    return(propHnd);
                }
            }

            // For Symbol
            Document  document = elem.Document;
            ElementId typeId   = elem.GetTypeId();
            Element   elemType = document.GetElement(typeId);

            if (elemType != null)
            {
                return(CreateFrequencyPropertyFromElementOrSymbol(file, exporterIFC, elemType, revitParameterName, revitBuiltInParam, ifcPropertyName, valueType));
            }
            else
            {
                return(null);
            }
        }
        public SelectExistParameter(Parameter parameter)
        {
            InitializeComponent();
            Title = ModPlusAPI.Language.GetItem(LangItem, "h18"); //// "Назначение параметра семейства";

            // get data from parameter
            TbParameterName.Text = parameter.Definition.Name;
            TbParameterType.Text = LabelUtils.GetLabelFor(parameter.Definition.ParameterType);

            // get allowable parameters
            var fm = RevitInterop.Document.FamilyManager;

            // sort
            List <Tuple <string, int> > parameters = new List <Tuple <string, int> >();

            foreach (FamilyParameter fmParameter in fm.Parameters)
            {
                if (fmParameter.Definition.ParameterType == parameter.Definition.ParameterType)
                {
                    parameters.Add(new Tuple <string, int>(fmParameter.Definition.Name, fmParameter.Id.IntegerValue));
                }
            }

            parameters.Sort((i1, i2) => string.Compare(i1.Item1, i2.Item1, StringComparison.Ordinal));
            parameters.ForEach(p =>
            {
                LbParameters.Items.Add(new ListBoxItem
                {
                    Content = p.Item1,
                    Tag     = p.Item2
                });
            });
        }
 static void NotSupported(DisplayUnitType dut)
 {
     throw new NotSupportedException(
               string.Format("Not supported type: {0} - {1}",
                             dut.ToString(),
                             LabelUtils.GetLabelFor(dut)));
 }
        static public void getSectionCommonInfo(MEPSection section, Dictionary <string, string> fieldAndValue)
        {
            if (fieldAndValue == null)
            {
                return;
            }

            PressureLossReportHelper helper = PressureLossReportHelper.instance;

            if (helper == null)
            {
                return;
            }

            Document doc = helper.Doc;

            if (doc == null)
            {
                return;
            }

            if (helper.Domain == ReportResource.ductDomain)
            {
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_FLOW_PARAM), FormatUtils.Format(doc, UnitType.UT_HVAC_Airflow, section.Flow));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_FRICTION), FormatUtils.Format(doc, UnitType.UT_HVAC_Friction, section.Friction));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY), FormatUtils.Format(doc, UnitType.UT_HVAC_Velocity, section.Velocity));
                fieldAndValue.Add(ReportResource.sectionPressureLoss, FormatUtils.Format(doc, UnitType.UT_HVAC_Pressure, section.TotalPressureLoss));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY_PRESSURE), FormatUtils.Format(doc, UnitType.UT_HVAC_Pressure, section.VelocityPressure));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_REYNOLDSNUMBER_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.ReynoldsNumber));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_LOSS_COEFFICIENT), FormatUtils.Format(doc, UnitType.UT_Number, getFittingsLossCoefficient(section)));
            }
            else
            {
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FLOW_PARAM), FormatUtils.Format(doc, UnitType.UT_Piping_Flow, section.Flow));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_FRICTION), FormatUtils.Format(doc, UnitType.UT_Piping_Friction, section.Friction));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY), FormatUtils.Format(doc, UnitType.UT_Piping_Velocity, section.Velocity));
                fieldAndValue.Add(ReportResource.sectionPressureLoss, FormatUtils.Format(doc, UnitType.UT_Piping_Pressure, section.TotalPressureLoss));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_VELOCITY_PRESSURE), FormatUtils.Format(doc, UnitType.UT_Piping_Pressure, section.VelocityPressure));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_REYNOLDS_NUMBER_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.ReynoldsNumber));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FRICTION_FACTOR_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.FrictionFactor));
                fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_KFACTOR_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, getFittingsLossCoefficient(section)));

                //need to check system type
                if (helper.SystemClassification == MEPSystemClassification.DomesticColdWater ||
                    helper.SystemClassification == MEPSystemClassification.DomesticHotWater ||
                    helper.SystemClassification == MEPSystemClassification.Sanitary)
                {
                    fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FIXTURE_UNITS_PARAM), FormatUtils.Format(doc, UnitType.UT_Number, section.FixtureUnit));
                }
                else
                {
                    fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FIXTURE_UNITS_PARAM), ReportConstants.emptyValue);
                }
            }

            fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_ROUGHNESS_PARAM), FormatUtils.Format(doc, UnitType.UT_Piping_Roughness, section.Roughness));
            fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.CURVE_ELEM_LENGTH), FormatUtils.Format(doc, UnitType.UT_Length, section.TotalCurveLength));
            fieldAndValue.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SECTION), section.Number.ToString());
        }
Example #8
0
        public static Dictionary <string, object> ProjectPosition(dynamic Document_RevitLinkInstance)
        {
            var doc = DocumentManager.Instance.CurrentDBDocument;
            Dictionary <string, object> appversion = ApplicationVersion();
            int             version = 0;
            ProjectPosition pData;
            SiteLocation    lData;
            string          dispsym;

            if (appversion.TryGetValue("Version Number", out object value))
            {
                version = Convert.ToInt32(value);
            }
            if (Document_RevitLinkInstance != null && Document_RevitLinkInstance.GetType().FullName.ToString() != "Revit.Application.Document")
            {
                doc = Document_RevitLinkInstance.InternalElement.Document;
            }

            ProjectLocation pLoc = doc.ActiveProjectLocation;

            if (version > 2017)
            {
                pData = pLoc.GetProjectPosition(XYZ.Zero);
                lData = pLoc.GetSiteLocation();
            }
            else
            {
                pData = pLoc.GetProjectPosition(XYZ.Zero);
                lData = pLoc.SiteLocation;
            }

            double          angle         = pData.Angle * (180 / Math.PI);
            double          elevation     = Math.Round(pData.Elevation, 8);
            double          ew            = Math.Round(pData.EastWest, 8);
            double          ns            = Math.Round(pData.NorthSouth, 8);
            UnitType        unittype      = UnitType.UT_Length;
            FormatOptions   formatoptions = doc.GetUnits().GetFormatOptions(unittype);
            DisplayUnitType dispunits     = formatoptions.DisplayUnits;
            UnitSymbolType  symtype       = formatoptions.UnitSymbol;

            if (symtype == UnitSymbolType.UST_NONE)
            {
                dispsym = "none";
            }
            else
            {
                dispsym = LabelUtils.GetLabelFor(symtype);
            }
            elevation = UnitUtils.ConvertFromInternalUnits(elevation, dispunits);
            ew        = UnitUtils.ConvertFromInternalUnits(ew, dispunits);
            ns        = UnitUtils.ConvertFromInternalUnits(ns, dispunits);
            return(new Dictionary <string, object>
            {
                { "Angle", angle },
                { "NorthSouth", ns },
                { "EastWest", ew },
                { "Elevation", elevation }
            });
        }
Example #9
0
 public static string GetParameterName(Document document, ElementId parameterId)
 {
     if (parameterId.IntegerValue < 0)
     {
         return(LabelUtils.GetLabelFor((BuiltInParameter)parameterId.IntegerValue));
     }
     return(((ParameterElement)document.GetElement(parameterId)).GetDefinition().Name);
 }
        static public string getSectionInfoByParamName(MEPSection section, string paramName, int nGetFrom, ElementId id)
        {
            string paramVal = "";

            if (section == null || paramName == null || (nGetFrom & (int)SectionMemberType.Section) == 0)
            {
                return(paramVal);
            }

            PressureLossReportHelper helper = PressureLossReportHelper.instance;

            if (helper == null)
            {
                return(paramVal);
            }

            if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PRESSURE_DROP) ||
                paramName == ReportResource.pressureLoss)
            {
                double dVal = section.GetPressureDrop(id);

                if (helper.Domain == ReportResource.pipeDomain)
                {
                    paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Piping_Pressure, dVal);
                }
                else
                {
                    paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_HVAC_Pressure, dVal);
                }
                return(paramVal);
            }
            else if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_LOSS_COEFFICIENT) ||
                     paramName == LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_KFACTOR_PARAM))
            {
                double dVal = section.GetCoefficient(id);
                paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Number, dVal);
                return(paramVal);
            }

            else if (paramName == LabelUtils.GetLabelFor(BuiltInParameter.CURVE_ELEM_LENGTH))
            {
                double dVal = section.GetSegmentLength(id);
                paramVal = FormatUtils.Format(helper.Doc, UnitType.UT_Length, dVal);
                return(paramVal);
            }

            Dictionary <string, string> fieldAndValue = new Dictionary <string, string>();

            SectionsInfo.getSectionCommonInfo(section, fieldAndValue);

            if (fieldAndValue.ContainsKey(paramName))
            {
                return(fieldAndValue[paramName]);
            }

            return(paramVal);
        }
        public void getInfoDataTable(DataTable systemTB)
        {
            if (systemTB == null || system == null)
            {
                return;
            }

            systemTB.Columns.Add("SystemInfoName");
            systemTB.Columns.Add("SystemInfoValue");

            PressureLossReportHelper helper = PressureLossReportHelper.instance;

            if (helper == null)
            {
                return;
            }

            MEPSystemType sysType = helper.Doc.GetElement(system.GetTypeId()) as MEPSystemType;

            if (sysType != null)
            {
                systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SYSTEM_CLASSIFICATION_PARAM), system.get_Parameter(BuiltInParameter.RBS_SYSTEM_CLASSIFICATION_PARAM).AsString());

                if (helper.Domain == ReportResource.ductDomain)
                {
                    systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_SYSTEM_TYPE_PARAM), sysType.Name);
                }
                else
                {
                    systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM), sysType.Name);
                }
                systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SYSTEM_NAME_PARAM), system.Name);
                systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SYSTEM_ABBREVIATION_PARAM), sysType.Abbreviation);

                if (helper.Domain == ReportResource.pipeDomain) // need to list fluid info
                {
                    //Fluid type is an element id
                    ElementId elemId       = sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_TYPE_PARAM).AsElementId();
                    string    strFluidType = "";
                    if (elemId != null)
                    {
                        Element elem = helper.Doc.GetElement(elemId);
                        if (elem != null)
                        {
                            strFluidType = elem.Name;
                        }
                    }
                    systemTB.Rows.Add(sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_TYPE_PARAM).Definition.Name, strFluidType);
                    helper.addParameterNameAndValueToTable(systemTB, sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_TEMPERATURE_PARAM), false);
                    helper.addParameterNameAndValueToTable(systemTB, sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_VISCOSITY_PARAM), false);
                    helper.addParameterNameAndValueToTable(systemTB, sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_DENSITY_PARAM), false);
                }
            }

            return;
        }
Example #12
0
 public static string Get(DisplayUnitType displayUnitType,
                          DisplayUnitType onError = DisplayUnitType.DUT_UNDEFINED)
 {
     try { return(LabelUtils.GetLabelFor(displayUnitType)); }
     catch (Exception)
     {
         try { return(LabelUtils.GetLabelFor(onError)); }
         catch (Exception) { return(onError.ToString()); }
     }
 }
Example #13
0
 public static string Get(UnitType unitType,
                          UnitType onError = UnitType.UT_Undefined)
 {
     try { return(LabelUtils.GetLabelFor(unitType)); }
     catch (Exception)
     {
         try { return(LabelUtils.GetLabelFor(onError)); }
         catch (Exception) { return(onError.ToString()); }
     }
 }
Example #14
0
 public static string Get(UnitSymbolType unitSymbolType,
                          UnitSymbolType onError = UnitSymbolType.UST_NONE)
 {
     try { return(LabelUtils.GetLabelFor(unitSymbolType)); }
     catch (Exception)
     {
         try { return(LabelUtils.GetLabelFor(onError)); }
         catch (Exception) { return(onError.ToString()); }
     }
 }
Example #15
0
 public static string Get(BuiltInParameterGroup builtInParameterGroup,
                          BuiltInParameterGroup onError = BuiltInParameterGroup.INVALID)
 {
     try { return(LabelUtils.GetLabelFor(builtInParameterGroup)); }
     catch (Exception)
     {
         try { return(LabelUtils.GetLabelFor(onError)); }
         catch (Exception) { return(onError.ToString()); }
     }
 }
Example #16
0
 public static string Get(ParameterType parameterType,
                          ParameterType onError = ParameterType.Invalid)
 {
     try { return(LabelUtils.GetLabelFor(parameterType)); }
     catch (Exception)
     {
         try { return(LabelUtils.GetLabelFor(onError)); }
         catch (Exception) { return(onError.ToString()); }
     }
 }
        /************************************************************************/

        /* For pipe fitting and accessory, remove coefficient
         *
         *
         */
        /************************************************************************/
        public void upgrade4(PressureLossReportData data, int nVersion = 4)
        {
            if (data == null || data.Version >= nVersion)
            {
                return;
            }

            PressureLossReportHelper helper = PressureLossReportHelper.instance;

            if (helper == null)
            {
                return;
            }

            string fieldLossMethodName = LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_METHOD_PARAM);
            string fieldKFactorName    = LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_KFACTOR_PARAM);
            string fieldKTableName     = LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_TABLE_PARAM);

            string fieldNewLossMethodName = LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPE_FITTING_LOSS_METHOD_SERVER_PARAM);

            int nDisplayOrder = -1;

            if (data.Domain == ReportResource.pipeDomain) //Remove the 3 old parameters for pipe
            {
                PressureLossParameter PLParam1 = helper.getPressureLossParamByName(data.FittingFields, fieldLossMethodName);
                if (PLParam1 != null)
                {
                    nDisplayOrder = PLParam1.DisplayOrder;
                    data.FittingFields.Remove(PLParam1);
                }

                PressureLossParameter PLParam2 = helper.getPressureLossParamByName(data.FittingFields, fieldKFactorName);
                if (PLParam2 != null)
                {
                    data.FittingFields.Remove(PLParam2);
                }

                PressureLossParameter PLParam3 = helper.getPressureLossParamByName(data.FittingFields, fieldKTableName);
                if (PLParam3 != null)
                {
                    data.FittingFields.Remove(PLParam3);
                }

                //Add the new loss method as selected field for pipe
                PressureLossParameter PLParam = new PressureLossParameter(fieldNewLossMethodName, true, nDisplayOrder, (int)SectionMemberType.Fitting);
                if (!data.FittingFields.Contains(PLParam))
                {
                    data.FittingFields.Add(PLParam);
                }
            }

            data.Version = nVersion;
            PressureLossReportDataManager.Instance.save(data);
        }
Example #18
0
        public static List <string> GetGroupLabels(List <BuiltInParameterGroup> _groups)
        {
            List <string> groupLabels = new List <string>();

            foreach (BuiltInParameterGroup bipg in _groups)
            {
                groupLabels.Add(LabelUtils.GetLabelFor(bipg));
            }

            return(groupLabels);
        }
Example #19
0
 /// <summary>
 /// 获取单个构件的属性集
 /// </summary>
 /// <param name="parametergroup"></param>
 /// <param name="param"></param>
 /// <returns>返回一个列表,里面包含所有的大分类</returns>
 private List <string> GetParameterGroup(List <string> parametergroup, Parameter param)
 {
     if (parametergroup.Contains(LabelUtils.GetLabelFor(param.Definition.ParameterGroup)))
     {
     }
     else
     {
         parametergroup.Add(LabelUtils.GetLabelFor(param.Definition.ParameterGroup));
     }
     return(parametergroup);
 }
 private static Dictionary <string, List <Parameter> > FindParameterCategories()
 {
     return(elements.Values.SelectMany(e => e)
            .SelectMany(e => e.GetOrderedParameters())
            .GroupBy(p => p.Definition.Name)
            .Select(p => p.First())
            .OrderBy(p => p.Definition.Name)
            .GroupBy(p => p.Definition.ParameterGroup, p => p)
            .OrderBy(grp => LabelUtils.GetLabelFor(grp.Key))
            .ToDictionary(e => LabelUtils.GetLabelFor(e.Key), e => e.ToList()));
 }
Example #21
0
        public ParameterParam(Autodesk.Revit.DB.Parameter p) : this()
        {
            MutableNickName = false;
            ParameterId     = p.Id.IntegerValue;

            try { NickName = LabelUtils.GetLabelFor(p.Definition.ParameterGroup) + " : " + p.Definition.Name; }
            catch (Autodesk.Revit.Exceptions.InvalidOperationException) { NickName = p.Definition.Name; }

            try { Description = p.StorageType == StorageType.ElementId ? "ElementId" : LabelUtils.GetLabelFor(p.Definition.ParameterType); }
            catch (Autodesk.Revit.Exceptions.InvalidOperationException)
            { Description = p.Definition.UnitType == UnitType.UT_Number ? "Enumerate" : LabelUtils.GetLabelFor(p.Definition.UnitType); }
        }
Example #22
0
        private void LoadGroupingNames()
        {
            var groupDict = new SortedDictionary <BuiltInParameterGroup, string>();

            foreach (BuiltInParameterGroup pg in Data.Helpers.ParameterGroupsList())
            {
                groupDict.Add(pg, LabelUtils.GetLabelFor(pg));
            }
            CbxGroup.Sorted        = true;
            CbxGroup.DataSource    = new BindingSource(groupDict, null);
            CbxGroup.DisplayMember = "Value";
            CbxGroup.ValueMember   = "Key";
        }
Example #23
0
        /// <summary>
        /// Initializes the lookup list using jwthe Revit API "LabelUtils" object.
        /// </summary>
        private void BuildLookup()
        {
            var values = Enum.GetValues(typeof(BuiltInParameterGroup));

            foreach (BuiltInParameterGroup bipg in values)
            {
                string label = LabelUtils.GetLabelFor(bipg);
                if (!_lookup.ContainsKey(label))
                {
                    _lookup.Add(label, bipg);
                }
            }
        }
Example #24
0
        protected override void RefreshList(string ParamName)
        {
            var selectedItems = ListItems.Where(x => x.Selected).Select(x => x.Expression).ToList();

            ListItems.Clear();
            if (ParamName.Length == 0 || ParamName[0] == '\'')
            {
                return;
            }

            if (Revit.ActiveDBDocument != null)
            {
                int selectedItemsCount = 0;
                {
                    foreach (var builtInParameter in Enum.GetNames(typeof(BuiltInParameter)))
                    {
                        if (!builtInParameter.IsSymbolNameLike(ParamName))
                        {
                            continue;
                        }

                        if (SourceCount == 0)
                        {
                            // If is a no pattern match update NickName case
                            if (string.Equals(builtInParameter, ParamName, StringComparison.OrdinalIgnoreCase))
                            {
                                ParamName = builtInParameter;
                            }
                        }

                        var builtInParameterValue = (BuiltInParameter)Enum.Parse(typeof(BuiltInParameter), builtInParameter);

                        var label = string.Empty;
                        try { label = LabelUtils.GetLabelFor(builtInParameterValue); }
                        catch (Autodesk.Revit.Exceptions.InvalidOperationException) { }

                        var item = new GH_ValueListItem(builtInParameter + " - \"" + label + "\"", ((int)builtInParameterValue).ToString());
                        item.Selected = selectedItems.Contains(item.Expression);
                        ListItems.Add(item);

                        selectedItemsCount += item.Selected ? 1 : 0;
                    }
                }

                // If no selection and we are not in CheckList mode try to select default model types
                if (ListItems.Count == 0)
                {
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, string.Format("No ElementType found using pattern \"{0}\"", ParamName));
                }
            }
        }
Example #25
0
        public ParameterData(BuiltInParameter bip, Parameter parameter, string valueStringOrElementDescription, bool containedInCollection, string parameterName)
        {
            _enum          = bip;
            _parameter     = parameter;
            _parameterName = parameterName;

            ValueString = valueStringOrElementDescription;
            Value       = GetValue;

            var parameterDefinition = _parameter.Definition;

            ParameterGroup        = parameterDefinition.ParameterGroup.ToString();
            GroupName             = LabelUtils.GetLabelFor(parameterDefinition.ParameterGroup);
            ContainedInCollection = containedInCollection ? "Y" : "N";
        }
Example #26
0
        public static string GetColumnName(BuiltInParameter key)
        {
            string text = LabelUtils.GetLabelFor(key);

            if (text == null)
            {
                Log.WriteError("Value is null for column: {0}", new object[]
                {
                    key
                });
                return(null);
            }
            text = text.Replace(" ", "");
            return(DatabaseManager.GetValidCoumnName(text));
        }
Example #27
0
        private void BuildLabelList()
        {
            List <BuiltInParameterGroup> values = Enum.GetValues(typeof(BuiltInParameterGroup)).Cast <BuiltInParameterGroup>().ToList();

            foreach (BuiltInParameterGroup builtInParameterGroup in values)
            {
                GroupParameterUnderlabelList.Add(LabelUtils.GetLabelFor(builtInParameterGroup));
            }


            //foreach (BuiltInParameterGroup oneParam in GroupParameterUnderBuiltInParameterGroupList)
            //{
            //    GroupParameterUnderlabelList.Add(LabelUtils.GetLabelFor(oneParam));
            //}
        }
        public SetParametersForm(Units units)
        {
            InitializeComponent();

            unitsTB.Text = LabelUtils.GetLabelFor(
                units.GetFormatOptions(UnitType.UT_Length).DisplayUnits);

            if (units.DecimalSymbol == DecimalSymbol.Dot)
            {
                decimalSeparator = '.';
            }
            else
            {
                decimalSeparator = ',';
            }
        }
Example #29
0
 static public string GetUnitSymbol(string valueName, UnitsAssignment[] Assignments)
 {
     foreach (UnitsAssignment ua in Assignments)
     {
         if (ua.ValueName.CompareTo(valueName) == 0)
         {
             FormatOptions fo = RevitUnits.GetFormatOptions(ua.unitType);
             if (UnitSymbolType.UST_NONE == fo.UnitSymbol)
             {
                 return("");
             }
             return(LabelUtils.GetLabelFor(fo.UnitSymbol));
         }
     }
     return("");
 }
Example #30
0
 private void CollectRevisionParamIds()
 {
     try
     {
         foreach (BuiltInParameter bltParam in bltParameters)
         {
             ElementId paramId   = new ElementId((int)bltParam);
             string    paramName = LabelUtils.GetLabelFor(bltParam);
             revisionParameters.Add(paramId, paramName);
         }
     }
     catch (Exception ex)
     {
         string message = ex.Message;
     }
 }