Beispiel #1
0
        private void btn_browse_mapperFile_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter           = "Mapper XML files (*.XMLMapper)|*.XMLMapper|CSV Mapper (*.CSVMapper1)|*.CSVMapper1"; // "Mapper files (*.Mapper)|*.map";
                ofd.RestoreDirectory = true;
                DialogResult sdResult = ofd.ShowDialog();

                foreach (string file in ofd.FileNames)
                {
                    //extract the data from the selected file.
                    GH.getFileObject(file, "mapper");
                }
                //set that file to the combobox
                cBox_Mapper.SelectedIndex = cBox_Mapper.Items.Count - 1;
                C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_Mapper.SelectedItem;

                GH.getMapper(FI.filePath);
                //set that file to the combobox
                UIH.toastIT("Mapper files read sucessfully!", "File Read", NotificationType.Information);
            }
            catch (System.Exception ee)
            {
                GH.writeLog(ee.ToString());
            }
        }
Beispiel #2
0
        private void cBox_objectType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (cBox_objectType.Items.Count > 0)
                {
                    string objTypeSelected = cBox_objectType.SelectedItem.ToString();
                    GH.qprint("objTypeSelected : " + objTypeSelected);
                    lBox_CurrentNotes.ItemsSource = null;
                    lBox_CurrentNotes.Items.Clear();
                    lBox_CurrentNotes.ItemsSource = GV.NotesCollection_Anno2[cBox_objectType.SelectedItem.ToString()];

                    tBox_Heading.Text = objTypeSelected;
                }
            }
            catch (Autodesk.Civil.CivilException ex)
            {
                //GH.errorBox(ex.ToString());
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                //GH.errorBox(ex.ToString());
            }
            catch (System.Exception ee)
            {
                //GH.errorBox(ee.ToString());
            }
        }
Beispiel #3
0
        private void cBox_objectType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                string objTypeSelected = cBox_objectType.SelectedItem.ToString();
                GH.qprint("objTypeSelected : " + objTypeSelected);

                //load notes
                List <Global.labelItem> filteredLabels = GV.all_label_coll_Sorted[objTypeSelected];
                //filteredLabels = filteredLabels.GroupBy(n => n.noteNumber).Select(g => g.First()).ToList();
                //filteredLabels = filteredLabels.Where(x => x.note != null).ToList();

                lBox_CurrentNotes.ItemsSource = filteredLabels.GroupBy(n => n.noteNumber).Select(g => g.First()).Where(x => x.note != null && x.noteFound == true).ToList();
                lBox_missingNotes.ItemsSource = filteredLabels.GroupBy(n => n.noteNumber).Select(g => g.First()).Where(x => x.noteFound == false).ToList();
                lBox_labels.ItemsSource       = filteredLabels;

                if (filteredLabels.Count > 0)
                {
                    tBox_Heading.Text = objTypeSelected;
                }
            }
            catch (Autodesk.Civil.CivilException ex)
            {
                //GH.errorBox(ex.ToString());
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                //GH.errorBox(ex.ToString());
            }
            catch (System.Exception ee)
            {
                //GH.errorBox(ee.ToString());
            }
        }
Beispiel #4
0
        private void lBox_labels_zoomto_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //check if the uesr in paper space if so swithc to model space
                Helper.ViewportExtensions.toggleModelspace();
                //MessageBox.Show("lBox_labels_zoomto_Click");
                GV.selLabels = new ObjectIdCollection();

                if (listView_styleComponentMapper.SelectedItems.Count > 0)
                {
                    List<Global.labelComponentItem> selectedItems = listView_styleComponentMapper.SelectedItems.Cast<Global.labelComponentItem>().ToList();

                    if (selectedItems[0].objID.ObjectClass.DxfName.ToString() == "MULTILEADER")
                    {
                        selectedItems = selectedItems.Reverse<Global.labelComponentItem>().Reverse().ToList();
                    }
                    foreach (Global.labelComponentItem item in listView_styleComponentMapper.SelectedItems)
                    {
                        GV.selLabels.Add(item.objID);
                    }
                    LCH.ZoomObjects(GV.selLabels);
                }

            }
            catch (System.Exception ee)
            {
                GH.writeLog(ee.ToString());
            }
        }
Beispiel #5
0
        private void lBox_labels_select_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //check if the uesr in paper space if so swithc to model space
                Helper.ViewportExtensions.toggleModelspace();

                GV.selLabels = new ObjectIdCollection();

                if (listView_styleComponentMapper.SelectedItems.Count > 0)
                {
                    foreach (Global.labelComponentItem item in listView_styleComponentMapper.SelectedItems)
                    {
                        GV.selLabels.Add(item.objID);
                    }

                    ObjectId[] ids = new ObjectId[listView_styleComponentMapper.SelectedItems.Count];
                    GV.selLabels.CopyTo(ids, 0);
                    Utils.SelectObjects(ids);
                    LCH.ZoomObjects(GV.selLabels);
                }

            }
            catch (System.Exception ee)
            {
                GH.writeLog(ee.ToString());
            }
        }
Beispiel #6
0
        private void loadStyleItem(int moverVal)
        {
            try
            {
                collIndex = collIndex + moverVal;
                if (collIndex <= selObjs.Count)
                {
                    Global.labelComponentItem item = (Global.labelComponentItem)selObjs[collIndex - 1];

                    tBox_styleName.Text = item.styleName;
                    Blink(false, "");
                }
                else
                {
                    loadStyleItem(-2);
                }
            }
            catch (Autodesk.Civil.CivilException ex)
            {
                GH.errorBox(ex.ToString());
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                GH.errorBox(ex.ToString());
            }
            catch (System.Exception ee)
            {
                GH.errorBox(ee.ToString());
                //close the grid
                grid_addStyle.Visibility = System.Windows.Visibility.Hidden;
            }
        }
Beispiel #7
0
 private void addNoteType()
 {
     if (!GV.noteTypeListColl.Contains(cBox_styleType.Text.ToString()))
     {
         GV.noteTypeListColl.Add(cBox_styleType.Text.ToString());
         //remove from the ini file
         GH.updateNoteTypeList();
     }
 }
Beispiel #8
0
        private void btn_selectViewport_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //check if defnition and  note list are selected
                if (checkifDefnitionsSelected())
                {
                    //rest progressbar
                    proBar.Value = 0;

                    using (GV.Doc.LockDocument())
                    {
                        short val = (short)AcAp.GetSystemVariable("CVPORT");

                        if (val != 1)
                        {
                            GV.processStatus = false;
                            UIH.toastIT("This option works only in Paperspace (Layouts), please swtich to paperspace and try again!", "Viewport Not Preset", NotificationType.Error);
                        }
                        else
                        {
                            Helper.ViewportExtensions.getvPortCoordinatesADV();
                            if (GV.processStatus == true && GV.selObjects_forProcessing != null)
                            {
                                bw.WorkerSupportsCancellation = true;
                                bw.WorkerReportsProgress      = true;
                                //bw.ProgressChanged += bw_ProgressChanged;
                                bw.DoWork += new DoWorkEventHandler(bw_UpdateProgressBar);
                                //start work
                                if (bw.IsBusy != true)
                                {
                                    bw.RunWorkerAsync();
                                }

                                ProcessLabels();
                                updateUIdata();

                                UIH.toastIT("All selected labels processed successfully!", "Status", NotificationType.Success);
                            }
                        }
                    }
                }
            }
            catch (Autodesk.Civil.CivilException ex)
            {
                GH.errorBox(ex.ToString());
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                GH.errorBox(ex.ToString());
            }
            catch (System.Exception ee)
            {
                GH.errorBox(ee.ToString());
            }
        }
Beispiel #9
0
 private void btn_del_styletype_item_Click(object sender, RoutedEventArgs e)
 {
     if (GV.noteTypeListColl.Contains(cBox_styleType.Text.ToString()))
     {
         GV.noteTypeListColl.Remove(cBox_styleType.Text.ToString());
         //remove from the ini file
         GH.updateNoteTypeList();
         cBox_styleType.SelectedIndex = 0;
     }
 }
Beispiel #10
0
 public void updateObjectType()
 {
     try
     {
     }
     catch (System.Exception ee)
     {
         GH.writeLog(ee.ToString());
     }
 }
Beispiel #11
0
 private void lBox_labels_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
     }
     catch (System.Exception ee)
     {
         GH.writeLog(ee.ToString());
     }
 }
Beispiel #12
0
        private void Btn_addStyle_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //load the current item
                if (selObjs.Where(item => item.styleName == tBox_styleName.Text).Any() == true)
                {
                    LI = selObjs.Where(item => item.styleName == tBox_styleName.Text).Single();
                }

                //check if that object already exists
                if (GV.labelComponentItem_coll.Where(LabelItem => LabelItem.styleName == LI.styleName).Any() == false)
                {
                    //check if all the values are filled in
                    if (tBox_styleName.Text == string.Empty)
                    {
                        Blink(true, "Style name missing, please enter");
                    }
                    //else if (tBox_styleKNloc.Text == string.Empty)
                    //{
                    //    Blink(true, "Style KN location missing, please enter");
                    //}
                    else if (cBox_styleType.Text == string.Empty)
                    {
                        Blink(true, "Style type missing, please enter");
                    }
                    else
                    {
                        //user approval
                        LI.labelType = cBox_styleType.Text;
                        LI.learnStatus = true;
                        GV.labelComponentItem_coll.Add(LI);

                        //if note type note in the list then add to the list and the file
                        addNoteType();

                        if (selObjs.Where(item => item.styleName == LI.styleName).Any() == true)
                        {
                            selObjs.Remove(selObjs.Where(item => item.styleName == LI.styleName).Single());
                        }

                        //check if next item exsits if so move or else close
                        moveOrClose();
                        Blink(false, "");
                    }
                }
                else // item already exists
                {
                    Blink(true, "Style already exists!");
                    moveOrClose();
                }
            }
            catch (System.Exception ex)
            { GH.writeLog(ex.ToString()); }
        }
Beispiel #13
0
        private void btn_selectLabels_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //check if defnition and  note list are selected
                if (checkifDefnitionsSelected())
                {
                    //rest progressbar
                    proBar.Value = 0;


                    using (GV.Doc.LockDocument())
                    {
                        PromptSelectionResult psRes = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetSelection(new SelectionFilter(LCH.selectionFilter(GV.labelFilterType)));

                        if (psRes.Status == PromptStatus.OK)
                        {
                            SelectionSet acSSet = psRes.Value;
                            GV.selObjects_forProcessing = acSSet.GetObjectIds();

                            //get key notes based on the selection

                            bw.WorkerSupportsCancellation = true;
                            bw.WorkerReportsProgress      = true;
                            //bw.ProgressChanged += bw_ProgressChanged;
                            bw.DoWork += new DoWorkEventHandler(bw_UpdateProgressBar);
                            //start work
                            if (bw.IsBusy != true)
                            {
                                bw.RunWorkerAsync();
                            }

                            ProcessLabels();

                            updateUIdata();

                            UIH.toastIT("All selected labels processed successfully!", "Status", NotificationType.Success);
                        }
                    }
                }
            }
            catch (Autodesk.Civil.CivilException ex)
            {
                GH.errorBox(ex.ToString());
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                GH.errorBox(ex.ToString());
            }
            catch (System.Exception ee)
            {
                GH.errorBox(ee.ToString());
            }
        }
Beispiel #14
0
 public AAPro()
 {
     try
     {
         InitializeComponent();
         GV.labelComponentItem_coll.Clear();
         listView_styleComponentMapper.ItemsSource = GV.labelComponentItem_coll;
         cBox_styleType.ItemsSource = GV.noteTypeListColl;
     }
     catch (System.Exception ex)
     { GH.writeLog(ex.ToString()); }
 }
Beispiel #15
0
 private void btn_fetchSelectedmapperFiles_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_Mapper.SelectedItem;
         GH.getMapper(FI.filePath);
     }
     catch (System.Exception ee)
     {
         GH.writeLog(ee.ToString());
     }
 }
Beispiel #16
0
 private void btn_open_templateFile_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_template.SelectedItem;
         Process.Start("notepad.exe", FI.filePath);
     }
     catch (System.Exception ee)
     {
         GH.writeLog(ee.ToString());
     }
 }
Beispiel #17
0
 private void cBox_template_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_template.SelectedItem;
         GH.getTemplateDetails(FI.filePath);
     }
     catch (System.Exception ee)
     {
         GH.writeLog(ee.ToString());
     }
 }
Beispiel #18
0
 private void btn_fetchSelectedtamplateFile_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_template.SelectedItem;
         GH.getTemplateDetails(FI.filePath);
     }
     catch (System.Exception ee)
     {
         GH.writeLog(ee.ToString());
     }
 }
Beispiel #19
0
 public void SetProgress(double val, double Max, string statusCount)
 {
     try
     {
         GH.writeLog("Progress: " + val + " | " + Max + " | " + statusCount);
         lbl_statusCount.Content = statusCount;
         proBar.Value            = ((val / Max) * 100);
     }
     catch (System.Exception ex)
     {
         GH.writeLog("SetProgress : " + ex.ToString());
     }
 }
Beispiel #20
0
 public void clearUIValues()
 {
     try
     {
         lbl_statusCount.Content       = "";
         cBox_objectType.ItemsSource   = null;
         lBox_CurrentNotes.ItemsSource = null;
     }
     catch (System.Exception ee)
     {
         GH.writeLog(ee.ToString());
     }
 }
Beispiel #21
0
 private void cBox_Mapper_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         C3D_2016_Anno.Global.fileItem FI = (C3D_2016_Anno.Global.fileItem)cBox_Mapper.SelectedItem;
         GH.qprint("Selected Mapper File: " + FI.filePath);
         GH.getMapper(FI.filePath);
         updateUIdata();
     }
     catch (System.Exception ee)
     {
         GH.writeLog(ee.ToString());
     }
 }
Beispiel #22
0
 private void btn_fetchtamplateFile_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int index = cBox_template.SelectedIndex;
         GH.getFiles("template");
         cBox_template.SelectedIndex = index;
         UIH.toastIT("Defnition files read sucessfully!", "File Read", NotificationType.Information);
     }
     catch (System.Exception ee)
     {
         GH.writeLog(ee.ToString());
     }
 }
Beispiel #23
0
 private void btn_saveAS_styleStructureFile_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         SaveFileDialog saveFileDialog = new SaveFileDialog();
         saveFileDialog.Filter = "Style Structure File (*.sst)|*.sst";
         if (saveFileDialog.ShowDialog() == true)
         {
             tBox_stylemapperFile.Text = saveFileDialog.FileName;
             writetoFile();
         }
     }
     catch (System.Exception ex)
     { GH.writeLog(ex.ToString()); }
 }
Beispiel #24
0
        public void UpdateProgressBar(double val, double Max, string statusCount)
        {
            try
            {
                // Action is delegate (means a function pointer) which is Pointing towards "SetProgress" method
                Action action = () => { SetProgress(val, Max, statusCount); };

                //proBar.Dispatcher.BeginInvoke(action);
                proBar.Dispatcher.BeginInvoke(action);
                //proBar.Dispatcher.Invoke(() => action, DispatcherPriority.Background);
                //listBox_status.Dispatcher.BeginInvoke(action);
            }
            catch (System.Exception ex)
            {
                GH.writeLog("SetProgress : " + ex.ToString());
            }
        }
Beispiel #25
0
 public void bw_UpdateProgressBar(object sender, DoWorkEventArgs e)
 {
     try
     {
         BackgroundWorker worker = sender as BackgroundWorker;
         UpdateProgressBar(GV.pBarCurrentVal, GV.pBarMaxVal, GV.pBarStatus);
         //lbl_statusCount.Content = GV.pBarStatus;
         //proBar.Value = ((GV.pBarCurrentVal / GV.pBarMaxVal) * 100);
     }
     catch (Autodesk.AutoCAD.Runtime.Exception ex)
     {
         GH.writeLog(ex.ToString());
     }
     catch (System.Exception ex)
     {
         GH.writeLog(ex.ToString());
     }
 }
Beispiel #26
0
 private void btn_nextLabel_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         loadStyleItem(1);
     }
     catch (Autodesk.Civil.CivilException ex)
     {
         GH.errorBox(ex.ToString());
     }
     catch (Autodesk.AutoCAD.Runtime.Exception ex)
     {
         GH.errorBox(ex.ToString());
     }
     catch (System.Exception ee)
     {
         GH.errorBox(ee.ToString());
     }
 }
Beispiel #27
0
        private void btn_browse_styleStructureFile_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Filter = "Style Structure Files (*.sst; *.sst)|*.sst;";
                if (openFileDialog.ShowDialog() == true)
                {
                    tBox_stylemapperFile.Text = openFileDialog.FileName;

                    //load data on the file ot the listview.
                    GH.getStyleStructureFileDetails(tBox_stylemapperFile.Text);
                }


            }
            catch (System.Exception ex)
            { }
        }
Beispiel #28
0
 private void NoteType_styleAssingmentHeader_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         UIH.sortColumn(sender, listView_styleComponentMapper);
     }
     catch (Autodesk.Civil.CivilException ex)
     {
         GH.errorBox(ex.ToString());
     }
     catch (Autodesk.AutoCAD.Runtime.Exception ex)
     {
         GH.errorBox(ex.ToString());
     }
     catch (System.Exception ee)
     {
         GH.errorBox(ee.ToString());
     }
 }
Beispiel #29
0
        public void fetchDATA()
        {
            try
            {
                cBox_template.ItemsSource   = GV.templateFiles;
                cBox_template.SelectedIndex = 0;
                cBox_Mapper.ItemsSource     = GV.mapperFiles;
                cBox_Mapper.SelectedIndex   = 0;

                cBox_objectType.ItemsSource = GV.ObtTypes;
                //cBox_objectType.SelectedIndex = 0;

                //set window title
            }
            catch (System.Exception ee)
            {
                GH.writeLog(ee.ToString());
            }
        }
Beispiel #30
0
 public static void getNotItem()
 {
     try
     {
         sPanelitem_Note = new StackPanel();
         sPanelitem_Note.Children.Clear();
         sPanelitem_Note.Orientation = Orientation.Vertical;
     }
     catch (Autodesk.Civil.CivilException ex)
     {
         GH.errorBox(ex.ToString());
     }
     catch (Autodesk.AutoCAD.Runtime.Exception ex)
     {
         GH.errorBox(ex.ToString());
     }
     catch (System.Exception ee)
     {
         GH.errorBox(ee.ToString());
     }
 }