Example #1
0
 /// <summary>
 /// Initializes the default parametric description.
 /// </summary>
 private void SetDefaultParamDescription()
 {
     ParametricSection = new REX.ContentGenerator.Families.REXFamilyType_ParamSection();
     ParametricDescription.Dimensions.b  = 0.3;  //300mm
     ParametricDescription.Dimensions.h  = 0.3;  //300mm
     ParametricDescription.Dimensions.tw = 0.01; //10mm
     ParametricDescription.Dimensions.tf = 0.01; //10mm
     ParametricDescription.SectionType   = REX.ContentGenerator.Families.ESectionType.I;
     ParametricDescription.CalculataMainAxisAndCharacteristics();
 }
        /// <summary>
        /// Fill the parametric property control with data.
        /// </summary>
        private void SetParametricProperties()
        {
            if (ThisMainExtension.Data.ParametricSection != null)
            {
                REX.ContentGenerator.Families.REXFamilyType_ParamSection section = ThisMainExtension.Data.ParametricSection;

                parametricProperties.ClearProperties();

                parametricProperties.AddProperty("Certified", section.Certified.ToString());
                parametricProperties.AddProperty("Shape", section.Parameters.SectionType.ToString());
                parametricProperties.AddProperty("Material", section.Material.ToString());
                parametricProperties.AddProperty("Tapered", section.Parameters.Tapered.ToString());

                string angle = ThisMainExtension.System.Units.DisplayTextFromBase(section.Parameters.Angle, Autodesk.REX.Framework.EUnitType.Dimensions_Angle, true);
                parametricProperties.AddProperty("Angle", angle);

                string add2name = "";

                if (section.Parameters.Tapered)
                {
                    parametricProperties.AddCategory("Dimensions on the start");
                    add2name = "Start ";
                }
                else
                {
                    parametricProperties.AddCategory("Dimensions");
                }

                foreach (System.Reflection.PropertyInfo property in section.Parameters.Dimensions)
                {
                    object valObj = property.GetValue(section.Parameters.Dimensions, null);
                    double val    = (valObj != null)?Convert.ToDouble(valObj):0;
                    string valStr = ThisMainExtension.System.Units.DisplayTextFromBase(val, Autodesk.REX.Framework.EUnitType.Dimensions_SectionDim, true);
                    parametricProperties.AddProperty(add2name + property.Name, valStr);
                }

                if (section.Parameters.Tapered)
                {
                    parametricProperties.AddCategory("Dimensions on the end");
                    add2name = "End ";
                    foreach (System.Reflection.PropertyInfo property in section.Parameters.DimensionsEnd)
                    {
                        object valObj = property.GetValue(section.Parameters.DimensionsEnd, null);
                        double val    = (valObj != null) ? Convert.ToDouble(valObj) : 0;
                        string valStr = ThisMainExtension.System.Units.DisplayTextFromBase(val, Autodesk.REX.Framework.EUnitType.Dimensions_SectionDim, true);
                        parametricProperties.AddProperty(add2name + property.Name, valStr);
                    }
                }
            }
        }