/// <summary>
        /// constructor of DoubleHungWinCreation
        /// </summary>
        /// <param name="para">WizardParameter</param>
        /// <param name="commandData">ExternalCommandData</param>
        public DoubleHungWinCreation(WizardParameter para, CreateWindowData commandData)
            : base(para)
        {
            m_application   = commandData.Application;
            m_document      = commandData.Document;
            m_familyManager = m_document.FamilyManager;

            using (Transaction tran = new Transaction(m_document, "InitializeWindowWizard"))
            {
                tran.Start();

                CollectTemplateInfo();
                para.Validator = new ValidateWindowParameter(m_wallHeight, m_wallWidth);
                switch (m_document.DisplayUnitSystem)
                {
                case Autodesk.Revit.DB.DisplayUnit.METRIC:
                    para.Validator.IsMetric = true;
                    break;

                case Autodesk.Revit.DB.DisplayUnit.IMPERIAL:
                    para.Validator.IsMetric = false;
                    break;
                }
                para.PathName = "WindowFamily.rfa";
                CreateCommon();

                tran.Commit();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// The constructor of WindowCreation
 /// </summary>
 /// <param name="parameter">WizardParameter</param>
 public WindowCreation(WizardParameter parameter)
 {
     m_para = parameter;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// the method is used to show wizard form and do the creation
        /// </summary>
        /// <returns>the process result</returns>
        public bool RunWizard()
        {
            // For Window Family Creation workItem
            WindowsDAParams windowFamilyParams;

            windowFamilyParams = WindowsDAParams.Parse("WindowParams.json");

            m_para            = new WizardParameter();
            m_para.m_template = windowFamilyParams.WindowStyle;

            if (m_para.m_template.Equals("DoubleHungWindow", StringComparison.CurrentCultureIgnoreCase))
            {
                m_winCreator = new DoubleHungWinCreation(m_para, m_commandData);
                foreach (TypeDAParams type in windowFamilyParams.Types)
                {
                    DoubleHungWinPara dbhungWinPara = new DoubleHungWinPara(m_para.Validator.IsMetric);
                    dbhungWinPara.Height     = type.WindowHeight;
                    dbhungWinPara.Width      = type.WindowWidth;
                    dbhungWinPara.Inset      = type.WindowInset;
                    dbhungWinPara.SillHeight = type.WindowSillHeight;
                    dbhungWinPara.Type       = type.TypeName;
                    m_para.CurrentPara       = dbhungWinPara;
                    if (!m_para.WinParaTab.Contains(dbhungWinPara.Type))
                    {
                        m_para.WinParaTab.Add(dbhungWinPara.Type, dbhungWinPara);
                    }
                    else
                    {
                        m_para.WinParaTab[dbhungWinPara.Type] = dbhungWinPara;
                    }
                }
                m_para.GlassMat = windowFamilyParams.GlassPaneMaterial;
                m_para.SashMat  = windowFamilyParams.SashMaterial;
            }
            else if (m_para.m_template == "SlidingDoubleWindow")
            {
                m_winCreator = new SlidingDoubleWinCreation(m_para, m_commandData);
                // TBD: Collect the params of Sliding Double window
                foreach (TypeDAParams type in windowFamilyParams.Types)
                {
                    SlidingDoubleWinPara slidingDoubleWinPara = new SlidingDoubleWinPara(m_para.Validator.IsMetric);
                    slidingDoubleWinPara.Height     = type.WindowHeight;
                    slidingDoubleWinPara.Width      = type.WindowWidth;
                    slidingDoubleWinPara.Inset      = type.WindowInset;
                    slidingDoubleWinPara.SillHeight = type.WindowSillHeight;
                    slidingDoubleWinPara.Type       = type.TypeName;
                    m_para.CurrentPara = slidingDoubleWinPara;
                    if (!m_para.WinParaTab.Contains(slidingDoubleWinPara.Type))
                    {
                        m_para.WinParaTab.Add(slidingDoubleWinPara.Type, slidingDoubleWinPara);
                    }
                    else
                    {
                        m_para.WinParaTab[slidingDoubleWinPara.Type] = slidingDoubleWinPara;
                    }
                }
                m_para.GlassMat = windowFamilyParams.GlassPaneMaterial;
                m_para.SashMat  = windowFamilyParams.SashMaterial;
            }
            else
            {
                m_winCreator = new FixedWinCreation(m_para, m_commandData);
                // TBD: Collect the params of Fixed Double window
                foreach (TypeDAParams type in windowFamilyParams.Types)
                {
                    FixedWinPara fixedWinPara = new FixedWinPara(m_para.Validator.IsMetric);
                    fixedWinPara.Height     = type.WindowHeight;
                    fixedWinPara.Width      = type.WindowWidth;
                    fixedWinPara.Inset      = type.WindowInset;
                    fixedWinPara.SillHeight = type.WindowSillHeight;
                    fixedWinPara.Type       = type.TypeName;
                    m_para.CurrentPara      = fixedWinPara;
                    if (!m_para.WinParaTab.Contains(fixedWinPara.Type))
                    {
                        m_para.WinParaTab.Add(fixedWinPara.Type, fixedWinPara);
                    }
                    else
                    {
                        m_para.WinParaTab[fixedWinPara.Type] = fixedWinPara;
                    }
                }
                m_para.GlassMat = windowFamilyParams.GlassPaneMaterial;
                m_para.SashMat  = windowFamilyParams.SashMaterial;
            }
            return(Creation());
        }