コード例 #1
0
        private string GetRevitFamily(RevitFamilyHandling mode)
        {
            string revitFamily = "";

            switch (mode)
            {
            case RevitFamilyHandling.ResetRevitFamily:
                revitFamily = "null";
                break;

            case RevitFamilyHandling.SetRevitFamily:

                //  Open Revit families popup
                var revitFamiliesSelectionPopup = new RevitFamiliesSelectionPopup(runtimeElStructureList);
                var result = revitFamiliesSelectionPopup.ShowDialog();

                //  Update Mapping grids with data coming from popup
                if (result == DialogResult.OK)
                {
                    //  Update RevitInventor mapping datagrid with Revit family selected in the popup
                    revitFamily = revitFamiliesSelectionPopup.SelectedRevitFamily;
                }
                break;
            }

            return(revitFamily);
        }
コード例 #2
0
        //  Open modal popup for Revit family selection
        private void btnSelectFromScope_Click(object sender, EventArgs e)
        {
            var    invTemplRowCount = dgInvRevMapping.Rows.GetRowCount(DataGridViewElementStates.Selected);
            string invTemplate      = "";

            if (invTemplRowCount == 1)
            {
                invTemplate = dgInvRevMapping.SelectedRows[0].Cells[0].Value.ToString();
            }
            else
            {
                //MessageBox.Show("You have to select one Inventor Template");
                lll

                return;
            }

            //  Open Revit families popup
            var revitFamiliesSelectionPopup = new RevitFamiliesSelectionPopup(elStructureList);
            var result = revitFamiliesSelectionPopup.ShowDialog();

            //  Update Mapping grid with data comiung from popup
            if (result == DialogResult.OK)
            {
                var selRevFamily = revitFamiliesSelectionPopup.SelectedRevitFamily;

                var invElement = invRevMappingDataSource.Single(k => k.InventorTemplate == invTemplate);
                invElement.RevitFamily = selRevFamily;

                dgInvRevMapping.DataSource = null;
                dgInvRevMapping.DataSource = invRevMappingDataSource;
            }
        }