/// <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();
            }
        }
Exemple #2
0
        protected bool CreateWindowFamily(DesignAutomationData data)
        {
            if (data == null)
            {
                return(false);
            }

            Application app = data.RevitApp;

            if (app == null)
            {
                return(false);
            }

            string modelPath = data.FilePath;

            if (String.IsNullOrWhiteSpace(modelPath))
            {
                return(false);
            }

            Document doc = data.RevitDoc;

            if (doc == null)
            {
                return(false);
            }

            CreateWindowData createWindowData = new CreateWindowData();

            createWindowData.Application = app;
            createWindowData.Document    = doc;


            ////////////////////////////////////////////////////////////////
            if (!doc.IsFamilyDocument)
            {
                Console.WriteLine("It's not family document");
                return(false);
            }
            else
            {
                if (null != doc.OwnerFamily && null != doc.OwnerFamily.FamilyCategory &&
                    doc.OwnerFamily.FamilyCategory.Name != doc.Settings.Categories.get_Item(BuiltInCategory.OST_Windows).Name)
                // FamilyCategory.Name is not "Windows".
                {
                    Console.WriteLine("It's not windows family template");
                    return(false);
                }
                WindowWizard wizard = new WindowWizard(createWindowData);
                return(wizard.RunWizard());
            }
        }
Exemple #3
0
 /// <summary>
 /// constructor of WindowWizard
 /// </summary>
 /// <param name="commandData">the ExternalCommandData parameter</param>
 public WindowWizard(CreateWindowData commandData)
 {
     m_commandData = commandData;
 }