Ejemplo n.º 1
0
        private void lvResult_DoubleClick(object sender, EventArgs e)
        {
            if (lvResult.SelectedItems.Count == 0)
            {
                return;
            }
            if (lvResult.SelectedItems[0].Tag == null)
            {
                return;
            }

            VIZCore3D.NET.Data.ClashTestResultItem item = (VIZCore3D.NET.Data.ClashTestResultItem)lvResult.SelectedItems[0].Tag;

            vizcore3d.BeginUpdate();

            // Xray Mode
            if (vizcore3d.View.XRay.Enable == false)
            {
                vizcore3d.View.XRay.Enable = true;
            }

            // Xray Mode Option
            vizcore3d.View.XRay.ColorType             = Data.XRayColorTypes.OBJECT_COLOR;
            vizcore3d.View.XRay.SelectionObject3DType = Data.SelectionObject3DTypes.OPAQUE_OBJECT3D;

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

            // Select
            vizcore3d.View.XRay.Select(new List <int>()
            {
                item.NodeIndexA, item.NodeIndexB
            }, true);

            // Fly
            vizcore3d.View.FlyToObject3d(new List <int>()
            {
                item.NodeIndexA, item.NodeIndexB
            }, 2);

            // Add Vertex :: HOT POINT
            vizcore3d.ShapeDrawing.Clear();
            vizcore3d.ShapeDrawing.AddVertex(new List <Data.Vertex3D>()
            {
                item.HotPoint
            }, 0, Color.Red, 10.0f, 10.0f, true);

            // Set Pivot :: Rotation
            vizcore3d.View.SetPivotPosition(item.HotPoint);

            // Add Note :: Result Item
            VIZCore3D.NET.Data.Vertex3D v1 = vizcore3d.Object3D.GetSurfaceVertexClosestToModelCenter(new List <int>()
            {
                item.NodeIndexA
            });
            VIZCore3D.NET.Data.Vertex3D v2 = vizcore3d.Object3D.GetSurfaceVertexClosestToModelCenter(new List <int>()
            {
                item.NodeIndexB
            });

            vizcore3d.Review.Note.Clear();

            vizcore3d.Review.Note.AddNoteSurface(item.NodeNameA, v1.Clone().AddValue(Data.Axis.Y, 1000.0f), v1);
            vizcore3d.Review.Note.AddNoteSurface(item.NodeNameB, v2.Clone().AddValue(Data.Axis.Y, 1000.0f), v2);

            vizcore3d.EndUpdate();
        }
Ejemplo n.º 2
0
        private void ShowFrame(VIZCore3D.NET.Data.Vertex3D v)
        {
            vizcore3d.BeginUpdate();

            // Add Custom Measure
            vizcore3d.Review.Measure.AddCustomPosition(v);

            // Get Current Frame Item
            Dictionary <VIZCore3D.NET.Data.Axis, VIZCore3D.NET.Data.FrameItem> frame =
                vizcore3d.Frame.GetFrame(v);

            // Axis Frame Item
            VIZCore3D.NET.Data.FrameItem currentX = frame[VIZCore3D.NET.Data.Axis.X];
            VIZCore3D.NET.Data.FrameItem currentY = frame[VIZCore3D.NET.Data.Axis.Y];
            VIZCore3D.NET.Data.FrameItem currentZ = frame[VIZCore3D.NET.Data.Axis.Z];

            // Frame String
            string xFrameStr = string.Format("{0}{1}", currentX.Label, currentX.GridID);
            string yFrameStr = string.Format("{0}{1}", currentY.Label, currentY.GridID);
            string zFrameStr = string.Format("{0}{1}", currentZ.Label, currentZ.GridID);

            // Frame Position
            VIZCore3D.NET.Data.FramePosition xPosition =
                vizcore3d.Frame.GetPosition(VIZCore3D.NET.Data.Axis.X, xFrameStr);
            VIZCore3D.NET.Data.FramePosition yPosition =
                vizcore3d.Frame.GetPosition(VIZCore3D.NET.Data.Axis.Y, yFrameStr);
            VIZCore3D.NET.Data.FramePosition zPosition =
                vizcore3d.Frame.GetPosition(VIZCore3D.NET.Data.Axis.Z, zFrameStr);

            VIZCore3D.NET.Data.Vertex3D vmZ1 = new VIZCore3D.NET.Data.Vertex3D();

            // X-Base
            {
                List <VIZCore3D.NET.Data.Vertex3DItemCollection> xBaseLine  = new List <VIZCore3D.NET.Data.Vertex3DItemCollection>();
                VIZCore3D.NET.Data.Vertex3DItemCollection        xBasePoint = new VIZCore3D.NET.Data.Vertex3DItemCollection();
                xBasePoint.Add(v);
                VIZCore3D.NET.Data.Vertex3D vX = v.Clone();
                vX.Y -= 2000.0f;
                xBasePoint.Add(vX);
                xBaseLine.Add(xBasePoint);

                VIZCore3D.NET.Data.Vertex3DItemCollection xOffsetPoint = new VIZCore3D.NET.Data.Vertex3DItemCollection();
                VIZCore3D.NET.Data.Vertex3D vX1 = new VIZCore3D.NET.Data.Vertex3D(xPosition.Position, v.Y, v.Z);
                VIZCore3D.NET.Data.Vertex3D vX2 = new VIZCore3D.NET.Data.Vertex3D(xPosition.Position, v.Y - 2000.0f, v.Z);
                xOffsetPoint.Add(vX1);
                xOffsetPoint.Add(vX2);
                xBaseLine.Add(xOffsetPoint);

                vizcore3d.ShapeDrawing.AddDashLine(xBaseLine, 0, Color.Red, 5.0f, true, 100.0f);

                vizcore3d.TextDrawing.Add(vX2, new VIZCore3D.NET.Data.Vector3D(1, 0, 0), new VIZCore3D.NET.Data.Vector3D(0, 1, 0), 100, 100, Color.Black, string.Format("(X){0}", xFrameStr));

                // Middle Point
                VIZCore3D.NET.Data.Vertex3D vmX1 = v.PointToPoint(vX, 1000.0f);
                VIZCore3D.NET.Data.Vertex3D vmX2 = vX1.PointToPoint(vX2, 1000.0f);
                List <VIZCore3D.NET.Data.Vertex3DItemCollection> xMiddleLine  = new List <VIZCore3D.NET.Data.Vertex3DItemCollection>();
                VIZCore3D.NET.Data.Vertex3DItemCollection        xMiddlePoint = new VIZCore3D.NET.Data.Vertex3DItemCollection();
                xMiddlePoint.Add(vmX2);
                xMiddlePoint.Add(vmX1);
                xMiddleLine.Add(xMiddlePoint);
                vizcore3d.ShapeDrawing.AddArrow(xMiddleLine, 3, Color.Black, Color.Yellow, 5, 10, true);

                VIZCore3D.NET.Data.Vertex3D mX = vmX2.PointToPoint(vmX1, (vmX1.X - vmX2.X) / 2);
                mX.Y += 100.0f;
                vizcore3d.TextDrawing.Add(mX, new VIZCore3D.NET.Data.Vector3D(1, 0, 0), new VIZCore3D.NET.Data.Vector3D(0, 1, 0), 70, 50, Color.Black, string.Format("{0}", Math.Abs(vmX1.X - vmX2.X)));

                vmZ1 = v.PointToPoint(vX, 800.0f);
            }

            // Y-Base
            {
                List <VIZCore3D.NET.Data.Vertex3DItemCollection> yBaseLine  = new List <VIZCore3D.NET.Data.Vertex3DItemCollection>();
                VIZCore3D.NET.Data.Vertex3DItemCollection        yBasePoint = new VIZCore3D.NET.Data.Vertex3DItemCollection();
                yBasePoint.Add(v);
                VIZCore3D.NET.Data.Vertex3D vY = v.Clone();
                vY.X -= 2000.0f;
                yBasePoint.Add(vY);
                yBaseLine.Add(yBasePoint);

                VIZCore3D.NET.Data.Vertex3DItemCollection yOffsetPoint = new VIZCore3D.NET.Data.Vertex3DItemCollection();
                VIZCore3D.NET.Data.Vertex3D vY1 = new VIZCore3D.NET.Data.Vertex3D(v.X, yPosition.Position, v.Z);
                VIZCore3D.NET.Data.Vertex3D vY2 = new VIZCore3D.NET.Data.Vertex3D(v.X - 2000.0f, yPosition.Position, v.Z);
                yOffsetPoint.Add(vY1);
                yOffsetPoint.Add(vY2);
                yBaseLine.Add(yOffsetPoint);

                vizcore3d.ShapeDrawing.AddDashLine(yBaseLine, 1, Color.Black, 5.0f, true, 100.0f);

                vizcore3d.TextDrawing.Add(vY2, new VIZCore3D.NET.Data.Vector3D(0, -1, 0), new VIZCore3D.NET.Data.Vector3D(1, 0, 0), 100, 100, Color.Black, string.Format("(Y){0}", yFrameStr));

                // Middle Point
                VIZCore3D.NET.Data.Vertex3D vmY1 = v.PointToPoint(vY, 1000.0f);
                VIZCore3D.NET.Data.Vertex3D vmY2 = vY1.PointToPoint(vY2, 1000.0f);
                List <VIZCore3D.NET.Data.Vertex3DItemCollection> yMiddleLine  = new List <VIZCore3D.NET.Data.Vertex3DItemCollection>();
                VIZCore3D.NET.Data.Vertex3DItemCollection        yMiddlePoint = new VIZCore3D.NET.Data.Vertex3DItemCollection();
                yMiddlePoint.Add(vmY2);
                yMiddlePoint.Add(vmY1);
                yMiddleLine.Add(yMiddlePoint);
                vizcore3d.ShapeDrawing.AddArrow(yMiddleLine, 3, Color.Black, Color.Yellow, 5, 10, true);

                VIZCore3D.NET.Data.Vertex3D mY = vmY2.PointToPoint(vmY1, (vmY2.Y - vmY1.Y) / 2);
                mY.X += 100.0f;
                vizcore3d.TextDrawing.Add(mY, new VIZCore3D.NET.Data.Vector3D(0, -1, 0), new VIZCore3D.NET.Data.Vector3D(1, 0, 0), 70, 50, Color.Black, string.Format("{0}", Math.Abs(vmY1.Y - vmY2.Y)));
            }

            // Z-Base
            {
                List <VIZCore3D.NET.Data.Vertex3DItemCollection> zBaseLine  = new List <VIZCore3D.NET.Data.Vertex3DItemCollection>();
                VIZCore3D.NET.Data.Vertex3DItemCollection        zBasePoint = new VIZCore3D.NET.Data.Vertex3DItemCollection();
                VIZCore3D.NET.Data.Vertex3D vZ0 = v.Clone();
                vZ0.Z = zPosition.Position;
                zBasePoint.Add(vZ0);
                VIZCore3D.NET.Data.Vertex3D vZ = v.Clone();
                vZ.Y -= 2000.0f;
                vZ.Z  = zPosition.Position;
                zBasePoint.Add(vZ);
                zBaseLine.Add(zBasePoint);

                vizcore3d.ShapeDrawing.AddDashLine(zBaseLine, 2, Color.Blue, 5.0f, true, 100.0f);

                vizcore3d.TextDrawing.Add(vZ, new VIZCore3D.NET.Data.Vector3D(0, 0, -1), new VIZCore3D.NET.Data.Vector3D(1, 0, 0), 100, 100, Color.Black, string.Format("(Z){0}", zFrameStr));

                // Middle Point
                VIZCore3D.NET.Data.Vertex3D vmZ2 = vZ0.PointToPoint(vZ, 800.0f);
                List <VIZCore3D.NET.Data.Vertex3DItemCollection> zMiddleLine  = new List <VIZCore3D.NET.Data.Vertex3DItemCollection>();
                VIZCore3D.NET.Data.Vertex3DItemCollection        zMiddlePoint = new VIZCore3D.NET.Data.Vertex3DItemCollection();
                zMiddlePoint.Add(vmZ2);
                zMiddlePoint.Add(vmZ1);
                zMiddleLine.Add(zMiddlePoint);
                vizcore3d.ShapeDrawing.AddArrow(zMiddleLine, 3, Color.Black, Color.Yellow, 5, 10, true);

                VIZCore3D.NET.Data.Vertex3D mZ = vmZ2.PointToPoint(vmZ1, (vmZ2.Z - vmZ1.Z) / 2);
                mZ.Y -= 100.0f;
                vizcore3d.TextDrawing.Add(mZ, new VIZCore3D.NET.Data.Vector3D(0, 0, -1), new VIZCore3D.NET.Data.Vector3D(1, 0, 0), 70, 50, Color.Black, string.Format("{0}", Math.Abs(vmZ1.Z - vmZ2.Z)));
            }

            vizcore3d.EndUpdate();
        }