/// <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)
        {
            FixedWinPara fixedWinPara = para as FixedWinPara;
            string       typeName     = fixedWinPara.Type;
            double       height       = fixedWinPara.Height;
            double       width        = fixedWinPara.Width;
            double       sillHeight   = fixedWinPara.SillHeight;
            double       windowInset  = fixedWinPara.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);
            }
        }
コード例 #2
0
 /// <summary>
 /// constructor of SlidingDoubleWinPara
 /// </summary>
 /// <param name="slidingDoublePara">SlidingDoubleWinPara</param>
 public SlidingDoubleWinPara(FixedWinPara slidingDoublePara)
     : base(slidingDoublePara)
 {
     m_inset      = slidingDoublePara.Inset;
     m_sillHeight = slidingDoublePara.SillHeight;
 }
コード例 #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());
        }
コード例 #4
0
 /// <summary>
 /// constructor of FixedWinPara
 /// </summary>
 /// <param name="fixedPara">FixedWinPara</param>
 public FixedWinPara(FixedWinPara fixedPara)
     : base(fixedPara)
 {
     m_inset      = fixedPara.Inset;
     m_sillHeight = fixedPara.SillHeight;
 }