Exemplo n.º 1
0
 public Menu(UtilitySettings utilitySettings, UtilityElements utilityElements, ICollection <ElementId> currentSelectionSet)
 {
     InitializeComponent();
     this.settings            = utilitySettings;
     this.elements            = utilityElements;
     this.currentSelectionSet = currentSelectionSet;
 }
Exemplo n.º 2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            UtilitySettings.SetWebApiUrl(ConfigurationManager.AppSettings["WebApiUrl"].ToString());
        }
Exemplo n.º 3
0
        public InitializeSettings(UtilitySettings utilitySettings)
        {
            //ExportElements
            utilitySettings.AddControlSettingArray("ExportElements", new string[, ] {
                { "ExportElementsPathCsvFolder", "textBoxPathCsvFolder", "" },
                { "ExportElementsCsvFileName", "textBoxCsvFileName", "" },
                { "ExportElementsMode", "groupBoxSelection", "radioButtonSelectCurrent" },
                { "ExportElementsConvert", "groupBoxConvert", "radioButtonConvertNone" },
                { "ExportElementsRoundPoints", "checkBoxRoundPoints", "true" },
                { "ExportElementsDecimals", "comboBoxDecimals", "2" },
                { "ExportElementsListErrors", "checkBoxListErrors", "true" },
                { "ExportElementsMaxErrors", "textBoxMaxErrors", "10" },
                { "ExportElementsAutoClose", "checkBoxAutoClose", "false" }
            });

            //CreateElements
            utilitySettings.AddControlSettingArray("CreateElements", new string[, ] {
                { "CreateElementsPathFolder", "textBoxPathFolder", "" },
                { "CreateElementsMode", "groupBoxMode", "radioButtonModeAdd" },
                { "CreateElementsUnits", "groupBoxUnits", "radioButtonUnitsProject" },
                { "CreateElementsUnitsFactor", "textBoxUnitsFactor", "1.0" },
                { "CreateElementsOriginX", "textBoxOriginX", "0.0" },
                { "CreateElementsOriginY", "textBoxOriginY", "0.0" },
                { "CreateElementsOriginZ", "textBoxOriginZ", "0.0" },
                { "CreateElementsSuppressMessages", "checkBoxSuppressMessages", "true" },
                { "CreateElementsListErrors", "checkBoxListErrors", "true" },
                { "CreateElementsMaxErrors", "textBoxMaxErrors", "10" },
                { "CreateElementsFamilyFamily", "comboBoxFamilyFamily", "" },
                { "CreateElementsFamilyType", "comboBoxFamilyType", "" },
                { "CreateElementsColumnMode", "comboBoxColumnMode", "Architectural" },
                { "CreateElementsColumnArchFamily", "comboBoxColumnArchFamily", "" },
                { "CreateElementsColumnArchType", "comboBoxColumnArchType", "" },
                { "CreateElementsColumnStructFamily", "comboBoxColumnStructFamily", "" },
                { "CreateElementsColumnStructType", "comboBoxColumnStructType", "" },
                { "CreateElementsBeamFamily", "comboBoxBeamFamily", "" },
                { "CreateElementsBeamType", "comboBoxBeamType", "" },
                { "CreateElementsAdaptiveCompFamily", "comboBoxAdaptiveCompFamily", "" },
                { "CreateElementsAdaptiveCompType", "comboBoxAdaptiveCompType", "" },
                { "CreateElementsMullionFamily", "comboBoxMullionFamily", "" },
                { "CreateElementsMullionType", "comboBoxMullionType", "" },
                { "CreateElementsAutoClose", "checkBoxAutoClose", "false" },
                { "CreateElementsPathTemplate", "textBoxPathTemplate", "" },
                { "CreateElementsTempFolder", "textBoxTempFolder", "" }
            });
        }
Exemplo n.º 4
0
        // *********************************************** Execute ***************************************************************
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
        {
            try {
                //Create the setting object, add the settings defined below, and try to read any existing .ini file.
                this.utilitySettings = new UtilitySettings(commandData, ref message, elementSet, PROGRAM_NAME, INI_FILE_NAME);
                if (!this.utilitySettings.ValidInstallation)
                {
                    return(Result.Succeeded);
                }

                InitializeSettings();
                if (!this.utilitySettings.ReadIniFile())
                {
                    this.utilitySettings.ReloadDefaultValues();
                }

                // TODO This is poor solution to eliminate automatic transctions.  Should move deeper into functions
                using (Transaction transaction = new Transaction(this.utilitySettings.DocumentDb)) {
                    transaction.Start("Testing RevitUtility");

                    SampleStart dialog = new SampleStart(this.utilitySettings);
                    dialog.ShowDialog();

                    transaction.Commit();
                }

                //Capture the final state into the main ini file even when a named group is in use.
                //Note that named group settings are not saved unless the user explicitly saves them
                //if (!this.utilitySettings.SetVariableSetting("NamedSettingGroup", this.utilitySettings.NamedSettingGroupName)) {
                //    System.Windows.Forms.MessageBox.Show("Error in this.utilitySettings.SetVariableSetting()");
                //    return Result.Failed;
                //}
                if (!this.utilitySettings.WriteIniFile())
                {
                    System.Windows.Forms.MessageBox.Show("Error in this.utilitySettings.WriteIniFile()");
                    return(Result.Failed);
                }
                return(Result.Succeeded);
            }
            catch (Exception e) {
                message = e.Message;
                return(Result.Failed);
            }
        }
Exemplo n.º 5
0
        // ************************************************************ Constructor ************************************************************

        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
        {
            try {
                //Create the setting object, add the settings defined below, and try to read any existing .ini file.
                this.settings = new UtilitySettings(commandData, ref message, elementSet, PROGRAM_NAME, INI_FILE_NAME);
                if (this.settings.Cancelled)
                {
                    return(Result.Succeeded);
                }
                if (!this.settings.ValidInstallation)
                {
                    message = "This version of Hummingbird is not compatible with this version of Revit.  Program cannot continue.";
                    return(Result.Failed);
                }

                // Save the current selection since the process of creating UtilityElements causes it to be lost (apparently whenever you do a transaction?)
                ICollection <ElementId> currentSelectionSet = this.settings.DocumentUi.Selection.GetElementIds();

                // Now create the utility elements
                this.elements = new UtilityElements(this.settings);
                InitializeSettings initializeSettings = new InitializeSettings(this.settings);
                if (!this.settings.ReadIniFile())
                {
                    this.settings.ReloadDefaultValues();
                }

                // open the main menu as modal dialog
                Menu menu = new Menu(this.settings, this.elements, currentSelectionSet);
                menu.ShowDialog();

                // Return control when menu is closed
                return(Result.Succeeded);
            }
            catch (Exception e) {
                message = e.Message;
                return(Result.Failed);
            }
        }
Exemplo n.º 6
0
        // 2015 Deprecated
        //public ExportElements(UtilitySettings utilitySettings, UtilityElements utilityElements, SelElementSet currentSelectionSet) {
        public ExportElements(UtilitySettings utilitySettings, UtilityElements utilityElements, ICollection <ElementId> currentSelectionSet)
        {
            InitializeComponent();
            this.settings            = utilitySettings;
            this.elements            = utilityElements;
            this.currentSelectionSet = currentSelectionSet;

            this.revitTypes = new RevitTypeNames();

            this.settings.SetFormControls(this);
            textBoxPathCsvFolder.Text = textBoxPathCsvFolder.Text.Trim();
            if (textBoxPathCsvFolder.Text.EndsWith(@"\"))
            {
                textBoxPathCsvFolder.Text = textBoxPathCsvFolder.Text.Substring(0, textBoxPathCsvFolder.Text.Length - 1);
            }
            this.pathCsvFolder      = textBoxPathCsvFolder.Text;
            textBoxCsvFileName.Text = textBoxCsvFileName.Text.Trim();
            if (!textBoxCsvFileName.Text.ToLower().EndsWith(".csv"))
            {
                textBoxCsvFileName.Text = textBoxCsvFileName.Text + ".csv";
            }
            this.csvFileName = textBoxCsvFileName.Text;
        }
Exemplo n.º 7
0
        //************************************************* Constructor *******************************************************

        public SampleStart(UtilitySettings utilitySettings)
        {
            InitializeComponent();
            this.utilitySettings = utilitySettings;

            //Put some sample data in the list controls just for illustrative purposes.
            listBox1.Items.Add("Default");
            listBox1.Items.Add("Second Item");
            listBox1.Items.Add("Third Item");
            comboBox1.Items.Add("Default");
            comboBox1.Items.Add("Second Item");
            comboBox1.Items.Add("Third Item");

            //*** Key Statements - Open Condition ***
            //These statements set variables
            string returnValue = "";

            if (!this.utilitySettings.GetVariableSetting("SampleValue", ref returnValue))
            {
                MessageBox.Show("Error in this.utilitySettings.GetVariableSetting.", this.utilitySettings.ProgramName);
                return;
            }
            labelDisplayValue.Text = returnValue;
            if (!this.utilitySettings.GetVariableSetting("NamedSettingGroup", ref returnValue))
            {
                MessageBox.Show("Error in this.utilitySettings.GetVariableSetting.", this.utilitySettings.ProgramName);
                return;
            }
            //this.utilitySettings.NamedSettingGroupName = returnValue;

            //These set control values.
            if (!this.utilitySettings.SetFormControls(this))
            {
                MessageBox.Show("Invalid setting value used with this.utilitySettings.SetFormControls.", this.utilitySettings.ProgramName);
                return;
            }
        }
Exemplo n.º 8
0
    private void ChangeSymbol(UtilitySettings settings)    // def CROSS_PLATFORM_INPUT;BCG_RCC
    {
        string symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android);

        string []     seperatedSymbols = symbols.Split(';');
        List <string> newSymbols       = new List <string>();

        if (settings.googlePlayGameServices)
        {
            newSymbols.Add(symbolGPGS);
        }
        if (settings.unityAdsServices)
        {
            newSymbols.Add(symbolUnityAds);
        }
        if (settings.admobServices)
        {
            newSymbols.Add(symbolAdmob);
        }
        if (settings.loggerEnabled)
        {
            newSymbols.Add(symbolLogger);
        }
        if (settings.playfabServices)
        {
            newSymbols.Add(symbolPlayfab);
        }
        if (settings.inAppPurcases)
        {
            newSymbols.Add(symbolInApp);
        }
        if (settings.leanTween)
        {
            newSymbols.Add(symbolLeanTween);
        }

        foreach (var seperatedSymbol in seperatedSymbols)
        {
            switch (seperatedSymbol)
            {
            case symbolAdmob:
                break;

            case symbolUnityAds:
                break;

            case symbolGPGS:
                break;

            case symbolPlayfab:
                break;

            case symbolLogger:
                break;

            case symbolInApp:
                break;

            case symbolLeanTween:
                break;

            default:
                newSymbols.Add(seperatedSymbol);
                break;
            }
        }

        if (newSymbols.Count == 0)
        {
            PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, string.Empty);
        }
        else
        {
            string output = newSymbols [0];

            for (int i = 1; i < newSymbols.Count; i++)
            {
                output += ";" + newSymbols [i];
            }

            PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, output);
        }
    }
Exemplo n.º 9
0
 private void OnEnable()
 {
     settings = target as UtilitySettings;
 }