Пример #1
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());
            }
        }
Пример #2
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());
            }
        }
Пример #3
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());
     }
 }
Пример #4
0
        private void btn_selectLabel_SST_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                LCH.getCurrentDwgVars();
                //rest progressbar
                proBar.Value = 0;
                GV.all_label_coll.Clear();
                clearUIValues();
                GV.clearSelection();
                tBox_Heading.Text = "";

                //read the label get the label name and KN values based on the KN location from SST file
                using (GV.Doc.LockDocument())
                {
                    GH.writeLog("\n Running command : btn_selectLabels_Click");

                    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();
                        GH.qprint("Number of objects selected: " + psRes.Value.Count);
                        GH.writeLog("\nNumber of objects selected: " + psRes.Value.Count);
                    }

                    bw.WorkerSupportsCancellation = true;
                    bw.WorkerReportsProgress      = true;
                    //bw.ProgressChanged += bw_ProgressChanged;
                    bw.DoWork += new DoWorkEventHandler(bw_UpdateProgressBar);
                    //start work
                    if (bw.IsBusy != true)
                    {
                        bw.RunWorkerAsync();
                    }
                    //check the label name against the SST file and type of label
                    int index = 1;

                    int objCount = GV.selObjects_forProcessing.Count();
                    GV.pBarMaxVal = objCount;

                    //GV.pmeter.Start("Processing Labels");
                    //GV.pmeter.SetLimit(objCount);


                    foreach (ObjectId objID in GV.selObjects_forProcessing)
                    {
                        LCH.getlabelvalueSpecific(objID);
                        //go to note list and get the note for the respective KN number that
                    }
                }
            }
            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());
            }
        }
Пример #5
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;
                    GV.all_label_coll.Clear();
                    clearUIValues();
                    GV.clearSelection();
                    tBox_Heading.Text = "";

                    LCH.getCurrentDwgVars();
                    using (GV.Doc.LockDocument())
                    {
                        GH.writeLog("\n Running command : btn_selectLabels_Click");

                        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();
                            GH.qprint("Number of objects selected: " + psRes.Value.Count);
                            GH.writeLog("\nNumber of objects selected: " + psRes.Value.Count);

                            //get key notes based on the selection
                            #region process labels Styles
                            bw.WorkerSupportsCancellation = true;
                            bw.WorkerReportsProgress      = true;
                            //bw.ProgressChanged += bw_ProgressChanged;
                            bw.DoWork += new DoWorkEventHandler(bw_UpdateProgressBar);
                            //start work
                            if (bw.IsBusy != true)
                            {
                                bw.RunWorkerAsync();
                            }


                            int index = 1;

                            int objCount = GV.selObjects_forProcessing.Count();
                            GV.pBarMaxVal = objCount;

                            //GV.pmeter.Start("Processing Labels");
                            //GV.pmeter.SetLimit(objCount);


                            foreach (ObjectId objID in GV.selObjects_forProcessing)
                            {
                                LCH.getlabelvalueSpecific(objID);

                                #region ProgressBAR

                                GH.printDebug("", "", false, true);
                                GV.pBarStatus = "Labels Processed: " + index + @"/" + objCount;
                                UpdateProgressBar(index, objCount, GV.pBarStatus);
                                //GV.pmeter.MeterProgress();
                                Helper.UIHelper.DoEvents();

                                GV.pBarCurrentVal = index;

                                //assign it work
                                //bw.ReportProgress(index);
                                index++;
                                #endregion
                            }
                            //GV.pmeter.Stop();
                            //LCH.getlabelvalues();
                            //LCH.getlabelvalues(acSSet.GetObjectIds(), trans);
                            updateUIdata();

                            UIH.toastIT("All selected labels processed successfully!", "Status", NotificationType.Success);
                            #endregion
                        }
                    }
                }
                else
                {
                    UIH.toastIT("Check if defintion and note files are selected!", "Missing defintion/note file", NotificationType.Error);
                }
            }
            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());
            }
        }
Пример #6
0
        public void updateUIdata()
        {
            try
            {
                GH.qprint("GV.ObtTypes.Count() ==> 2>  " + GV.ObtTypes.Count());
                foreach (var item in GV.noteTypesCurrent)
                {
                    GH.qprint("GV.noteTypesCurrent > >  " + item.Key + " | " + item.Value);
                }
                GV.noteTypesCurrent.Clear();
                //update selection list
                GH.qprint("GV.Mapper.Count(): " + GV.Mapper.Count());
                GV.ObtTypes.Clear();
                GH.qprint("GV.ObtTypes.Count() ==> 2>  " + GV.ObtTypes.Count());
                foreach (var noteitem in GV.allnotes)
                {
                    //test

                    if (GV.Mapper.ContainsKey(noteitem.Key))
                    {
                        GH.qprint("noteitem.Key in Mapper > >  " + noteitem.Key);
                        if (!GV.noteTypesCurrent.ContainsKey(noteitem.Key))
                        {
                            GH.qprint("noteitem.Key adding to current > >  " + noteitem.Key);
                            GV.noteTypesCurrent.Add(noteitem.Key, noteitem.Value);
                        }
                        if (!GV.ObtTypes.Contains(GV.Mapper[noteitem.Key]))
                        {
                            string ObjTypeName = GV.Mapper[noteitem.Key];
                            if (GV.SelectedObjTypes.Contains(ObjTypeName))
                            {
                                GH.qprint("GV.ObtTypes > >  " + GV.Mapper[noteitem.Key]);
                                GV.ObtTypes.Add(ObjTypeName);
                            }
                        }
                    }
                    else
                    {
                        GH.qprint("noteitem.Key not in Mapper > >  " + noteitem.Key);
                        foreach (var item in GV.Mapper)
                        {
                            GH.qprint("GV.Mapper > >  " + item.Key + " | " + item.Key);
                        }
                    }
                }
                cBox_objectType.ItemsSource = GV.ObtTypes;
                //cBox_objectType.SelectedIndex = 0;
                GH.qprint("GV.ObtTypes.Count() ==> 3>  " + GV.ObtTypes.Count());

                lBox_CurrentNotes.ItemsSource = GV.noteTypesCurrent.Values;

                foreach (string ObtTypes in GV.ObtTypes)
                {
                    List <Global.labelItem> filteredLabels = GV.all_label_coll.Where(o => o.objType == ObtTypes).ToList <Global.labelItem>();
                    if (!GV.all_label_coll_Sorted.ContainsKey(ObtTypes))
                    {
                        GV.all_label_coll_Sorted.Add(ObtTypes, filteredLabels);
                    }
                    else
                    {
                        GV.all_label_coll_Sorted[ObtTypes] = filteredLabels;
                    }
                }

                //if more than one objectype present in the cbox then display that
                if (cBox_objectType.Items.Count > 0)
                {
                    cBox_objectType.SelectedIndex = 0;
                }
            }
            catch (System.Exception ee)
            {
                GH.writeLog(ee.ToString());
            }
        }