示例#1
0
        private void Form_Main_Load(object sender, EventArgs e)
        {
            // is family document? If so disable Categories group
            if (m_doc.IsFamilyDocument == true)
            {
                PanCategories.Enabled = false;
            }

            LoadCategories();
            LoadGroupingNames();

            // try get shared parameters file and load them
            try
            {
                DefinitionFile df = m_app.OpenSharedParameterFile();

                if (df != null)
                {
                    LoadSharedParameters();
                    LblSharedParameterFile.Text = df.Filename;
                }
            }
            catch (Exception)
            {
            }
        }
示例#2
0
        public static Definition sharedParameterYarat(RevitApplication app, string name, string group, ParameterType type, bool visible, Guid myGuid)
        {
            DefinitionFile defFile = myApp.OpenSharedParameterFile();

            if (defFile == null)
            {
                throw new Exception("No SharedParameter File!");
            }
            DefinitionGroup dg = RawConvertSetToList <DefinitionGroup>(defFile.Groups).FirstOrDefault(g => g.Name == group);

            if (dg == null)
            {
                dg = defFile.Groups.Create(group);
            }
            Definition def = RawConvertSetToList <Definition>(dg.Definitions).FirstOrDefault(d => d.Name == name);

            if (def != null)
            {
                return(def);
            }
            //Guid myGuid = new Guid("A0AD7058-9A98-47AC-89B1-0E1CBD5FCDCB");
            ExternalDefinitionCreationOptions edco = new ExternalDefinitionCreationOptions(name, type);

            edco.GUID    = myGuid;
            edco.Visible = true;
            def          = dg.Definitions.Create(edco);
            return(def);
        }
示例#3
0
        public static void sharedParameterEkle(RevitApplication app, string name, CategorySet cats, BuiltInParameterGroup group, bool inst)
        {
            DefinitionFile defFile = app.OpenSharedParameterFile();

            if (defFile == null)
            {
                throw new Exception("No SharedParameter File!");
            }
            var v = (from DefinitionGroup dg in defFile.Groups
                     from ExternalDefinition d in dg.Definitions
                     where d.Name == name
                     select d);

            if (v == null || v.Count() < 1)
            {
                throw new Exception("Invalid Name Input!");
            }
            ExternalDefinition def = v.First();

            Autodesk.Revit.DB.Binding binding = app.Create.NewTypeBinding(cats);
            if (inst)
            {
                binding = app.Create.NewInstanceBinding(cats);
            }
            BindingMap map = (new UIApplication(app)).ActiveUIDocument.Document.ParameterBindings;

            map.Insert(def, binding, group);
        }
示例#4
0
文件: T.lbr.cs 项目: khanhcegvn/CEGVN
        public void CONNECTION(Document doc, c.Application app)
        {
            FamilyManager familyManager = doc.FamilyManager;
            string        origfile      = app.SharedParametersFilename;
            string        tempFile      = @"C:\Program Files\Autodesk\CEGCustomMenu\Shared_Params_2015_v01.json";
            Transaction   tran          = new Transaction(doc, "add parameter");

            tran.Start();
            app.SharedParametersFilename = tempFile;
            DefinitionFile shareParameterfile = app.OpenSharedParameterFile();

            foreach (DefinitionGroup i in shareParameterfile.Groups)
            {
                if (i.Name == "IDENTITY")
                {
                    //group data
                    FamilyParameter p1 = _AddParameter(doc, i, "CONTROL_MARK", BuiltInParameterGroup.PG_DATA, false);
                    FamilyParameter p2 = _AddParameter(doc, i, "IDENTITY_COMMENT", BuiltInParameterGroup.PG_DATA, false);
                    FamilyParameter p3 = _AddParameter(doc, i, "IDENTITY_DESCRIPTION", BuiltInParameterGroup.PG_DATA, false);
                    FamilyParameter p4 = _AddParameter(doc, i, "IDENTITY_DESCRIPTION_SHORT", BuiltInParameterGroup.PG_DATA, false);
                    FamilyParameter p5 = _AddParameter(doc, i, "MANUFACTURER_PLANT_DESCRIPTION", BuiltInParameterGroup.PG_DATA, false);
                    FamilyParameter p6 = _AddParameter(doc, i, "MANUFACTURER_PLANT_ID", BuiltInParameterGroup.PG_DATA, false);
                    FamilyParameter p7 = _AddParameter(doc, i, "MANUFACTURE_COMPONENT", BuiltInParameterGroup.PG_DATA, false);
                    FamilyParameter p8 = _AddParameter(doc, i, "SORTING_ORDER", BuiltInParameterGroup.PG_DATA, false);
                    familyManager.Set(p7, "CONNECTION");
                }
            }
            tran.Commit();
        }
示例#5
0
文件: Utils.cs 项目: dnenov/ndBIM
        public static DefinitionFile GetSharedParamsFile(
            Autodesk.Revit.ApplicationServices.Application app)
        {
            // Get current shared params file name
            string sharedParamsFileName;

            try
            {
                sharedParamsFileName = app.SharedParametersFilename;
            }
            catch (Exception ex)
            {
                ErrorMsg("No shared params file set:" + ex.Message);
                return(null);
            }
            if (0 == sharedParamsFileName.Length)
            {
                var filename = "";

                using (var ofd = new OpenFileDialog())
                {
                    DialogResult result = ofd.ShowDialog();

                    if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(ofd.FileName))
                    {
                        filename = ofd.FileName;
                    }
                }
                StreamWriter stream;
                stream = new StreamWriter(filename);
                stream.Close();
                app.SharedParametersFilename = filename;
                sharedParamsFileName         = app.SharedParametersFilename;
            }
            // Get the current file object and return it
            DefinitionFile sharedParametersFile;

            try
            {
                sharedParametersFile = app.OpenSharedParameterFile();
            }
            catch (Exception ex)
            {
                ErrorMsg("Cannnot open shared params file:" + ex.Message);
                sharedParametersFile = null;
            }
            return(sharedParametersFile);
        }
        /// <summary>
        /// Get GUID for a given shared param name.
        /// </summary>
        /// <param name="app">Revit application</param>
        /// <param name="defGroup">Definition group name</param>
        /// <param name="defName">Definition name</param>
        /// <returns>GUID</returns>
        public static Guid SharedParamGUID(Application app, string defGroup, string defName)
        {
            Guid guid = Guid.Empty;

            try
            {
                DefinitionFile     file               = app.OpenSharedParameterFile();
                DefinitionGroup    group              = file.Groups.get_Item(defGroup);
                Definition         definition         = group.Definitions.get_Item(defName);
                ExternalDefinition externalDefinition = definition as ExternalDefinition;
                guid = externalDefinition.GUID;
            }
            catch (Exception)
            {
            }
            return(guid);
        }
示例#7
0
        public Form1(ExternalEvent exEvent, RequestHandler handler, ExternalCommandData cData)
        {
            try
            {
                InitializeComponent();
                myExEvent   = exEvent;
                myHandler   = handler;
                commandData = cData;
                uiApp       = commandData.Application;
                uiDocument  = commandData.Application.ActiveUIDocument;
                //CachedDoc = CachedUiApp.ActiveUIDocument.Document;
                doc      = commandData.Application.ActiveUIDocument.Document;
                revitApp = uiApp.Application;
                myApp    = uiApp.Application;
                //app = commandData.Application;
                sharedParameterFileName = "InformatikParameters.txt";
                informatikPlace         = "MSU\\Informatik\\";

                spfPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                //sharedParameterFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\MSU" + @"\InformatikParameters.txt");
                spfPlace = new DirectoryInfo(Path.Combine(spfPath, informatikPlace));
                if (!Directory.Exists(spfPlace.ToString()))
                {
                    Directory.CreateDirectory(spfPlace.ToString());
                }
                sharedParameterFile = spfPlace.ToString() + "InformatikParameters.txt";
                MessageBox.Show(sharedParameterFile);

                if (!File.Exists(sharedParameterFile))
                {
                    File.Create(sharedParameterFile);
                }
                DefinitionFile defFile = myApp.OpenSharedParameterFile();
                myApp.SharedParametersFilename = sharedParameterFile;
                myHandler.f1 = this;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#8
0
        private static void CreateProjectParam(Autodesk.Revit.ApplicationServices.Application app,
                                               string name, ParameterType type, bool visible, CategorySet catSet, BuiltInParameterGroup group, bool inst)
        {
            // Check whether the parameter has already been added.
            BindingMap map = (new UIApplication(app)).ActiveUIDocument.Document.ParameterBindings;
            DefinitionBindingMapIterator itr = map.ForwardIterator();

            while (itr.MoveNext())
            {
                Definition exstDef = itr.Key;
                if (exstDef.Name == "LinkedTag")
                {
                    return;
                }
            }

            string orgFile  = app.SharedParametersFilename;
            string tempFile = Path.GetTempFileName() + ".txt";

            using (File.Create(tempFile)) { }
            app.SharedParametersFilename = tempFile;

            ExternalDefinition def = app.OpenSharedParameterFile().Groups.Create("TemporaryDefinitionGroup").Definitions.Create
                                         (new ExternalDefinitionCreationOptions(name, type)
            {
                Visible = visible
            }) as ExternalDefinition;

            app.SharedParametersFilename = orgFile;
            File.Delete(tempFile);

            Binding binding = app.Create.NewTypeBinding(catSet);

            if (inst)
            {
                binding = app.Create.NewInstanceBinding(catSet);
            }

            map.Insert(def, binding);
        }
示例#9
0
        bool CreateKeyParameter(Category category, Document document, string parameterName, ParameterType parameterType, BuiltInParameterGroup parameterGroup, Guid guid)
        {
            ARA.Application application = document.Application;
            string          temShareDefinitionFilePath      = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"/temSharpParam.txt";
            string          originalShareDefinitionFilePath = application.SharedParametersFilename;

            if (File.Exists(temShareDefinitionFilePath))
            {
                File.Delete(temShareDefinitionFilePath);
            }
            FileStream fileStream = File.Create(temShareDefinitionFilePath);

            fileStream.Close();

            application.SharedParametersFilename = temShareDefinitionFilePath;
            DefinitionFile  definitionFile = application.OpenSharedParameterFile();
            DefinitionGroup shareParaGroup = definitionFile.Groups.Create("mySharePara");
            ExternalDefinitionCreationOptions definitionOpt = new ExternalDefinitionCreationOptions(parameterName, parameterType);

            if (guid != null)
            {
                definitionOpt.GUID = guid;
            }
            Definition definition = shareParaGroup.Definitions.Create(definitionOpt);

            CategorySet categorySet = new CategorySet();

            categorySet.Insert(category);
            bool result = document.ParameterBindings.Insert(definition, new InstanceBinding(categorySet), parameterGroup);

            if (!String.IsNullOrEmpty(originalShareDefinitionFilePath))
            {
                application.SharedParametersFilename = originalShareDefinitionFilePath;
            }
            File.Delete(temShareDefinitionFilePath);

            return(result);
        }
        /// <summary>
        /// Helper to get shared parameters file.
        /// </summary>
        public static DefinitionFile GetSharedParamsFile(
            Application app)
        {
            // Get current shared params file name
            string sharedParamsFileName;

            try
            {
                sharedParamsFileName = app.SharedParametersFilename;
            }
            catch (Exception ex)
            {
                ErrorMsg("No shared params file set:" + ex.Message);
                return(null);
            }
            if (0 == sharedParamsFileName.Length)
            {
                string       path = LabConstants.SharedParamFilePath;
                StreamWriter stream;
                stream = new StreamWriter(path);
                stream.Close();
                app.SharedParametersFilename = path;
                sharedParamsFileName         = app.SharedParametersFilename;
            }
            // Get the current file object and return it
            DefinitionFile sharedParametersFile;

            try
            {
                sharedParametersFile = app.OpenSharedParameterFile();
            }
            catch (Exception ex)
            {
                ErrorMsg("Cannnot open shared params file:" + ex.Message);
                sharedParametersFile = null;
            }
            return(sharedParametersFile);
        }
示例#11
0
        /// <summary>
        /// Get or Create Shared Params File
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public static DefinitionFile GetOrCreateSharedParamsFile(AppRvt app)
        {
            string fileName = string.Empty;

            try // generic
            {
                // Get file
                fileName = app.SharedParametersFilename;
                // Create file if not set yet (ie after Revit installed and no Shared params used so far)
                if (string.Empty == fileName)
                {
                    fileName = SpecialDirectories.MyDocuments + "\\MyRevitSharedParams.txt";
                    StreamWriter stream = new StreamWriter(fileName);
                    stream.Close();
                    app.SharedParametersFilename = fileName;
                }
                return(app.OpenSharedParameterFile());
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR: Failed to get or create Shared Params File: " + ex.Message);
                return(null);
            }
        }
示例#12
0
        public bool LoadSharedParameterFile()
        {
            string         myDocsFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            OpenFileDialog ofd          = new OpenFileDialog();

            ofd.InitialDirectory = myDocsFolder;
            ofd.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            ofd.FilterIndex      = 1;
            ofd.RestoreDirectory = true;
            ofd.Title            = "Please Select the Shared Parameter File";

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                m_sharedFilePath = ofd.FileName;
                if (!File.Exists(m_sharedFilePath))
                {
                    return(true);
                }

                m_app.SharedParametersFilename = m_sharedFilePath;
                try
                {
                    m_sharedFile = m_app.OpenSharedParameterFile();
                }
                catch (System.Exception e)
                {
                    MessageBox.Show(e.Message);
                    return(false);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#13
0
文件: T.lbr.cs 项目: khanhcegvn/CEGVN
        public void EmbedStandard(Document doc, c.Application app, Dictionary <string, string> dic)
        {
            FamilyManager familyManager = doc.FamilyManager;
            string        origfile      = app.SharedParametersFilename;
            string        tempFile      = @"C:\Program Files\Autodesk\CEGCustomMenu\Shared_Params_2015_v01.json";
            Transaction   tran          = new Transaction(doc, "add parameter");

            tran.Start();
            app.SharedParametersFilename = tempFile;
            DefinitionFile shareParameterfile = app.OpenSharedParameterFile();

            foreach (DefinitionGroup i in shareParameterfile.Groups)
            {
                if (i.Name == "IDENTITY")
                {
                    //group data
                    FamilyParameter p1  = _AddParameter(doc, i, "CONTROL_MARK", BuiltInParameterGroup.PG_DATA, false);
                    string          vp1 = Getvalueparameter("CONTROL_MARK", dic);
                    familyManager.Set(p1, vp1);
                    FamilyParameter p2  = _AddParameter(doc, i, "IDENTITY_COMMENT", BuiltInParameterGroup.PG_DATA, false);
                    string          vp2 = Getvalueparameter("IDENTITY_COMMENT", dic);
                    familyManager.Set(p2, vp2);
                    FamilyParameter p3  = _AddParameter(doc, i, "IDENTITY_DESCRIPTION", BuiltInParameterGroup.PG_DATA, false);
                    string          vp3 = Getvalueparameter("IDENTITY_DESCRIPTION", dic);
                    familyManager.Set(p3, vp3);
                    FamilyParameter p4  = _AddParameter(doc, i, "IDENTITY_DESCRIPTION_SHORT", BuiltInParameterGroup.PG_DATA, false);
                    string          vp4 = Getvalueparameter("IDENTITY_DESCRIPTION_SHORT", dic);
                    familyManager.Set(p4, vp4);
                    FamilyParameter p5  = _AddParameter(doc, i, "MANUFACTURER_PLANT_DESCRIPTION", BuiltInParameterGroup.PG_DATA, false);
                    string          vp5 = Getvalueparameter("MANUFACTURER_PLANT_DESCRIPTION", dic);
                    familyManager.Set(p5, vp5);
                    FamilyParameter p6  = _AddParameter(doc, i, "MANUFACTURER_PLANT_ID", BuiltInParameterGroup.PG_DATA, false);
                    string          vp6 = Getvalueparameter("MANUFACTURER_PLANT_ID", dic);
                    familyManager.Set(p6, vp6);
                    FamilyParameter p7 = _AddParameter(doc, i, "MANUFACTURE_COMPONENT", BuiltInParameterGroup.PG_DATA, false);
                    FamilyParameter p8 = _AddParameter(doc, i, "SORTING_ORDER", BuiltInParameterGroup.PG_DATA, false);
                    familyManager.Set(p7, "EMBED STANDARD");
                    familyManager.Set(p8, int.Parse("100"));
                }
                if (i.Name == "DIMENSIONS_GENERAL")
                {
                    FamilyParameter p1  = _AddParameter(doc, i, "DIM_HEIGHT", BuiltInParameterGroup.PG_GEOMETRY, false);
                    string          vp1 = Getvalueparameter("DIM_HEIGHT", dic);
                    if (!string.IsNullOrEmpty(vp1))
                    {
                        familyManager.Set(p1, Convert.ToDouble(vp1));
                    }
                    FamilyParameter p2  = _AddParameter(doc, i, "DIM_THICKNESS", BuiltInParameterGroup.PG_GEOMETRY, false);
                    string          vp2 = Getvalueparameter("DIM_THICKNESS", dic);
                    if (!string.IsNullOrEmpty(vp2))
                    {
                        familyManager.Set(p2, Convert.ToDouble(vp2));
                    }
                    FamilyParameter p3  = _AddParameter(doc, i, "DIM_WIDTH", BuiltInParameterGroup.PG_GEOMETRY, false);
                    string          vp3 = Getvalueparameter("DIM_WIDTH", dic);
                    if (!string.IsNullOrEmpty(vp3))
                    {
                        familyManager.Set(p3, Convert.ToDouble(vp3));
                    }
                    FamilyParameter _p3  = _AddParameter(doc, i, "DBA_Length", BuiltInParameterGroup.PG_GEOMETRY, false);
                    string          _vp3 = Getvalueparameter("DBA_Length", dic);
                    if (!string.IsNullOrEmpty(_vp3))
                    {
                        familyManager.Set(_p3, Convert.ToDouble(_vp3));
                    }
                }
            }
            tran.Commit();
        }
示例#14
0
        public Result Execute(ExternalCommandData commandData,
                              ref string message,
                              ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;

            Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
            Document doc = uidoc.Document;

            // Launches the application window (WPF) for user input
            OpenRFA_WPF_CS.MainWindow appDialog = new MainWindow();
            appDialog.ShowDialog();


            {
                // Only executes if the user clicked "OK" button
                if (appDialog.DialogResult.HasValue && appDialog.DialogResult.Value)
                {
                    // Opens configuration window
                    OpenRFA_WPF_CS.ConfigureImport confDialog = new ConfigureImport();
                    confDialog.ShowDialog();

                    using (Transaction trans = new Transaction(doc, "AddParams"))
                    {
                        // Save list of parameters from MainWindow
                        ImportProcess.ParamCache = MainWindow.paramsOut;

                        // Check if configuration options have been saved
                        if (confDialog.DialogResult.HasValue && confDialog.DialogResult.Value)
                        {
                            // Test text for showing if datatable has been updated.
                            StringBuilder sb = new StringBuilder();
                            sb.Append("Updated datatable: \n");
                            foreach (DataRow dr in ConfigureImport.dtConfig.Rows)
                            {
                                sb.Append(dr[0] + ", " + dr[1] + "," + dr[2] + "\n");
                            }
                            MessageBox.Show(sb.ToString());

                            trans.Start();

                            // Set current shared parameters file
                            app.SharedParametersFilename = LocalFiles.tempDefinitionsFile;
                            defFile = app.OpenSharedParameterFile();

                            // Adds shared parameters to family
                            // TODO: Pass a list of BuiltInParameterGroup (currently only a placeholder) for overload
                            //SharedParameter.ImportParameterToFamily(doc, defFile, BuiltInParameterGroup.PG_MECHANICAL);

                            foreach (DataRow _row in ConfigureImport.dtConfig.Rows)
                            {
                                // Check if configuration is set to instance.
                                // TODO: Turn this into a method.
                                bool _instance = false;
                                if (_row[2].ToString() == "Instance")
                                {
                                    _instance = true;
                                }
                                else
                                {
                                    _instance = false;
                                }

                                // Get BuiltInParameterGroup by name
                                BuiltInParameterGroup _bipGroup = new BuiltInParameterGroup();
                                _bipGroup = SPBuiltInGroup.GetByName(_row[1].ToString());

                                // Get BIPG using the BuiltinParameterGroupLookup Class
                                var lookup = new BuiltInParameterGroupLookup();
                                BuiltInParameterGroup _selectedGroup = lookup[_row[1].ToString()];

                                // Write shared parameter to family
                                SharedParameter.ImportParameterToFamily(doc, defFile, _row, _selectedGroup, _instance);
                            }

                            trans.Commit();
                        }
                        else
                        {
                            MessageBox.Show("Operation canceled.");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Operation canceled.");
                }
            }

            // Clear DataTables. TODO: Turn this into a method.
            ConfigureImport.dtConfig.Clear();
            ImportProcess.RemoveColumns(ConfigureImport.dtConfig);

            return(Result.Succeeded);
        }
 /// <summary>
 /// Get GUID for a given shared param name.
 /// </summary>
 /// <param name="app">Revit application</param>
 /// <param name="defGroup">Definition group name</param>
 /// <param name="defName">Definition name</param>
 /// <returns>GUID</returns>
 public static Guid SharedParamGUID( Application app, string defGroup, string defName )
 {
     Guid guid = Guid.Empty;
       try
       {
     DefinitionFile file = app.OpenSharedParameterFile();
     DefinitionGroup group = file.Groups.get_Item( defGroup );
     Definition definition = group.Definitions.get_Item( defName );
     ExternalDefinition externalDefinition = definition as ExternalDefinition;
     guid = externalDefinition.GUID;
       }
       catch( Exception )
       {
       }
       return guid;
 }
 /// <summary>
 /// Helper to get shared parameters file.
 /// </summary>
 public static DefinitionFile GetSharedParamsFile(
     Application app)
 {
     // Get current shared params file name
       string sharedParamsFileName;
       try
       {
     sharedParamsFileName = app.SharedParametersFilename;
       }
       catch( Exception ex )
       {
     ErrorMsg( "No shared params file set:" + ex.Message );
     return null;
       }
       if( 0 == sharedParamsFileName.Length )
       {
     string path = LabConstants.SharedParamFilePath;
     StreamWriter stream;
     stream = new StreamWriter( path );
     stream.Close();
     app.SharedParametersFilename = path;
     sharedParamsFileName = app.SharedParametersFilename;
       }
       // Get the current file object and return it
       DefinitionFile sharedParametersFile;
       try
       {
     sharedParametersFile = app.OpenSharedParameterFile();
       }
       catch( Exception ex )
       {
     ErrorMsg( "Cannnot open shared params file:" + ex.Message );
     sharedParametersFile = null;
       }
       return sharedParametersFile;
 }
示例#17
0
        /// <summary>
        /// Configures parameters to be imported to a family
        /// </summary>
        /// <param name="doc">The Revit document to process (must be a Revit family).</param>
        /// <param name="app">The current Revit application.</param>
        /// <param name="dialogHasValue">Does the MainWindow object have a value?</param>
        /// <param name="dialogValue">The result of the MainWindow object.</param>
        public static void ProcessImport(
            Document doc,
            Autodesk.Revit.ApplicationServices.Application app,
            bool dialogHasValue,
            bool dialogValue
            )
        {
            using (Transaction trans = new Transaction(doc, "AddParams"))
            {
                // Save list of parameters from MainWindow
                ImportProcess.ParamCache = ImportProcess.paramsOut;

                // Check if configuration options have been saved
                if (dialogHasValue && dialogValue)
                {
                    // Start transaction
                    trans.Start();

                    // Set current shared parameters file
                    app.SharedParametersFilename = LocalFiles.tempDefinitionsFile;
                    defFile = app.OpenSharedParameterFile();

                    foreach (DataRow _row in ConfigureImport.dtConfig.Rows)
                    {
                        // Check if configuration is set to instance.
                        // TODO: Turn this into a method.
                        bool _instance = false;
                        if (_row[2].ToString() == "Instance")
                        {
                            _instance = true;
                        }
                        else
                        {
                            _instance = false;
                        }

                        // Get BuiltInParameterGroup by name
                        BuiltInParameterGroup _bipGroup = new BuiltInParameterGroup();
                        _bipGroup = SPBuiltInGroup.GetByName(_row[1].ToString());

                        // Get BIPG using the BuiltinParameterGroupLookup Class
                        var lookup = new BuiltInParameterGroupLookup();
                        BuiltInParameterGroup _selectedGroup = lookup[_row[1].ToString()];
                        try {
                            // Write shared parameter to family
                            ImportProcess.ImportParameterToFamily(doc, defFile, _row, _selectedGroup, _instance);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString(), "Error");
                        }
                    }

                    trans.Commit();

                    // Show messages to user
                    if (ImportProcess.existingParams.Count > 0)
                    {
                        MessageBox.Show(ImportProcess.addedParams.Count + " parameters have been added to this family.\n" +
                                        ImportProcess.existingParams.Count.ToString() + " parameters already exist in the family.");

                        // Clear list of parameters every time the method is complete
                        addedParams.Clear();
                        existingParams.Clear();
                    }
                    else
                    {
                        MessageBox.Show(ImportProcess.addedParams.Count + " parameters have been added to this family.\n");

                        // Clear list of parameters every time the method is complete
                        addedParams.Clear();
                        existingParams.Clear();
                    }
                }
                else
                {
                    MessageBox.Show("No parameters have been loaded.");
                }
            }
        }