This class will deal with all parameters related to window creation
        /// <summary>
        /// the method is used to create new family type
        /// </summary>
        /// <param name="para">WindowParameter</param>
        /// <returns>indicate whether the NewType is successful</returns>
        private bool newFamilyType(WindowParameter para)//string typeName, double height, double width, double sillHeight)
        {
            DoubleHungWinPara dbhungPara  = para as DoubleHungWinPara;
            string            typeName    = dbhungPara.Type;
            double            height      = dbhungPara.Height;
            double            width       = dbhungPara.Width;
            double            sillHeight  = dbhungPara.SillHeight;
            double            windowInset = dbhungPara.Inset;

            switch (m_document.DisplayUnitSystem)
            {
            case Autodesk.Revit.DB.DisplayUnit.METRIC:
                height      = Utility.MetricToImperial(height);
                width       = Utility.MetricToImperial(width);
                sillHeight  = Utility.MetricToImperial(sillHeight);
                windowInset = Utility.MetricToImperial(windowInset);
                break;
            }
            try
            {
                FamilyType type = m_familyManager.NewType(typeName);
                m_familyManager.CurrentType = type;
                m_familyManager.Set(m_familyManager.get_Parameter(BuiltInParameter.WINDOW_HEIGHT), height);
                m_familyManager.Set(m_familyManager.get_Parameter(BuiltInParameter.WINDOW_WIDTH), width);
                m_familyManager.Set(m_familyManager.get_Parameter("Default Sill Height"), sillHeight);
                m_familyManager.Set(m_familyManager.get_Parameter("Window Inset"), windowInset);
                return(true);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// set WindowParameter text
        /// </summary>
        /// <param name="para">the WindowParameter</param>
        private void SetParaText(WindowParameter para)
        {
            DoubleHungWinPara dbhungPara = para as DoubleHungWinPara;

            m_sillHeight.Text = Convert.ToString(dbhungPara.SillHeight);
            m_width.Text      = Convert.ToString(dbhungPara.Width);
            m_height.Text     = Convert.ToString(dbhungPara.Height);
            m_inset.Text      = Convert.ToString(dbhungPara.Inset);
            m_comboType.Text  = dbhungPara.Type;
        }
 /// <summary>
 /// construcion of WindowParameter
 /// </summary>
 /// <param name="para">the WindowParameter</param>
 public WindowParameter(WindowParameter para)
 {
     if (String.IsNullOrEmpty(para.m_type))
     {
         m_type = "NewType";
     }
     m_type   = para.Type + "1";
     m_height = para.Height;
     m_width  = para.Width;
 }
        /// <summary>
        /// The implementation of CombineAndBuild() ,defining New Window Types
        /// </summary>
        public override void CombineAndBuild()
        {
            SubTransaction subTransaction = new SubTransaction(m_document);

            subTransaction.Start();
            foreach (String type in m_para.WinParaTab.Keys)
            {
                WindowParameter para = m_para.WinParaTab[type] as WindowParameter;

                newFamilyType(para);
            }

            subTransaction.Commit();
        }
Example #5
0
        /// <summary>
        /// The implementation of CombineAndBuild() ,defining New Window Types
        /// </summary>
        public override void CombineAndBuild()
        {
            SubTransaction subTransaction = new SubTransaction(m_document);

            subTransaction.Start();
            foreach (String type in m_para.WinParaTab.Keys)
            {
                WindowParameter para = m_para.WinParaTab[type] as WindowParameter;

                newFamilyType(para);
            }

            subTransaction.Commit();
            try
            {
                m_document.SaveAs(m_para.PathName);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Write to " + m_para.PathName + " Failed");
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
        }
Example #6
0
 /// <summary>
 /// construcion of WindowParameter
 /// </summary>
 /// <param name="para">the WindowParameter</param>
 public WindowParameter(WindowParameter para)
 {
     if (String.IsNullOrEmpty(para.m_type))
     {
         m_type = "NewType";
     }
     m_type = para.Type + "1";
     m_height = para.Height;
     m_width = para.Width;
 }
Example #7
0
 /// <summary>
 /// set WindowParameter text
 /// </summary>
 /// <param name="para">the WindowParameter</param>
 private void SetParaText(WindowParameter para)
 {
     DoubleHungWinPara dbhungPara = para as DoubleHungWinPara;
     m_sillHeight.Text = Convert.ToString(dbhungPara.SillHeight);
     m_width.Text = Convert.ToString(dbhungPara.Width);
     m_height.Text = Convert.ToString(dbhungPara.Height);
     m_inset.Text = Convert.ToString(dbhungPara.Inset);
     m_comboType.Text = dbhungPara.Type;
 }
Example #8
0
 //string typeName, double height, double width, double sillHeight)
 /// <summary>
 /// the method is used to create new family type
 /// </summary>
 /// <param name="para">WindowParameter</param>
 /// <returns>indicate whether the NewType is successful</returns>
 private bool newFamilyType(WindowParameter para)
 {
     DoubleHungWinPara dbhungPara = para as DoubleHungWinPara;
     string typeName = dbhungPara.Type;
     double height = dbhungPara.Height;
     double width = dbhungPara.Width;
     double sillHeight = dbhungPara.SillHeight;
     double windowInset = dbhungPara.Inset;
     switch (m_document.DisplayUnitSystem)
     {
         case Autodesk.Revit.DB.DisplayUnit.METRIC:
             height = Utility.MetricToImperial(height);
             width = Utility.MetricToImperial(width);
             sillHeight = Utility.MetricToImperial(sillHeight);
             windowInset = Utility.MetricToImperial(windowInset);
             break;
     }
     try
     {
         FamilyType type = m_familyManager.NewType(typeName);
         m_familyManager.CurrentType = type;
         m_familyManager.Set(m_familyManager.get_Parameter(BuiltInParameter.WINDOW_HEIGHT),height);
         m_familyManager.Set(m_familyManager.get_Parameter(BuiltInParameter.WINDOW_WIDTH),width);
         m_familyManager.Set(m_familyManager.get_Parameter("Default Sill Height"),sillHeight);
         m_familyManager.Set(m_familyManager.get_Parameter("Window Inset"), windowInset);
         return true;
     }
     catch(Exception e)
     {
         System.Diagnostics.Debug.WriteLine(e.Message);
         return false;
     }
 }