Exemplo n.º 1
0
        private void CustomMoveVertex()
        {
            if (String.IsNullOrEmpty(txtBodyIndex1.Text) == true)
            {
                return;
            }

            int bodyIndex1 = Convert.ToInt32(txtBodyIndex1.Text);

            if (vizcore3d.Object3D.GetNodeKind(bodyIndex1) != Data.NodeKind.BODY)
            {
                return;
            }

            VIZCore3D.NET.Data.Vertex3D v1 = GetVertex(txtVertex1);
            VIZCore3D.NET.Data.Vertex3D v2 = GetVertex(txtVertex2);

            if (v1 == null)
            {
                return;
            }
            if (v2 == null)
            {
                return;
            }

            vizcore3d.MeshEdit.MoveVertex(bodyIndex1, v1, v2);
        }
Exemplo n.º 2
0
        private void CalcBoundBox()
        {
            lbCount.Text = string.Format("Count : {0} EA", vizcore3d.Model.SpaceSearch.ModelCount);

            VIZCore3D.NET.Data.BoundBox3D ModelBoundBox = vizcore3d.Model.SpaceSearch.GetModelBoundBox();

            lbMinX.Text = Convert.ToInt64(ModelBoundBox.MinX).ToString("n0");
            lbMinY.Text = Convert.ToInt64(ModelBoundBox.MinY).ToString("n0");
            lbMinZ.Text = Convert.ToInt64(ModelBoundBox.MinZ).ToString("n0");

            lbMaxX.Text = Convert.ToInt64(ModelBoundBox.MaxX).ToString("n0");
            lbMaxY.Text = Convert.ToInt64(ModelBoundBox.MaxY).ToString("n0");
            lbMaxZ.Text = Convert.ToInt64(ModelBoundBox.MaxZ).ToString("n0");

            VIZCore3D.NET.Data.Vertex3D center = ModelBoundBox.GetCenter();
            txtCenterX.Text = Convert.ToInt64(center.X).ToString();
            txtCenterY.Text = Convert.ToInt64(center.Y).ToString();
            txtCenterZ.Text = Convert.ToInt64(center.Z).ToString();

            this.tbX.Scroll -= new System.EventHandler(this.tbX_Scroll);
            this.tbY.Scroll -= new System.EventHandler(this.tbY_Scroll);
            this.tbZ.Scroll -= new System.EventHandler(this.tbZ_Scroll);

            tbX.Minimum = tbY.Minimum = tbZ.Minimum = 0;
            tbX.Maximum = tbY.Maximum = tbZ.Maximum = 100;
            tbX.Value   = tbY.Value = tbZ.Value = 50;

            this.tbX.Scroll += new System.EventHandler(this.tbX_Scroll);
            this.tbY.Scroll += new System.EventHandler(this.tbY_Scroll);
            this.tbZ.Scroll += new System.EventHandler(this.tbZ_Scroll);
        }
Exemplo n.º 3
0
        private void CustomMoveSurface()
        {
            if (String.IsNullOrEmpty(txtBodyIndex1.Text) == true)
            {
                return;
            }

            int bodyIndex1 = Convert.ToInt32(txtBodyIndex1.Text);

            if (vizcore3d.Object3D.GetNodeKind(bodyIndex1) != Data.NodeKind.BODY)
            {
                return;
            }

            VIZCore3D.NET.Data.Vertex3D v           = GetVertex(txtVertex1);
            VIZCore3D.NET.Data.Vertex3D plane       = GetVertex(txtVertex2);
            VIZCore3D.NET.Data.Vertex3D planeNormal = GetVertex(txtVertex3);

            if (v == null)
            {
                return;
            }
            if (plane == null)
            {
                return;
            }
            if (planeNormal == null)
            {
                return;
            }

            vizcore3d.MeshEdit.MoveVertexToLineProjection(bodyIndex1, v, plane, planeNormal);
        }
Exemplo n.º 4
0
 public void CheckSpace(VIZCore3D.NET.Data.Vertex3D v)
 {
     if (GridBoundBox.Contains(v, true, true, false) == true)
     {
         CollisionCount++;
     }
 }
Exemplo n.º 5
0
 public void CheckCollisionSpace(VIZCore3D.NET.Data.Vertex3D hotPoint)
 {
     foreach (GridSpaceItem item in Items)
     {
         item.CheckSpace(hotPoint);
     }
 }
Exemplo n.º 6
0
        private void AddTextDock4()
        {
            List <VIZCore3D.NET.Data.Node> items = vizcore3d.Object3D.Find.QuickSearch(new List <string>()
            {
                "GROUND_03"
            }, false, false, false, false, true, false);

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

            VIZCore3D.NET.Data.BoundBox3D boundbox = vizcore3d.Object3D.GeometryProperty.FromNode(items, false).GetBoundBox();

            VIZCore3D.NET.Data.Vertex3D center = new VIZCore3D.NET.Data.Vertex3D();
            center.X = boundbox.MaxX - 48000.0f;
            center.Y = boundbox.MaxY - 10000.0f;
            center.Z = boundbox.MaxZ + 11.0f;

            vizcore3d.TextDrawing.Add(
                center
                , new VIZCore3D.NET.Data.Vector3D(1, 0, 0) /* X+ 방향으로 텍스트가 표시 */
                , new VIZCore3D.NET.Data.Vector3D(0, 1, 0) /* 텍스트의 위쪽 방향 : Z+에서 볼때, Y+가 위쪽 임. */
                , 10000
                , 100
                , Color.Black
                , "VIZCore3D.NET"
                );
        }
Exemplo n.º 7
0
        private void MoveCamera(VIZCore3D.NET.Data.Vertex3D pt, float distance)
        {
            vizcore3d.View.Projection = Data.Projections.Perspective;
            vizcore3d.View.FOV        = Convert.ToSingle(tbFOV.Value);
            vizcore3d.View.SetPivotPosition(pt.X, pt.Y, pt.Z);

            vizcore3d.View.MoveCamera(pt, distance, false);
        }
Exemplo n.º 8
0
        private void DrawLine()
        {
            if (vizcore3d.Section == null || vizcore3d.Section.SelectedItem == null)
            {
                DrawingCtrl.ClearData();
                return;
            }

            List <VIZCore3D.NET.Data.Section> sections = vizcore3d.Section.Sections;

            List <List <PointF> > lines = new List <List <PointF> >();

            foreach (VIZCore3D.NET.Data.Section section in sections)
            {
                if (section.SectionType == VIZCore3D.NET.Manager.SectionManager.SectionTypes.SECTION)
                {
                    VIZCore3D.NET.Data.SectionPlaneEdgeCollection spec = vizcore3d.Section.GetClippedEdge(section.ID, -1);

                    //if (spec.Count == 0)
                    //    MessageBox.Show("SectionPlaneEdgeCollection count is 0.", "VIZCore3D.NET", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    foreach (VIZCore3D.NET.Data.SectionPlaneEdge item in spec)
                    {
                        List <PointF> line = new List <PointF>();

                        VIZCore3D.NET.Data.Vertex3D point1 = vizcore3d.View.WorldToScreen(item.Postion1, true);
                        line.Add(new PointF(point1.X, point1.Y));

                        VIZCore3D.NET.Data.Vertex3D point2 = vizcore3d.View.WorldToScreen(item.Postion2, true);
                        line.Add(new PointF(point2.X, point2.Y));

                        lines.Add(line);
                    }
                }
                else if (section.SectionType == VIZCore3D.NET.Manager.SectionManager.SectionTypes.SECTION_BOX)
                {
                    for (int i = 0; i < 6; i++)
                    {
                        VIZCore3D.NET.Data.SectionPlaneEdgeCollection spec = vizcore3d.Section.GetClippedEdge(section.ID, i);

                        foreach (VIZCore3D.NET.Data.SectionPlaneEdge item in spec)
                        {
                            List <PointF> line = new List <PointF>();

                            VIZCore3D.NET.Data.Vertex3D point1 = vizcore3d.View.WorldToScreen(item.Postion1, true);
                            line.Add(new PointF(point1.X, point1.Y));

                            VIZCore3D.NET.Data.Vertex3D point2 = vizcore3d.View.WorldToScreen(item.Postion2, true);
                            line.Add(new PointF(point2.X, point2.Y));

                            lines.Add(line);
                        }
                    }
                }
            }

            DrawingCtrl.SetData(lines);
        }
Exemplo n.º 9
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
                );
        }
Exemplo n.º 10
0
        private void CreateCylinder(int bodyIndex, VIZCore3D.NET.Data.Vertex3D start, VIZCore3D.NET.Data.Vertex3D end)
        {
            vizcore3d.BeginUpdate();

            vizcore3d.MeshEdit.AddPrimitiveCylinder(bodyIndex, start, end, 500, Color.Yellow, false, 12);

            vizcore3d.Structure.RebuildData();

            vizcore3d.EndUpdate();
        }
Exemplo n.º 11
0
        private void DisplayMessage(int id)
        {
            VIZCore3D.NET.Data.SelectionBox info = vizcore3d.SelectionBox.GetItem(id);
            VIZCore3D.NET.Data.Vertex3D     cog  = vizcore3d.SelectionBox.GetCOG(id, Data.BoundBoxSearchOption.FullyContained);

            vizcore3d.View.Message.Show(VIZCore3D.NET.Data.MessageId.ID_01, "선택상자", 5, 5, VIZCore3D.NET.Data.FontSize.Size_14_Bold, Color.Red);
            vizcore3d.View.Message.Show(VIZCore3D.NET.Data.MessageId.ID_02, string.Format("Title : {0}", info.Title), 5, 20, VIZCore3D.NET.Data.FontSize.Size_14, Color.Orange);
            vizcore3d.View.Message.Show(VIZCore3D.NET.Data.MessageId.ID_03, string.Format("Lable : {0}", info.Label), 5, 35, VIZCore3D.NET.Data.FontSize.Size_14, Color.Yellow);
            vizcore3d.View.Message.Show(VIZCore3D.NET.Data.MessageId.ID_04, string.Format("COG : {0}", cog.ToString()), 5, 50, VIZCore3D.NET.Data.FontSize.Size_14, Color.Green);
            vizcore3d.View.Message.Show(VIZCore3D.NET.Data.MessageId.ID_05, string.Format("Size : {0} / {1}", info.MinPoint.ToString(), info.MaxPoint.ToString()), 5, 65, VIZCore3D.NET.Data.FontSize.Size_14, Color.Blue);
        }
Exemplo n.º 12
0
        private void View_OnViewDefaultMouseDownEvent(object sender, MouseEventArgs e)
        {
            if (ckEnable.Checked == false)
            {
                return;
            }

            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            VIZCore3D.NET.Data.PickedSurfaceData data = vizcore3d.View.GetPickedSurfaceNormalVector(e.X, e.Y);

            // 선택된 부재가 없음
            if (data.Picked == false)
            {
                return;
            }

            // 표면점이 없음
            if (data.Surface == false)
            {
                return;
            }

            // 선택된 지점
            VIZCore3D.NET.Data.Vertex3D position = data.Position;

            // 선택된 지점의 Normal Vector
            VIZCore3D.NET.Data.Vector3D normal = data.Normal;

            string str = string.Format("VERTEX: {0}\r\nNORMAL : {1}", position.ToString(), normal.ToString());

            System.Console.WriteLine(str);

            int nodeIndex = vizcore3d.View.HitTest(e.X, e.Y);

            if (nodeIndex < 0)
            {
                return;
            }

            VIZCore3D.NET.Data.Node node = vizcore3d.Object3D.FromIndex(nodeIndex);

            int noteId = vizcore3d.Review.Note.AddNoteSurface(string.Format("{0}\r\n{1}", node.GetParentName(), str), new VIZCore3D.NET.Data.Vertex3D(position.X + 5000, position.Y + 5000, position.Z + 1000), position, GetStyle());

            if (ckDepthTest.Checked == true)
            {
                vizcore3d.Review.Note.EnableDepthTest(noteId, true);
            }
        }
Exemplo n.º 13
0
        private void btnConvertWorldToScreen_Click(object sender, EventArgs e)
        {
            VIZCore3D.NET.Data.Vertex3D point =
                vizcore3d.View.WorldToScreen(
                    Convert.ToSingle(txtWorldX.Text)
                    , Convert.ToSingle(txtWorldY.Text)
                    , Convert.ToSingle(txtWorldZ.Text)
                    , ckUseCamera.Checked
                    );

            txtScreenX.Text = point.X.ToString();
            txtScreenY.Text = point.Y.ToString();
        }
Exemplo n.º 14
0
        private void AddSurfaceData(bool pick, bool surface, VIZCore3D.NET.Data.Vertex3D position, VIZCore3D.NET.Data.Vector3D normal)
        {
            ListViewItem lvi = new ListViewItem(
                new string[] {
                pick == true ? "True" : "False"
                , surface == true ? "True" : "False"
                , position.ToString()
                , normal.ToString()
            }
                );

            lvItems.Items.Add(lvi);
        }
Exemplo n.º 15
0
        private void Object3D_OnSelectedObject3D(object sender, Event.EventManager.SelectedObject3DEventArgs e)
        {
            if (e.Node.Count == 0)
            {
                return;
            }

            VIZCore3D.NET.Data.Vertex3D surface = vizcore3d.Object3D.GetSurfaceVertexClosestToModelCenter(e.Node);
            txtCenterX.Text = surface.X.ToString();
            txtCenterY.Text = surface.Y.ToString();
            txtCenterZ.Text = surface.Z.ToString();

            txtText.Text = e.Node[0].NodeName;
        }
Exemplo n.º 16
0
        private void GeometryUtility_OnOsnapPickingItem(object sender, Event.EventManager.OsnapPickingItemEventArgs e)
        {
            if (e.Kind != Data.OsnapKind.POINT)
            {
                return;
            }

            VIZCore3D.NET.Data.Vertex3D v = e.Point;
            if (String.IsNullOrEmpty(txtV1.Text) == true)
            {
                txtV1.Text = v.ToString();
            }
            else
            {
                txtV2.Text = v.ToString();
            }
        }
Exemplo n.º 17
0
        private bool AddCollisionData(int step, string lugName, string rollerName, VIZCore3D.NET.Data.Vertex3D lug, VIZCore3D.NET.Data.Vertex3D roller, string tag, out CollisionItem collisionItem)
        {
            collisionItem = new CollisionItem();

            if (AnimationOnly == true) return false;

            VIZCore3D.NET.Data.Vertex3D start = lug;
            VIZCore3D.NET.Data.Vertex3D finish = roller;
            VIZCore3D.NET.Data.Vertex3D offset = start.PointToPoint(finish, 200);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            List<VIZCore3D.NET.Data.NearestObjectByAxisPoint> nearObjects
                = vizcore3d.GeometryUtility.GetNearestObjects(new List<int>() { 0 }, offset, finish, 0);

            sw.Stop();

            if (EnablePerformanceLog == true)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("{0} : {1} ms", tag, sw.ElapsedMilliseconds.ToString()));
                System.Diagnostics.Trace.WriteLine(string.Format("{0} : {1} ms", tag, sw.ElapsedMilliseconds.ToString()));
            }

            bool find = false;

            foreach (VIZCore3D.NET.Data.NearestObjectByAxisPoint item in nearObjects)
            {
                if (item.Index > 0 && ROLLER.ContainsKey(item.Index) == false)
                {
                    if (CollisionObjects.ContainsKey(item.Index) == false)
                    {
                        string nodePath = vizcore3d.Object3D.GetNodePath(item.Index);
                        if (nodePath.Contains("BLK") == true)
                        {
                            collisionItem.Set(item, lugName, rollerName, nodePath);

                            CollisionObjects.Add(item.Index, collisionItem);
                            find = true;
                        }
                    }
                }
            }

            return find;
        }
Exemplo n.º 18
0
        private void backgroundWorkerTurnOver_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (AnimationOnly == false)
            {
                if (CollisionObjects.Keys.Count > 0)
                    vizcore3d.Object3D.Color.SetColor(CollisionObjects.Keys.ToList(), Color.Red);
                else
                    MessageBox.Show("Collision Objects is nothing.");
            }

            if (BLOCK_NODES.Count > 0)
            {
                VIZCore3D.NET.Data.Vertex3D center = vizcore3d.Object3D.GeometryProperty.FromNode(BLOCK_NODES).CenterPoint;
                vizcore3d.View.SetPivotPosition(center);
                vizcore3d.Update();
            }
        }
Exemplo n.º 19
0
        private void ShowLogEdgeLoop(int index)
        {
            List <VIZCore3D.NET.Data.EdgeLoops> edgeLoop = vizcore3d.MeshEdit.GetEdgeLoops(index);

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < edgeLoop.Count; i++)
            {
                sb.AppendLine(string.Format("Vertex Count : {0} EA", edgeLoop[i].Vertex.Count));
                sb.AppendLine("");

                for (int j = 0; j < edgeLoop[i].Vertex.Count; j++)
                {
                    sb.AppendLine(string.Format("{0} : {1}", j + 1, edgeLoop[i].Vertex[j].ToString()));
                }
                sb.AppendLine("");

                sb.AppendLine(string.Format("Edge Loop Count : {0} EA", edgeLoop[i].Loop.Count));
                sb.AppendLine("");

                foreach (KeyValuePair <int, int> item in edgeLoop[i].Loop)
                {
                    sb.AppendLine(string.Format("Loop Vertex Start Index : {0}, Count : {1}", item.Key, item.Value));
                }
                sb.AppendLine("");

                for (int j = 0; j < edgeLoop[i].LoopVertex.Count; j++)
                {
                    VIZCore3D.NET.Data.Vertex3DItemCollection item = edgeLoop[i].LoopVertex[j];

                    sb.AppendLine(string.Format("No: {0} / Count : {1}", j + 1, item.Count));
                    for (int k = 0; k < item.Count; k++)
                    {
                        VIZCore3D.NET.Data.Vertex3D vertex = item[k];
                        sb.AppendLine(string.Format("{0} : {1}", k + 1, vertex.ToString()));
                    }

                    sb.AppendLine("");
                }
            }

            txtEdgeLoop.Text = sb.ToString();
        }
Exemplo n.º 20
0
        private void ShowDistance(List <VIZCore3D.NET.Data.CircleData> items)
        {
            vizcore3d.BeginUpdate();

            if (ckClearReview.Checked == true)
            {
                vizcore3d.Review.Measure.Clear();
            }

            if (items.Count > 1)
            {
                VIZCore3D.NET.Data.Vertex3D v1 = items[0].Center;
                VIZCore3D.NET.Data.Vertex3D v2 = items[1].Center;

                vizcore3d.Review.Measure.AddCustomDistance(v1, v2);
            }

            vizcore3d.EndUpdate();
        }
Exemplo n.º 21
0
        private void GeometryUtility_OnOsnapPickingItem(object sender, Event.EventManager.OsnapPickingItemEventArgs e)
        {
            bool visibleOnly = ckVisibleOnly.Checked;
            bool opaqueOnly  = ckOpaqueOnly.Checked;

            VIZCore3D.NET.Data.Vertex3D point = e.Point;

            vizcore3d.ShowWaitForm();

            vizcore3d.BeginUpdate();

            if (ckXPlus.Checked == true)
            {
                GetNearestObject(Data.AxisDirection.X_PLUS, point, visibleOnly, opaqueOnly);
            }
            if (ckXMinus.Checked == true)
            {
                GetNearestObject(Data.AxisDirection.X_MINUS, point, visibleOnly, opaqueOnly);
            }
            if (ckYPlus.Checked == true)
            {
                GetNearestObject(Data.AxisDirection.Y_PLUS, point, visibleOnly, opaqueOnly);
            }
            if (ckYMinus.Checked == true)
            {
                GetNearestObject(Data.AxisDirection.Y_MINUS, point, visibleOnly, opaqueOnly);
            }
            if (ckZPlus.Checked == true)
            {
                GetNearestObject(Data.AxisDirection.Z_PLUS, point, visibleOnly, opaqueOnly);
            }
            if (ckZMinus.Checked == true)
            {
                GetNearestObject(Data.AxisDirection.Z_MINUS, point, visibleOnly, opaqueOnly);
            }

            vizcore3d.Object3D.Select(Data.Object3dSelectionModes.DESELECT_ALL);
            vizcore3d.EndUpdate();

            vizcore3d.CloseWaitForm();
        }
Exemplo n.º 22
0
        private void HighlightCenter(List <VIZCore3D.NET.Data.CircleData> items)
        {
            VIZCore3D.NET.Data.NoteStyle style = vizcore3d.Review.Note.GetStyle();

            vizcore3d.BeginUpdate();

            if (ckClearReview.Checked == true)
            {
                vizcore3d.Review.Note.Clear();
            }

            foreach (VIZCore3D.NET.Data.CircleData item in items)
            {
                VIZCore3D.NET.Data.Vertex3D vNote = item.Center.Clone();
                vNote.Z += 400.0f;

                vizcore3d.Review.Note.AddNoteSurface(string.Format("INDEX : {0}\r\nDiameter : {1}\r\nCenter : {2}", item.Index, item.Diameter, item.Center.ToString()), vNote, item.Center);
            }

            vizcore3d.EndUpdate();
        }
Exemplo n.º 23
0
        private void DrawLine(VIZCore3D.NET.Data.Vertex3D start, VIZCore3D.NET.Data.Vector3D normal)
        {
            vizcore3d.ShapeDrawing.DepthTest = true;

            VIZCore3D.NET.Data.Vertex3D end = VIZCore3D.NET.Data.Vector3D.FromVertex3D(start).PointToVector(normal, 1000.0f).ToVertex3D();

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

            Data.Vertex3DItemCollection item = new VIZCore3D.NET.Data.Vertex3DItemCollection();
            item.Add(start);
            item.Add(end);

            vertex.Add(item);

            int shapeId = vizcore3d.ShapeDrawing.AddLine(
                vertex
                , 0
                , Color.Orange
                , 5.0f
                , true
                );
        }
Exemplo n.º 24
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            if (vizcore3d.Model.IsOpen() == false)
            {
                return;
            }

            RotateV1 = new VIZCore3D.NET.Data.Vertex3D();
            RotateV2 = new VIZCore3D.NET.Data.Vertex3D();

            RotateV1.X = BoundBox.MinX;
            RotateV2.X = BoundBox.MaxX;

            RotateV1.Y = BoundBox.MinY + (BoundBox.LengthY * 0.5f);
            RotateV2.Y = BoundBox.MinY + (BoundBox.LengthY * 0.5f);

            RotateV1.Z = BoundBox.MinZ;
            RotateV2.Z = BoundBox.MinZ;

            Block_Rotate_Angle = 0.0f;

            AnimationBlock(true);
        }
Exemplo n.º 25
0
        private List<VIZCore3D.NET.Data.Vertex3D> GetCircleCenterPoint(VIZCore3D.NET.Data.Vertex3D center, List<VIZCore3D.NET.Data.CircleData> circles)
        {
            List<VIZCore3D.NET.Data.Vertex3D> items = new List<VIZCore3D.NET.Data.Vertex3D>();

            foreach (VIZCore3D.NET.Data.CircleData item in circles)
            {
                float distance = center.Distance(item.Center);

                if (distance > 50)
                {
                    VIZCore3D.NET.Data.Vertex3D normal = item.Center.GetNormalized(center);
                    VIZCore3D.NET.Data.Vertex3D v1 = center.PointToVector(normal, 100);
                    VIZCore3D.NET.Data.Vertex3D v2 = center.PointToVector(normal, -100);

                    items.Add(v1);
                    items.Add(v2);

                    break;
                }
            }

            return items.ToList();
        }
Exemplo n.º 26
0
        private void btnGetNormal3D_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtWorldX.Text) == true)
            {
                return;
            }
            if (String.IsNullOrEmpty(txtWorldY.Text) == true)
            {
                return;
            }
            if (String.IsNullOrEmpty(txtWorldZ.Text) == true)
            {
                return;
            }

            VIZCore3D.NET.Data.Vertex3D position =
                new VIZCore3D.NET.Data.Vertex3D(
                    txtWorldX.Text
                    , txtWorldY.Text
                    , txtWorldZ.Text
                    );

            VIZCore3D.NET.Data.Vector3D normal =
                vizcore3d.View.GetSurfaceNormalVector(position);

            if (normal == null)
            {
                AddSurfaceData(false, false, position, new Data.Vector3D());
            }
            else
            {
                AddSurfaceData(true, true, position, normal);

                DrawLine(position, normal);
            }
        }
Exemplo n.º 27
0
        private void AddAngle(VIZCore3D.NET.Data.Node lug, VIZCore3D.NET.Data.Vertex3D center, VIZCore3D.NET.Data.Vertex3D roller, CollisionItem collisionItem)
        {
            if (DisplayAngle == false) return;

            List<VIZCore3D.NET.Data.CircleData> circles = vizcore3d.GeometryUtility.GetCircleData(lug.Index);
            List<VIZCore3D.NET.Data.Vertex3D> circleCenter = GetCircleCenterPoint(center, circles);
            if (circleCenter.Count < 2) return;

            VIZCore3D.NET.Data.Vertex3D v1 = circleCenter[0];
            VIZCore3D.NET.Data.Vertex3D v2 = circleCenter[1];

            VIZCore3D.NET.Data.Vertex3D vLug1 = center.PointToPoint(v1, 500);
            VIZCore3D.NET.Data.Vertex3D vLug2 = center.PointToPoint(v2, 500);
            VIZCore3D.NET.Data.Vertex3D vRoller = center.PointToPoint(roller, 500);

            int mid1 = vizcore3d.Review.Measure.AddCustom3PointAngle(center, vRoller, vLug1);
            int mid2 = vizcore3d.Review.Measure.AddCustom3PointAngle(center, vRoller, vLug2);

            if (collisionItem != null)
            {
                collisionItem.Angle1 = vizcore3d.Review.Measure.GetItem(mid1).Title;
                collisionItem.Angle2 = vizcore3d.Review.Measure.GetItem(mid2).Title;
            }
        }
Exemplo n.º 28
0
        private void MakeDashboard()
        {
            float contentsColumn = Convert.ToSingle(txtContentsColumn.Text); // 4.0f;
            float contentsRow    = Convert.ToSingle(txtContentsRow.Text);    // 5.0f;
            float titleHeight    = Convert.ToSingle(txtTitleHeight.Text);    // 3000.0f;
            float subTitleHeight = Convert.ToSingle(txtSubTitleHeight.Text); // 2000.0f;
            float contentsWidth  = Convert.ToSingle(txtContentsWidth.Text);  // 15000.0f;
            float contentsHeight = Convert.ToSingle(txtContentsHeight.Text); // 15000.0f;

            vizcore3d.Model.Close();
            SpaceManager.Clear();

            VIZCore3D.NET.Manager.PrimitiveObject root = vizcore3d.Primitive.AddNode("DASHBOARD");

            VIZCore3D.NET.Manager.PrimitiveObject title = root.AddNode("TITLE", 3);

            {
                VIZCore3D.NET.Manager.PrimitiveBox box      = new VIZCore3D.NET.Manager.PrimitiveBox();
                VIZCore3D.NET.Data.Vertex3D        min      = new VIZCore3D.NET.Data.Vertex3D(0, 0, -500);
                VIZCore3D.NET.Data.Vertex3D        max      = new VIZCore3D.NET.Data.Vertex3D(contentsColumn * contentsWidth, -titleHeight, 0);
                VIZCore3D.NET.Data.BoundBox3D      boundbox = new VIZCore3D.NET.Data.BoundBox3D(min, max);
                SpaceManager.Add("TITLE", boundbox);
                box.SetMinMaxPoints(boundbox);
                title.AddPrimitive(box);
            }

            VIZCore3D.NET.Manager.PrimitiveObject contents = root.AddNode("CONTENTS", 10);

            VIZCore3D.NET.Manager.PrimitiveObject group = contents.AddNode("GROUP", 4);
            VIZCore3D.NET.Manager.PrimitiveObject model = contents.AddNode("MODEL", 10);

            {
                int ID = 1;

                for (int i = 0; i < contentsRow; i++)
                {
                    for (int j = 0; j < contentsColumn; j++)
                    {
                        {
                            VIZCore3D.NET.Manager.PrimitiveObject groupItem = group.AddNode(string.Format("GROUP_{0:D2}", ID), 4);

                            // Title
                            VIZCore3D.NET.Manager.PrimitiveBox groupTitleBox = new Manager.PrimitiveBox();
                            VIZCore3D.NET.Data.Vertex3D        min           = new VIZCore3D.NET.Data.Vertex3D(
                                j * contentsWidth
                                , -titleHeight - (i * (subTitleHeight + contentsHeight))
                                , -500
                                );
                            VIZCore3D.NET.Data.Vertex3D max = new VIZCore3D.NET.Data.Vertex3D(
                                (j + 1) * contentsWidth
                                , -titleHeight - (i * (subTitleHeight + contentsHeight)) - subTitleHeight
                                , 0
                                );
                            VIZCore3D.NET.Data.BoundBox3D groupBoundBox = new VIZCore3D.NET.Data.BoundBox3D(min, max);
                            SpaceManager.Add(string.Format("GROUP_{0:D2}", ID), groupBoundBox);
                            groupTitleBox.SetMinMaxPoints(groupBoundBox);
                            groupItem.AddPrimitive(groupTitleBox);
                        }

                        {
                            VIZCore3D.NET.Manager.PrimitiveObject modelItem = model.AddNode(string.Format("MODEL_{0:D2}", ID), 10);

                            // Thumbnail
                            VIZCore3D.NET.Manager.PrimitiveBox thumbnailBox = new VIZCore3D.NET.Manager.PrimitiveBox();
                            VIZCore3D.NET.Data.Vertex3D        min          = new VIZCore3D.NET.Data.Vertex3D(
                                j * contentsWidth
                                , -titleHeight - (i * (subTitleHeight + contentsHeight)) - subTitleHeight
                                , -500
                                );
                            VIZCore3D.NET.Data.Vertex3D max = new VIZCore3D.NET.Data.Vertex3D(
                                (j + 1) * contentsWidth
                                , -titleHeight - ((i + 1) * (subTitleHeight + contentsHeight))
                                , 0
                                );
                            VIZCore3D.NET.Data.BoundBox3D thumbnailBoundBox = new VIZCore3D.NET.Data.BoundBox3D(min, max);
                            SpaceManager.Add(string.Format("MODEL_{0:D2}", ID), thumbnailBoundBox);
                            thumbnailBox.SetMinMaxPoints(thumbnailBoundBox);
                            modelItem.AddPrimitive(thumbnailBox);
                        }

                        ID++;
                    }
                }
            }


            {
                vizcore3d.TextDrawing.Clear();

                {
                    VIZCore3D.NET.Data.BoundBox3D boundbox = SpaceManager["TITLE"];

                    VIZCore3D.NET.Data.Vertex3D center = new VIZCore3D.NET.Data.Vertex3D();
                    center.X = boundbox.MinX + (boundbox.LengthX * 0.5f);
                    center.Y = boundbox.MinY + (boundbox.LengthY * 0.5f);
                    center.Z = boundbox.MaxZ;

                    vizcore3d.TextDrawing.Add(
                        center
                        , new VIZCore3D.NET.Data.Vertex3D(1, 0, 0) /* X+ 방향으로 텍스트가 표시 */
                        , new VIZCore3D.NET.Data.Vertex3D(0, 1, 0) /* 텍스트의 위쪽 방향 : Z+에서 볼때, Y+가 위쪽 임. */
                        , 2000
                        , Color.Black
                        , txtTitle.Text
                        );
                }

                {
                    foreach (KeyValuePair <string, Data.BoundBox3D> item in SpaceManager)
                    {
                        if (item.Key.Contains("GROUP_") == false)
                        {
                            continue;
                        }

                        VIZCore3D.NET.Data.Vertex3D center = new VIZCore3D.NET.Data.Vertex3D();
                        center.X = item.Value.MinX + (contentsWidth * 0.5f);
                        center.Y = item.Value.MinY + (item.Value.LengthY * 0.5f);
                        center.Z = item.Value.MaxZ;

                        vizcore3d.TextDrawing.Add(
                            center
                            , new VIZCore3D.NET.Data.Vertex3D(1, 0, 0) /* X+ 방향으로 텍스트가 표시 */
                            , new VIZCore3D.NET.Data.Vertex3D(0, 1, 0) /* 텍스트의 위쪽 방향 : Z+에서 볼때, Y+가 위쪽 임. */
                            , 1000
                            , Color.Black
                            , item.Key.Replace("GROUP", "MODEL")
                            );
                    }
                }
            }

            vizcore3d.Primitive.OpenModel("BAY_BLOCK");

            if (Models.Count != 0)
            {
                PlaceModel();
            }
            else
            {
                vizcore3d.View.MoveCamera(VIZCore3D.NET.Data.CameraDirection.Z_PLUS);
                vizcore3d.View.Navigation = VIZCore3D.NET.Data.NavigationModes.PAN;
                vizcore3d.View.SetRenderMode(VIZCore3D.NET.Data.RenderModes.SMOOTH_EDGE);

                vizcore3d.View.FitToView();
            }
        }
Exemplo n.º 29
0
        private void btnAddBulk_Click(object sender, EventArgs e)
        {
            if (vizcore3d.Model.IsOpen() == false)
            {
                return;
            }

            // Group
            string groupName = "GROUP";

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

            int id     = vizcore3d.Structure.GetMaxId();
            int parent = groupNode.ID;

            List <VIZCore3D.NET.Data.NewNodeItem> items = new List <VIZCore3D.NET.Data.NewNodeItem>();

            for (int i = 0; i < 100; i++)
            {
                // Part
                VIZCore3D.NET.Data.NewNodeItem part = new VIZCore3D.NET.Data.NewNodeItem();

                part.ParentId = parent;
                part.ID       = ++id;
                part.Kind     = Data.NodeKind.PART;
                part.Name     = string.Format("CYLN_{0}", part.ID);

                items.Add(part);

                // Body
                VIZCore3D.NET.Data.NewNodeItem body = new VIZCore3D.NET.Data.NewNodeItem();

                body.ParentId = part.ID;
                body.ID       = ++id;
                body.Kind     = Data.NodeKind.BODY;
                body.Name     = string.Format("CYLN_{0}", body.ID);

                items.Add(body);
            }

            vizcore3d.Structure.CreateNodes(items);

            vizcore3d.BeginUpdate();
            for (int i = 0; i < items.Count; i++)
            {
                VIZCore3D.NET.Data.NewNodeItem item = items[i];
                if (item.Kind == VIZCore3D.NET.Data.NodeKind.PART)
                {
                    continue;
                }

                int bodyIndex = vizcore3d.Object3D.GetBodyIndex(item.ID);

                VIZCore3D.NET.Data.Vertex3D start = new VIZCore3D.NET.Data.Vertex3D(i * 1000, i * 1000, 0);
                VIZCore3D.NET.Data.Vertex3D end   = new VIZCore3D.NET.Data.Vertex3D((i + 1) * 1000, (i + 1) * 1000, 0);
                vizcore3d.MeshEdit.AddPrimitiveCylinder(bodyIndex, start, end, 500, Color.Yellow, false, 12);
            }

            vizcore3d.Structure.RebuildData();

            vizcore3d.EndUpdate();
        }
Exemplo n.º 30
0
        private void AddResult(VIZCore3D.NET.Data.ConnectedSurfaceNormalVectorItem item, bool note, bool nv)
        {
            VIZCore3D.NET.Data.Node node1 = vizcore3d.Object3D.FromIndex(item.Index1);
            VIZCore3D.NET.Data.Node node2 = vizcore3d.Object3D.FromIndex(item.Index2);

            string no = Convert.ToString(lvResult.Items.Count + 1);

            ListViewItem lvi = new ListViewItem(
                new string[]
            {
                no
                , node1.Index.ToString()
                , node2.Index.ToString()
                , node1.NodeName
                , node2.NodeName
                , item.UseTestPosition == true ? item.TestPosition.ToString() : ""
                , item.Normal.ToString()
                , item.Projection1.ToString()
                , item.Projection2.ToString()
            }
                );

            lvi.Tag = item;

            lvResult.Items.Add(lvi);

            if (note == true)
            {
                VIZCore3D.NET.Data.MultiColorText text = new Data.MultiColorText();
                text.AddLine(string.Format("NO. : {0}", no), Color.Purple);
                text.AddLine(string.Format("NODE #1 : {0}", node1.NodeName), Color.Black);
                text.AddLine(string.Format("NODE #2 : {0}", node2.NodeName), Color.Blue);
                text.AddLine(string.Format("N/V : {0}", item.Normal.ToString()), Color.Red);

                VIZCore3D.NET.Data.Vertex3D pos
                    = new VIZCore3D.NET.Data.Vertex3D(
                          item.Projection1.X + 500
                          , item.Projection1.Y + 500
                          , item.Projection1.Z + 3500
                          );

                vizcore3d.Review.Note.AddNoteSurface(text, pos, item.Projection1);
            }

            if (nv == true)
            {
                if (Convert.ToInt32(item.Normal.X) != 0 ||
                    Convert.ToInt32(item.Normal.Y) != 0 ||
                    Convert.ToInt32(item.Normal.Z) != 0)
                {
                    return;
                }

                vizcore3d.ShapeDrawing.AddVertex(
                    new List <VIZCore3D.NET.Data.Vertex3D>()
                {
                    item.TestPosition
                }
                    , 0
                    , Color.Blue
                    , 10
                    , 10
                    , true
                    );
            }
        }