Esempio n. 1
0
        private void btnCreateDock_Click(object sender, EventArgs e)
        {
            Data.Vertex3D center = new Data.Vertex3D();
            if (vizcore3d.Model.IsOpen() == true)
            {
                Data.BoundBox3D boundbox = vizcore3d.Model.BoundBox;
                center = boundbox.GetCenter();
            }
            else
            {
                center.X = 87614.0f;
                center.Y = 478.0f;
                center.Z = 21646.0f;
            }

            center.Z = center.Z - (center.Z * 0.9f);

            vizcore3d.Primitive.OpenCustomShapeDock(
                "DOCK_MODEL"                                /* MODEL NAME */
                , 8                                         /* COLOR INDEX */
                , center                                    /* CENTER */
                , new Data.Vector3D(195000, 40000, 13000)   /* Axis Length */
                , 40000                                     /* Ground Length */
                , 1000                                      /* Thickness */
                );

            List <Data.Node> dock = vizcore3d.Object3D.Find.QuickSearch(new List <string>()
            {
                "DOCK", "GROUND"
            }, false, true, false, false, true, false);

            vizcore3d.Object3D.Color.SetTransparency(dock, 30);
        }
Esempio n. 2
0
        private void GetNearestObject(VIZCore3D.NET.Data.AxisDirection axis, VIZCore3D.NET.Data.Vertex3D pt, bool visibleOnly, bool opaqueOnly)
        {
            VIZCore3D.NET.Data.NearestObjectByAxisPoint sdpt = vizcore3d.GeometryUtility.GetNearestObject(
                axis
                , pt
                , visibleOnly
                , opaqueOnly
                );

            if (sdpt.Index == -1)
            {
                return;
            }

            List <VIZCore3D.NET.Data.Vertex3DItemCollection> vertex = new List <VIZCore3D.NET.Data.Vertex3DItemCollection>();

            VIZCore3D.NET.Data.Vertex3DItemCollection item = new VIZCore3D.NET.Data.Vertex3DItemCollection();
            item.Add(pt);
            item.Add(sdpt.CollisionPoint);
            vertex.Add(item);


            int lineId = vizcore3d.ShapeDrawing.AddLine(
                vertex
                , sdpt.Index
                , Color.Red
                , 5.0f
                , true
                );

            //int vertexId = vizcore3d.ShapeDrawing.AddVertex(
            //        new List<VIZCore3D.NET.Data.Vertex3D>() { pt, sdpt.CollisionPoint }
            //        , sdpt.Index
            //        , Color.Red
            //        , 5.0f
            //        , 7.0f
            //        , true
            //        );

            string noteText = string.Format(
                "[{0}]{1}\r\nDistance: {2}\r\nCollision: {3}"
                , sdpt.Index
                , vizcore3d.Object3D.FromIndex(sdpt.Index).NodeName
                , sdpt.Distance.ToString()
                , sdpt.CollisionPoint.ToString()
                );

            VIZCore3D.NET.Data.Vertex3D text = new Data.Vertex3D(
                sdpt.CollisionPoint.X
                , sdpt.CollisionPoint.Y
                , sdpt.CollisionPoint.Z + 500
                );
            int surfaceNoteId = vizcore3d.Review.Note.AddNoteSurface(
                noteText
                , text
                , sdpt.CollisionPoint
                );
        }
Esempio n. 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (vizcore3d.Model.IsOpen() == false)
            {
                return;
            }
            if (String.IsNullOrEmpty(txtName.Text) == true)
            {
                return;
            }
            if (String.IsNullOrEmpty(txtStart.Text) == true)
            {
                return;
            }
            if (String.IsNullOrEmpty(txtEnd.Text) == true)
            {
                return;
            }

            string groupName = "GROUP";

            VIZCore3D.NET.Data.Node groupNode;
            if (ExistGroupNode(groupName) == false)
            {
                groupNode = AddGroupNode(groupName);
            }
            else
            {
                groupNode = GetGroupNode(groupName);
            }

            string name      = txtName.Text;
            int    nodeCount = GetNodeCount(name);

            if (nodeCount > 0)
            {
                name = string.Format("{0}_{1}", name, nodeCount + 1);
            }

            int bodyIndex = CreateNode(name, groupNode.Index);

            VIZCore3D.NET.Data.Node     part  = vizcore3d.Object3D.FromIndex(vizcore3d.Object3D.FromIndex(bodyIndex).ParentIndex);
            VIZCore3D.NET.Data.Vertex3D start = new Data.Vertex3D(txtStart.Text, ",");
            VIZCore3D.NET.Data.Vertex3D end   = new Data.Vertex3D(txtEnd.Text, ",");

            CreateCylinder(bodyIndex, start, end);

            ListViewItem lvi = new ListViewItem(new string[] { name, part.Index.ToString(), part.ID.ToString() });

            lvItems.Items.Add(lvi);
        }
Esempio n. 4
0
        private VIZCore3D.NET.Data.Vertex3D GetVertex(TextBox input)
        {
            if (String.IsNullOrEmpty(input.Text) == true)
            {
                return(null);
            }
            string strVertex = input.Text;

            string[] vertex = strVertex.Split(new char[] { ',' });
            if (vertex.Length != 3)
            {
                return(null);
            }

            VIZCore3D.NET.Data.Vertex3D v = new Data.Vertex3D(vertex[0], vertex[1], vertex[2]);
            return(v);
        }
Esempio n. 5
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (vizcore3d.Model.IsOpen() == false)
            {
                return;
            }

            vizcore3d.SelectionBox.Clear();

            int xCount = Convert.ToInt32(txtCountX.Text);
            int yCount = Convert.ToInt32(txtCountY.Text);
            int zCount = Convert.ToInt32(txtCountZ.Text);

            VIZCore3D.NET.Data.BoundBox3D box = vizcore3d.Model.BoundBox;

            float xWidth = box.LengthX / xCount;
            float yWidth = box.LengthY / yCount;
            float zWidth = box.LengthZ / zCount;

            vizcore3d.BeginUpdate();

            for (int x = 0; x < xCount; x++)
            {
                for (int y = 0; y < yCount; y++)
                {
                    for (int z = 0; z < zCount; z++)
                    {
                        string title = string.Format("선택상자 - {0}/{1}/{2}", x + 1, y + 1, z + 1);
                        string label = string.Format("{0}/{1}/{2}", x + 1, y + 1, z + 1);

                        VIZCore3D.NET.Data.Vertex3D min = new Data.Vertex3D(
                            box.MinX + (xWidth * x)
                            , box.MinY + (yWidth * y)
                            , box.MinZ + (zWidth * z)
                            );

                        VIZCore3D.NET.Data.Vertex3D max = new Data.Vertex3D(
                            min.X + xWidth
                            , min.Y + yWidth
                            , min.Z + zWidth
                            );

                        VIZCore3D.NET.Data.BoundBox3D selectionbox = new Data.BoundBox3D(min, max);

                        int id = vizcore3d.SelectionBox.Add(
                            selectionbox
                            , GetTransparencyColor(Color.FromArgb(100, 255, 255, 255))
                            , GetTransparencyColor(Color.Black)
                            , title
                            );

                        vizcore3d.SelectionBox.SetLabel(id, label);
                    } // z
                }     // y
            }         // x


            vizcore3d.EndUpdate();

            vizcore3d.SelectionBox.MouseSelectionMode = true;
        }
Esempio n. 6
0
        private void Object3D_OnSelectedObject3D(object sender, VIZCore3D.NET.Event.EventManager.SelectedObject3DEventArgs e)
        {
            if (e.Node.Count == 0)
            {
                return;
            }
            if (ckEnable.Checked == false)
            {
                return;
            }

            Data.Node node = vizcore3d.Object3D.FromIndex(e.Node[0].Index, true);

            // 현재 노트 스타일 가져오기 및 수정
            Data.NoteStyle style = vizcore3d.Review.Note.GetStyle();
            {
                // 화살표 색상
                style.ArrowColor = Color.Black;
                // 화살표 두께
                style.ArrowWidth = 10;

                // 배경 투명하게 처리 여부
                style.BackgroudTransparent = ckTransparent.Checked;
                // 배경 색상 - 배경을 투명하게 처리할 경우, 적용되지 않음
                style.BackgroundColor = Color.White;

                // 노트 글자 색상
                style.FontColor = Color.Black;
                // 노트 글자 크기
                style.FontSize = Data.FontSizeKind.SIZE18;
                // 노트 글자 굵게 표시 여부
                style.FontBold = false;

                // 라인 색상
                style.LineColor = Color.Red;
                // 라인 두께
                style.LineWidth = 3;

                // 텍스트 상자 표시 여부
                style.UseTextBox = true;

                // 라인과 텍스트 박스의 연결 위치
                style.LinkArrowTailToText = Manager.NoteManager.LinkArrowTailToTextKind.OUTLINE;

                // 심볼 배경색
                style.SymbolBackgroundColor = Color.Yellow;
                // 심볼 글자 색상
                style.SymbolFontColor = Color.Black;
                // 심볼 글자 크기
                style.SymbolFontSize = Data.FontSizeKind.SIZE16;
                // 심볼 글자 굵게 표시 여부
                style.SymbolFontBold = true;
                // 심볼 위치
                style.SymbolPosition = Manager.NoteManager.SymbolPositionKind.ARROW;
                // 심볼 크기
                style.SymbolSize = 10;

                // 심볼 사용 유무
                style.UseSymbol = ckUseSymbol.Checked;
                // 심볼 텍스트
                style.SymbolText = Convert.ToString(vizcore3d.Review.Note.GetID().Count + 1);
            }

            // 색상 텍스트 생성
            VIZCore3D.NET.Data.MultiColorText text = new Data.MultiColorText();
            text.Add("MODEL : ", Color.Black);
            text.AddLine(string.Format("{0}", vizcore3d.Object3D.FromIndex(0).NodeName), Color.Red);
            text.Add("NAME : ", Color.Black);
            text.AddLine(node.NodeName, Color.Red);

            //{
            //    text.NewLine();

            //    // Geometry 속성 조회
            //    Data.Object3DProperty prop = vizcore3d.Object3D.GeometryProperty.FromIndex(e.Node[0].Index, false);

            //    text.Add("Center : ", Color.Black);
            //    text.AddLine(string.Format("{0}", prop.CenterPoint.ToString()), Color.Purple);

            //    text.Add("Min. : ", Color.Black);
            //    text.AddLine(string.Format("{0}", prop.MinPoint.ToString()), Color.Purple);

            //    text.Add("Max. : ", Color.Black);
            //    text.AddLine(string.Format("{0}", prop.MaxPoint.ToString()), Color.Purple);
            //}

            //{
            //    text.NewLine();

            //    // UDA(User Define Attribute) 조회
            //    Dictionary<string, string> uda = vizcore3d.Object3D.UDA.FromIndex(node.Index);

            //    foreach (KeyValuePair<string, string> item in uda)
            //    {
            //        text.Add(string.Format("{0} : ", item.Key), Color.Red);
            //        text.AddLine(string.Format("{0}", item.Value), Color.DarkGray);
            //    }
            //}

            // 부재의 표면점 조회
            Data.Vertex3D surfacePt = vizcore3d.Object3D.GetSurfaceVertexClosestToModelCenter(new List <int>()
            {
                node.Index
            });

            // 화면 갱신 차단
            vizcore3d.BeginUpdate();

            // 노트 생성
            vizcore3d.Review.Note.AddNoteSurface(text
                                                 , new Data.Vertex3D(surfacePt.X + 2000.0f, surfacePt.Y, surfacePt.Z + 2000.0f)
                                                 , surfacePt
                                                 , style
                                                 );

            // 화면 갱신 차단 해제
            vizcore3d.EndUpdate();
        }
Esempio n. 7
0
        private void btnGenerateAnimation_Click(object sender, EventArgs e)
        {
            if (vizcore3d.Model.IsOpen() == false)
            {
                return;
            }

            // 모델 데이터 맵핑
            GetNodes();
            ObjectProperty = new Dictionary <int, VIZCore3D.NET.Data.Object3DProperty>();
            Transform      = new Dictionary <int, Data.Vertex3D>();

            vizcore3d.View.EnableAutoFit = false;                                       /* 자동 화면맞춤 비활성 */
            //vizcore3d.View.Projection = VIZCore3D.NET.Data.Projections.Perspective;   /* 원근 뷰 설정 */
            vizcore3d.Animation.UseEffect = false;                                      /* 기본 효과 사용안함 설정 */

            vizcore3d.Animation.Clear();
            vizcore3d.Animation.Add("Animation");

            //vizcore3d.ShowWaitForm();

            vizcore3d.Object3D.Select(Data.Object3dSelectionModes.DESELECT_ALL);
            VIZCore3D.NET.Data.Vertex3D bay = new Data.Vertex3D(83772, -41271, 8664);

            vizcore3d.BeginUpdate();

            foreach (KeyValuePair <int, List <VIZCore3D.NET.Data.Node> > item in Nodes)
            {
                if (item.Key <= 0)
                {
                    continue;
                }

                VIZCore3D.NET.Data.Object3DProperty prop = vizcore3d.Object3D.GeometryProperty.FromNode(Nodes[item.Key], false);

                if (ObjectProperty.ContainsKey(item.Key) == false)
                {
                    ObjectProperty.Add(item.Key, prop);
                }

                VIZCore3D.NET.Data.Vertex3D vec = new Data.Vertex3D(bay.X - prop.CenterPoint.X, bay.Y - prop.CenterPoint.Y, bay.Z - prop.MinPoint.Z);

                vizcore3d.Object3D.Transform.Move(
                    Nodes[item.Key]
                    , bay.X - prop.CenterPoint.X
                    , bay.Y - prop.CenterPoint.Y
                    , bay.Z - prop.MinPoint.Z
                    , false
                    );
                Transform.Add(item.Key, vec);
            }

            foreach (KeyValuePair <int, List <VIZCore3D.NET.Data.Node> > item in Nodes)
            {
                if (item.Key <= 0)
                {
                    continue;
                }

                vizcore3d.Object3D.Show(item.Value, false);
            }

            // 애니메이션 키 추가
            AddKey(true, false, TimeInterval);

            Data.Object3DProperty propCrane = vizcore3d.Object3D.GeometryProperty.FromNode(Nodes[-7]);

            //for (int i = 1; i < 13; i++)
            foreach (KeyValuePair <int, List <VIZCore3D.NET.Data.Node> > item in Nodes)
            {
                if (item.Key <= 0)
                {
                    continue;
                }

                int           i        = item.Key;
                Data.Vertex3D vecTrans = Transform[i];

                // 블록 조회
                vizcore3d.Object3D.Show(Nodes[i], true);

                // 애니메이션 키 추가
                AddKey(true, false, TimeInterval);

                // 크레인 이동 (BAY) : 블록 위치로...
                MoveCrane(true, bay.X, 0.0f, 0.0f);

                // 크레인 호이스트 이동 : 블록 위치로...
                MoveCrane(false, bay.X, bay.Y, 0.0f);

                Data.Object3DProperty propModel = vizcore3d.Object3D.GeometryProperty.FromNode(Nodes[i]);
                float fOffset = propCrane.MinPoint.Z - propModel.MaxPoint.Z - 5000f;
                // 크레인 호이스트 : Bring To Bottom
                DownCrane(false, Nodes[i], fOffset);

                // 블록 : Bring To Top
                UpCrane(true, Nodes[i], fOffset);

                // 블록 : Bring To Center(Y)
                VIZCore3D.NET.Data.Vector3D tran3 = new VIZCore3D.NET.Data.Vector3D(0, -vecTrans.Y, 0);
                vizcore3d.Object3D.Transform.Move(Nodes[i], tran3, false);

                // 크레인 호이스트 이동
                MoveCrane(false, bay.X, ObjectProperty[i].CenterPoint.Y, 0.0f);

                VIZCore3D.NET.Data.Vector3D tran4 = new VIZCore3D.NET.Data.Vector3D(-vecTrans.X, 0, 0);
                vizcore3d.Object3D.Transform.Move(Nodes[i], tran4, false);

                // 크레인 이동 (BAY)
                // 크레인 호이스트 이동
                MoveCrane(true, ObjectProperty[i].CenterPoint.X, 0.0f, 0.0f);

                Data.Object3DProperty propModelO = ObjectProperty[i];
                Data.Object3DProperty propModelC = vizcore3d.Object3D.GeometryProperty.FromNode(Nodes[i]);
                fOffset = propCrane.MinPoint.Z - propModelO.MaxPoint.Z - 5000f;

                // 크레인 호이스트 : Bring To Bottom
                DownCrane(true, Nodes[i], fOffset);

                // 블록 : Bring To Top
                UpCrane(false, null, fOffset);
            }

            AddKey(true, false, TimeInterval);

            vizcore3d.EndUpdate();

            //vizcore3d.CloseWaitForm();

            MessageBox.Show("Animation Created.", "VIZCore3D.NET", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Esempio n. 8
0
        private void Object3D_OnObject3DSelected(object sender, Event.EventManager.Object3DSelectedEventArgs e)
        {
            if (e.Node.Count == 0)
            {
                txtNodeIndex.Text      = String.Empty;
                btnNodeColor.BackColor = Color.FromKnownColor(KnownColor.Control);

                txtBodyIndex.Text      = String.Empty;
                btnBodyColor.BackColor = Color.FromKnownColor(KnownColor.Control);

                txtLengthXCube.Text = String.Empty;
                txtLengthYCube.Text = String.Empty;
                txtLengthZCube.Text = String.Empty;

                txtMatrix11.Text = "1";
                txtMatrix12.Text = "0";
                txtMatrix13.Text = "0";
                txtMatrix41.Text = "0";

                txtMatrix21.Text = "0";
                txtMatrix22.Text = "1";
                txtMatrix23.Text = "0";
                txtMatrix42.Text = "0";

                txtMatrix31.Text = "0";
                txtMatrix32.Text = "0";
                txtMatrix33.Text = "1";
                txtMatrix43.Text = "0";
            }
            else
            {
                txtNodeIndex.Text      = e.Node[0].Index.ToString();
                btnNodeColor.BackColor = vizcore3d.Object3D.Color.GetColor(e.Node[0].Index);

                txtBodyIndex.Text      = Convert.ToString(e.Node[0].Index + 1);
                btnBodyColor.BackColor = vizcore3d.Object3D.Color.GetColor(e.Node[0].Index);

                VIZCore3D.NET.Data.BoundBox3D boundBox = e.Node[0].GetGeometryProperty().GetBoundBox();

                txtLengthXCube.Text = boundBox.LengthX.ToString();
                txtLengthYCube.Text = boundBox.LengthY.ToString();
                txtLengthZCube.Text = boundBox.LengthZ.ToString();

                if (rbCylinderXAxis.Checked == true)
                {
                    txtCylinderRadius.Text = Convert.ToString(boundBox.LengthZ * 0.5f);
                }
                else if (rbCylinderYAxis.Checked == true)
                {
                    txtCylinderRadius.Text = Convert.ToString(boundBox.LengthX * 0.5f);
                }
                else if (rbCylinderZAxis.Checked == true)
                {
                    txtCylinderRadius.Text = Convert.ToString(boundBox.LengthY * 0.5f);
                }

                if (tabPrimitive.SelectedIndex == 0)
                {
                    txtMatrix11.Text = "1";
                    txtMatrix12.Text = "0";
                    txtMatrix13.Text = "0";

                    txtMatrix21.Text = "0";
                    txtMatrix22.Text = "1";
                    txtMatrix23.Text = "0";

                    txtMatrix31.Text = "0";
                    txtMatrix32.Text = "0";
                    txtMatrix33.Text = "1";

                    txtMatrix41.Text = boundBox.CenterX.ToString();
                    txtMatrix42.Text = boundBox.CenterY.ToString();
                    txtMatrix43.Text = boundBox.CenterZ.ToString();
                }
                else if (tabPrimitive.SelectedIndex == 1)
                {
                    VIZCore3D.NET.Data.Vertex3D cyliCenter =
                        new Data.Vertex3D(
                            boundBox.CenterX
                            , boundBox.CenterY
                            , boundBox.CenterZ
                            );

                    VIZCore3D.NET.Data.Vertex3D min = cyliCenter.Clone();
                    VIZCore3D.NET.Data.Vertex3D max = cyliCenter.Clone();

                    if (rbCylinderXAxis.Checked == true)
                    {
                        min.X = boundBox.MinX;
                        max.X = boundBox.MaxX;

                        txtCylinderHeight.Text = boundBox.LengthX.ToString();
                    }
                    else if (rbCylinderYAxis.Checked == true)
                    {
                        min.Y = boundBox.MinY;
                        max.Y = boundBox.MaxY;

                        txtCylinderHeight.Text = boundBox.LengthY.ToString();
                    }
                    else if (rbCylinderZAxis.Checked == true)
                    {
                        min.Z = boundBox.MinZ;
                        max.Z = boundBox.MaxZ;

                        txtCylinderHeight.Text = boundBox.LengthZ.ToString();
                    }

                    VIZCore3D.NET.Manager.PrimitiveCylinder cyli = new Manager.PrimitiveCylinder();
                    cyli.Set2Point(min, max, Convert.ToSingle(txtCylinderRadius.Text));

                    txtMatrix11.Text = cyli.Matrix[0].ToString();
                    txtMatrix12.Text = cyli.Matrix[1].ToString();
                    txtMatrix13.Text = cyli.Matrix[2].ToString();

                    txtMatrix21.Text = cyli.Matrix[4].ToString();
                    txtMatrix22.Text = cyli.Matrix[5].ToString();
                    txtMatrix23.Text = cyli.Matrix[6].ToString();

                    txtMatrix31.Text = cyli.Matrix[8].ToString();
                    txtMatrix32.Text = cyli.Matrix[9].ToString();
                    txtMatrix33.Text = cyli.Matrix[10].ToString();

                    txtMatrix41.Text = cyli.Matrix[3].ToString();
                    txtMatrix42.Text = cyli.Matrix[7].ToString();
                    txtMatrix43.Text = cyli.Matrix[11].ToString();
                }
            }
        }
Esempio n. 9
0
        // ================================================
        // Bounding Box
        // ================================================
        private void btnBoxAdd_Click(object sender, EventArgs e)
        {
            if (vizcore3dMain.Model.IsOpen() == false)
            {
                return;
            }

            vizcore3dMain.SelectionBox.Clear();
            BoxKey = new Dictionary <int, string>();

            int xCount = Convert.ToInt32(txtBoxX.Text);
            int yCount = Convert.ToInt32(txtBoxY.Text);
            int zCount = Convert.ToInt32(txtBoxZ.Text);

            VIZCore3D.NET.Data.BoundBox3D box = vizcore3dMain.Model.BoundBox;

            float xWidth = box.LengthX / xCount;
            float yWidth = box.LengthY / yCount;
            float zWidth = box.LengthZ / zCount;

            vizcore3dMain.BeginUpdate();

            for (int x = 0; x < xCount; x++)
            {
                for (int y = 0; y < yCount; y++)
                {
                    for (int z = 0; z < zCount; z++)
                    {
                        string title = string.Format("선택상자 - {0}/{1}/{2}", x + 1, y + 1, z + 1);
                        string label = string.Format("{0}/{1}/{2}", x + 1, y + 1, z + 1);

                        VIZCore3D.NET.Data.Vertex3D min = new Data.Vertex3D(
                            box.MinX + (xWidth * x)
                            , box.MinY + (yWidth * y)
                            , box.MinZ + (zWidth * z)
                            );

                        VIZCore3D.NET.Data.Vertex3D max = new Data.Vertex3D(
                            min.X + xWidth
                            , min.Y + yWidth
                            , min.Z + zWidth
                            );

                        VIZCore3D.NET.Data.BoundBox3D selectionbox = new Data.BoundBox3D(min, max);

                        int id = vizcore3dMain.SelectionBox.Add(
                            selectionbox
                            , Color.FromArgb(10, Color.White)
                            , Color.Black
                            , title
                            );

                        //vizcore3dMain.SelectionBox.SetLabel(id, label);

                        BoxKey.Add(id, string.Format("{0}-{1}-{2}", x + 1, y + 1, z + 1));
                    } // z
                }     // y
            }         // x


            vizcore3dMain.EndUpdate();

            CreateGridView();
        }