Exemplo n.º 1
0
 /// <summary>
 /// constructor of class
 /// </summary>
 /// <param name="pathRein"></param>
 public PathReinProperties(Autodesk.Revit.DB.Structure.PathReinforcement pathRein)
 {
     m_pathRein     = pathRein;
     m_layoutRule   = (LayoutRule)GetParameter("Layout Rule").AsInteger();
     m_face         = (Face)GetParameter("Face").AsInteger();
     m_numberOfBars = m_pathRein.get_Parameter(
         BuiltInParameter.PATH_REIN_NUMBER_OF_BARS).AsInteger();
     m_barSpacing = m_pathRein.get_Parameter(
         BuiltInParameter.PATH_REIN_SPACING).AsValueString();
     m_primaryBarLength = m_pathRein.get_Parameter(
         BuiltInParameter.PATH_REIN_LENGTH_1).AsValueString();
     m_primaryBarType = GetParameter("Primary Bar - Type").AsElementId();
 }
Exemplo n.º 2
0
        /// <summary>
        /// update the parameters of path reinforcement.
        /// </summary>
        public void Update()
        {
            try
            {
                GetParameter("Layout Rule").Set((int)m_layoutRule);
                GetParameter("Face").Set((int)m_face);
                GetParameter("Primary Bar - Type").Set(m_primaryBarType);
                m_pathRein.get_Parameter(
                    BuiltInParameter.PATH_REIN_LENGTH_1).SetValueString(m_primaryBarLength);

                // if layout rule is maximum spacing, number of bar will be read only.
                // In order to update previously modified number of bar, we should change the layout rule
                // to fixed number, and then set the layout rule back.
                if (m_layoutRule == LayoutRule.Maximum_Spacing)
                {
                    m_pathRein.get_Parameter(
                        BuiltInParameter.PATH_REIN_SPACING).SetValueString(m_barSpacing);
                    GetParameter("Layout Rule").Set((int)LayoutRule.Fixed_Number);
                    m_pathRein.get_Parameter(
                        BuiltInParameter.PATH_REIN_NUMBER_OF_BARS).Set(m_numberOfBars);
                    GetParameter("Layout Rule").Set((int)m_layoutRule);
                }
                // if layout rule is fixed number, bar spacing will be read only.
                // In order to update previously modified bar spacing, we should change the layout rule
                // to maximum spacing, and then set the layout rule back.
                else if (m_layoutRule == LayoutRule.Fixed_Number)
                {
                    m_pathRein.get_Parameter(
                        BuiltInParameter.PATH_REIN_NUMBER_OF_BARS).Set(m_numberOfBars);
                    GetParameter("Layout Rule").Set((int)LayoutRule.Maximum_Spacing);
                    m_pathRein.get_Parameter(
                        BuiltInParameter.PATH_REIN_SPACING).SetValueString(m_barSpacing);
                    GetParameter("Layout Rule").Set((int)m_layoutRule);
                }
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString(), "Exception");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// constructor of class
 /// </summary>
 /// <param name="pathRein"></param>
 public PathReinProperties(Autodesk.Revit.DB.Structure.PathReinforcement pathRein)
 {
     m_pathRein = pathRein;
     m_layoutRule = (LayoutRule)GetParameter("Layout Rule").AsInteger();
     m_face = (Face)GetParameter("Face").AsInteger();
     m_numberOfBars = m_pathRein.get_Parameter(
             BuiltInParameter.PATH_REIN_NUMBER_OF_BARS).AsInteger();
     m_barSpacing = m_pathRein.get_Parameter(
             BuiltInParameter.PATH_REIN_SPACING).AsValueString();
     m_primaryBarLength = m_pathRein.get_Parameter(
             BuiltInParameter.PATH_REIN_LENGTH_1).AsValueString();
     m_primaryBarType = GetParameter("Primary Bar - Type").AsElementId();
 }