Esempio n. 1
0
        private void wdlTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node == null)
            {
                return;
            }
            if (e.Node.Tag == null)
            {
                return;
            }

            VIZCore3D.NET.Importer.ShxWdlTreeData tree = (VIZCore3D.NET.Importer.ShxWdlTreeData)e.Node.Tag;

            VIZCore3D.NET.Importer.ShxWdlMatchingTree parts = wdl.GetParts(tree);
            if (parts == null)
            {
                return;
            }

            List <string> filter   = new List <string>();
            List <string> filterEx = new List <string>();

            lvParts.BeginUpdate();
            lvParts.Items.Clear();

            // 중복 제거 및 Count
            Dictionary <string, int> Count = new Dictionary <string, int>();

            foreach (KeyValuePair <string, string> item in parts.Parts)
            {
                if (Count.ContainsKey(item.Key) == false)
                {
                    Count.Add(item.Key, 1);
                }
                else
                {
                    Count[item.Key] = Count[item.Key] + 1;
                }
            }

            foreach (KeyValuePair <string, int> item in Count)
            {
                VIZCore3D.NET.Importer.ShxWdlJLData jlData = wdl.GetJLData(item.Key);

                if (jlData == null)
                {
                    continue;
                }

                ListViewItem lvi = new ListViewItem(
                    new string[]
                {
                    jlData.Part                                                              /* 소유 부재 */
                    , jlData.ContactPart                                                     /* 접촉 부재 */
                    , Convert.ToInt32(Convert.ToSingle(jlData.ContactPartWeight)).ToString() /* 각장/두께 */
                    , item.Value.ToString()                                                  /* 수량 - 계산 */
                    , jlData.Sign                                                            /* 개선 */
                    , jlData.Code                                                            /* LEVEL CODE */
                    , jlData.Stage                                                           /* STAGE */
                    , jlData.PR                                                              /* PR */
                    , jlData.Direction                                                       /* 방향 */
                    , jlData.WeldingPosture.ToString()                                       /* 용접자세 */
                    , Convert.ToInt32(jlData.WeldLineLength).ToString()                      /* 길이(mm) */
                    , jlData.ActCode                                                         /* ACT */
                    , jlData.WeldingTypeDetail                                               /* 비고 */
                }
                    );

                lvi.Tag = jlData;

                lvParts.Items.Add(lvi);

                filter.Add(jlData.Part);
                filterEx.Add(jlData.Part);
                filterEx.Add(jlData.ContactPart);
            }

            lvParts.EndUpdate();

            if (filter.Count == 0)
            {
                return;
            }
            if (ckXray.Checked == false)
            {
                return;
            }

            List <VIZCore3D.NET.Data.Node> find = vizcore3d.Object3D.Find.QuickSearch(
                filter
                , false
                , ckUnit.Checked == true ? false : true
                , false
                , false
                , true
                , true
                );

            List <VIZCore3D.NET.Data.Node> result = new List <Data.Node>();

            foreach (VIZCore3D.NET.Data.Node item in find)
            {
                if (item.NodePath.Contains("WELD") == false)
                {
                    continue;
                }
                result.Add(item);
            }

            if (result.Count == 0)
            {
                return;
            }

            vizcore3d.View.XRay.Clear();
            vizcore3d.View.XRay.Select(result, true, true);
            vizcore3d.View.FlyToObject3d(result, 1.0f);

            //if (ckHighlightPart.Checked == false)
            //{
            //    List<VIZCore3D.NET.Data.Node> find = vizcore3d.Object3D.Find.QuickSearch(
            //        filter
            //        , false
            //        , ckUnit.Checked == true ? false : true
            //        , false
            //        , false
            //        , true
            //        , true
            //        );

            //    List<VIZCore3D.NET.Data.Node> result = new List<Data.Node>();
            //    foreach (VIZCore3D.NET.Data.Node item in find)
            //    {
            //        if (item.NodePath.Contains("WELD") == false) continue;
            //        result.Add(item);
            //    }

            //    if (result.Count == 0) return;

            //    vizcore3d.View.XRay.Clear();
            //    vizcore3d.View.XRay.Select(result, true, true);
            //    vizcore3d.View.FlyToObject3d(result, 1.0f);
            //}
            //else if(ckHighlightPart.Checked == true)
            //{
            //    Dictionary<string, string> filterPart = new Dictionary<string, string>();
            //    foreach (string item in filterEx)
            //    {
            //        string[] filterArray = item.Split(new char[] { '-' });
            //        string name = string.Format("{0}-{1}", filterArray[0], filterArray[1]);

            //        if (filterPart.ContainsKey(name) == false)
            //            filterPart.Add(name, name);
            //    }

            //    List<VIZCore3D.NET.Data.Node> find = vizcore3d.Object3D.Find.QuickSearch(
            //        filterPart.Keys.ToList()      /* Keyword */
            //        , false     /* Join Condition : True - And, False - Or */
            //        , true      /* Assembly Only : True - Assembly Only, False - All */
            //        , false     /* Visible Only : True - Visible Only, False - All */
            //        , false     /* Selected Only : True - Selected Only, False - All */
            //        , true      /* Full Match : True - Full Match, False - Contains */
            //        , true      /* Include Node Path : True - Include, False - Exclude */
            //        );

            //    List<VIZCore3D.NET.Data.Node> result = new List<Data.Node>();
            //    foreach (VIZCore3D.NET.Data.Node item in find)
            //    {
            //        if (item.NodePath.Contains("WELD") == true) continue;
            //        result.Add(item);
            //    }

            //    //vizcore3d.View.XRay.Clear();

            //    if (result.Count != 0)
            //    {
            //        vizcore3d.View.XRay.Select(result, true, true);
            //        vizcore3d.View.FlyToObject3d(result, 1.0f);
            //    }
            //}
        }
Esempio n. 2
0
        private void wdlTree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node == null)
            {
                return;
            }
            if (e.Node.Tag == null)
            {
                return;
            }

            VIZCore3D.NET.Importer.ShxWdlTreeData tree = (VIZCore3D.NET.Importer.ShxWdlTreeData)e.Node.Tag;

            VIZCore3D.NET.Importer.ShxWdlMatchingTree parts = wdl.GetParts(tree);
            if (parts == null)
            {
                return;
            }

            List <string> filter = new List <string>();

            lvParts.BeginUpdate();
            lvParts.Items.Clear();

            Dictionary <string, int> Count = new Dictionary <string, int>();

            foreach (KeyValuePair <string, string> item in parts.Parts)
            {
                if (Count.ContainsKey(item.Key) == false)
                {
                    Count.Add(item.Key, 1);
                }
                else
                {
                    Count[item.Key] = Count[item.Key] + 1;
                }
            }

            foreach (KeyValuePair <string, int> item in Count)
            {
                VIZCore3D.NET.Importer.ShxWdlJLData jlData = wdl.GetJLData(item.Key);

                if (jlData == null)
                {
                    continue;
                }

                ListViewItem lvi = new ListViewItem(
                    new string[]
                {
                    jlData.Part                                                              /* 소유 부재 */
                    , jlData.ContactPart                                                     /* 접촉 부재 */
                    , Convert.ToInt32(Convert.ToSingle(jlData.ContactPartWeight)).ToString() /* 각장/두께 */
                    , item.Value.ToString()                                                  /* 수량 - 계산 */
                    , jlData.Sign                                                            /* 개선 */
                    , jlData.Code                                                            /* LEVEL CODE */
                    , jlData.Stage                                                           /* STAGE */
                    , jlData.PR                                                              /* PR */
                    , jlData.Direction                                                       /* 방향 */
                    , jlData.WeldingPosture.ToString()                                       /* 용접자세 */
                    , Convert.ToInt32(jlData.WeldLineLength).ToString()                      /* 길이(mm) */
                    , jlData.ActCode                                                         /* ACT */
                    , jlData.WeldingTypeDetail                                               /* 비고 */
                }
                    );

                lvi.Tag = jlData;

                lvParts.Items.Add(lvi);

                filter.Add(jlData.Part);
            }

            lvParts.EndUpdate();

            if (ckXray.Checked == true && filter.Count != 0)
            {
                List <VIZCore3D.NET.Data.Node> find = vizcore3d.Object3D.Find.QuickSearch(
                    filter
                    , false
                    , ckUnit.Checked == true ? false : true
                    , false
                    , false
                    , true
                    , true
                    );

                List <VIZCore3D.NET.Data.Node> result = new List <Data.Node>();
                foreach (VIZCore3D.NET.Data.Node item in find)
                {
                    if (item.NodePath.Contains("WELD") == false)
                    {
                        continue;
                    }
                    result.Add(item);
                }

                if (result.Count == 0)
                {
                    return;
                }

                vizcore3d.View.XRay.Clear();
                vizcore3d.View.XRay.Select(result, true, true);
                vizcore3d.View.FlyToObject3d(result, 1.0f);
            }
        }