Exemplo n.º 1
0
        private void lvParts_DoubleClick(object sender, EventArgs e)
        {
            if (lvParts.SelectedItems.Count == 0)
            {
                return;
            }
            ListViewItem lvi = lvParts.SelectedItems[0];

            if (lvi == null)
            {
                return;
            }
            if (lvi.Tag == null)
            {
                return;
            }

            VIZCore3D.NET.Importer.ShxWdlJLData jl = (VIZCore3D.NET.Importer.ShxWdlJLData)lvi.Tag;
            string name = jl.Part;

            List <VIZCore3D.NET.Data.Node> items = vizcore3d.Object3D.Find.QuickSearch(
                new List <string>()
            {
                name
            }
                , false
                , false
                , false
                , false
                , true
                , false
                );

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

            vizcore3d.Object3D.Select(VIZCore3D.NET.Data.Object3dSelectionModes.DESELECT_ALL);
            vizcore3d.Object3D.Select(items, true, true);

            vizcore3d.View.FlyToObject3d(1.0f);
        }
Exemplo n.º 2
0
        private void MakeChildStageNode(VIZCore3D.NET.Importer.ShxWdlTreeData treeData)
        {
            foreach (VIZCore3D.NET.Importer.ShxWdlTreeData item in treeData.Child)
            {
                if (item.Child.Count == 0)
                {
                    Dictionary <string, string> partCache = new Dictionary <string, string>();

                    VIZCore3D.NET.Importer.ShxWdlMatchingTree part = wdl.GetParts(item);

                    foreach (KeyValuePair <string, string> partItem in part.Parts)
                    {
                        if (partCache.ContainsKey(partItem.Key) == false)
                        {
                            partCache.Add(partItem.Key, partItem.Key);
                        }
                    }

                    List <string> partList1 = new List <string>();
                    List <string> partList2 = new List <string>();

                    foreach (KeyValuePair <string, string> partName in partCache)
                    {
                        VIZCore3D.NET.Importer.ShxWdlJLData jlData = wdl.GetJLData(partName.Key);
                        if (jlData == null)
                        {
                            continue;
                        }

                        partList1.Add(jlData.Part);
                        partList2.Add(jlData.ContactPart);
                    }

                    Dictionary <string, string> filterPart1 = new Dictionary <string, string>();
                    Dictionary <string, string> filterPart2 = new Dictionary <string, string>();
                    foreach (string filter in partList1)
                    {
                        string[] filterArray = filter.Split(new char[] { '-' });
                        string   name        = string.Format("{0}-{1}", filterArray[0], filterArray[1]);

                        if (filterPart1.ContainsKey(name) == false)
                        {
                            filterPart1.Add(name, name);
                        }
                    }

                    foreach (string filter in partList2)
                    {
                        string[] filterArray = filter.Split(new char[] { '-' });
                        string   name        = string.Format("{0}-{1}", filterArray[0], filterArray[1]);

                        if (filterPart2.ContainsKey(name) == false)
                        {
                            filterPart2.Add(name, name);
                        }
                    }

                    List <VIZCore3D.NET.Data.Node> find1 = vizcore3d.Object3D.Find.QuickSearch(
                        filterPart1.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> find2 = vizcore3d.Object3D.Find.QuickSearch(
                        filterPart2.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 */
                        );

                    STAGE1.Add(find1);
                    STAGE2.Add(find2);
                }
                else
                {
                    MakeChildStageNode(item);
                }
            }
        }
Exemplo n.º 3
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);
            //    }
            //}
        }
Exemplo n.º 4
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);
            }
        }