private void ShowOriginalLocation(int index, VIZCore3D.NET.Data.Object3DProperty prop, VIZCore3D.NET.Data.Vector3D v) { List <Color> color = new List <Color>(); color.Add(Color.FromArgb(10, 255, 0, 0)); color.Add(Color.FromArgb(10, 0, 255, 0)); color.Add(Color.FromArgb(10, 0, 0, 255)); vizcore3d.SelectionBox.Add(prop.GetBoundBox(), color[index], Color.FromArgb(100, 255, 255, 255), ""); VIZCore3D.NET.Data.Vertex3DItemCollection items = new VIZCore3D.NET.Data.Vertex3DItemCollection(); items.Add(prop.CenterPoint); items.Add(prop.CenterPoint + v.ToVertex3D()); vizcore3d.ShapeDrawing.AddLine( new List <Data.Vertex3DItemCollection>() { items } , 0 , Color.Red , 5.0f , true ); }
private List <VIZCore3D.NET.Data.Vertex3DItemCollection> GetVertexList(int index) { List <VIZCore3D.NET.Data.OsnapVertex3D> osnap = vizcore3d.Object3D.GetOsnapPoint(index); List <VIZCore3D.NET.Data.Vertex3DItemCollection> vertex = new List <VIZCore3D.NET.Data.Vertex3DItemCollection>(); foreach (Data.OsnapVertex3D point in osnap) { if (point.Kind == Data.OsnapKind.LINE) { VIZCore3D.NET.Data.Vertex3DItemCollection item = new VIZCore3D.NET.Data.Vertex3DItemCollection(); item.Add(point.Start); item.Add(point.End); vertex.Add(item); } else if (point.Kind == Data.OsnapKind.CIRCLE) { VIZCore3D.NET.Data.Vertex3DItemCollection item = new VIZCore3D.NET.Data.Vertex3DItemCollection(); item.Add(point.Start); item.Add(point.End); vertex.Add(item); } } return(vertex); }
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 ); }
private void DrawArrow() { vizcore3d.ShapeDrawing.Clear(); if (ckEnableLine.Checked == false) { return; } List <VIZCore3D.NET.Data.Node> nodes = vizcore3d.Object3D.FromIndex(0).GetChildObject3d(VIZCore3D.NET.Data.Object3DChildOption.CHILD_ONLY); if (nodes.Count == 0) { return; } List <VIZCore3D.NET.Data.BoundBox3D> boudBox = new List <VIZCore3D.NET.Data.BoundBox3D>(); for (int i = 0; i < nodes.Count; i++) { VIZCore3D.NET.Data.Node item = nodes[i]; if (item.ChildCount == 0) { continue; } if (item.Visible == false) { continue; } VIZCore3D.NET.Data.BoundBox3D boundBox = item.GetBoundBoxAABB(); boudBox.Add(boundBox); } vizcore3d.BeginUpdate(); for (int i = 0; i < boudBox.Count; i++) { List <VIZCore3D.NET.Data.Vertex3DItemCollection> vitems = new List <VIZCore3D.NET.Data.Vertex3DItemCollection>(); VIZCore3D.NET.Data.Vertex3DItemCollection vcoll = new VIZCore3D.NET.Data.Vertex3DItemCollection(); if (i < boudBox.Count - 1) { VIZCore3D.NET.Data.BoundBox3D box1 = boudBox[i + 0]; VIZCore3D.NET.Data.BoundBox3D box2 = boudBox[i + 1]; vcoll.Add(box1.GetCenter()); vcoll.Add(box2.GetCenter()); vitems.Add(vcoll); //vizcore3d.ShapeDrawing.AddArrow(vitems, 1, Color.Black, Color.Red, 2, 10, true); //vizcore3d.ShapeDrawing.AddArrow(vitems, 1, 1000.0f, 1000.0f, Color.Black, Color.Red, 2, 10, true); vizcore3d.ShapeDrawing.AddArrow(vitems, 1, box1.MaxLength, box2.MaxLength, Color.Black, Color.Red, 2, 10, true); } } vizcore3d.EndUpdate(); }
private List <VIZCore3D.NET.Data.Vertex3DItemCollection> GetVertexList() { List <VIZCore3D.NET.Data.Vertex3DItemCollection> vertex = new List <VIZCore3D.NET.Data.Vertex3DItemCollection>(); VIZCore3D.NET.Data.BoundBox3D boundbox = vizcore3d.Object3D.GeometryProperty.FromSelectedObject3D(false).GetBoundBox(); { Data.Vertex3DItemCollection item = new VIZCore3D.NET.Data.Vertex3DItemCollection(); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MinY, boundbox.MinZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MaxY, boundbox.MinZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MaxY, boundbox.MinZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MinY, boundbox.MinZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MinY, boundbox.MinZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MinY, boundbox.MaxZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MaxY, boundbox.MaxZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MaxY, boundbox.MaxZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MinY, boundbox.MaxZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MinY, boundbox.MaxZ)); vertex.Add(item); } { VIZCore3D.NET.Data.Vertex3DItemCollection item = new VIZCore3D.NET.Data.Vertex3DItemCollection(); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MaxY, boundbox.MinZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MaxY, boundbox.MaxZ)); vertex.Add(item); } { VIZCore3D.NET.Data.Vertex3DItemCollection item = new VIZCore3D.NET.Data.Vertex3DItemCollection(); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MaxY, boundbox.MinZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MaxY, boundbox.MaxZ)); vertex.Add(item); } { VIZCore3D.NET.Data.Vertex3DItemCollection item = new VIZCore3D.NET.Data.Vertex3DItemCollection(); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MinY, boundbox.MaxZ)); item.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MinY, boundbox.MinZ)); vertex.Add(item); } return(vertex); }
private void btnLineCenter_Click(object sender, EventArgs e) { vizcore3d.ShapeDrawing.Clear(); List <VIZCore3D.NET.Data.Node> nodes = vizcore3d.Object3D.FromIndex(0).GetChildObject3d(VIZCore3D.NET.Data.Object3DChildOption.CHILD_ONLY); if (nodes.Count == 0) { return; } List <VIZCore3D.NET.Data.Vertex3D> center = new List <VIZCore3D.NET.Data.Vertex3D>(); foreach (VIZCore3D.NET.Data.Node item in nodes) { if (item.ChildCount == 0) { continue; } if (item.Visible == false) { continue; } VIZCore3D.NET.Data.BoundBox3D boundBox = item.GetBoundBoxAABB(); center.Add(boundBox.GetCenter()); } //if (center.Count > 0) // vizcore3d.ShapeDrawing.AddVertex(center, 0, Color.Red, 3, 3, true); for (int i = 0; i < center.Count; i++) { List <VIZCore3D.NET.Data.Vertex3DItemCollection> vitems = new List <VIZCore3D.NET.Data.Vertex3DItemCollection>(); VIZCore3D.NET.Data.Vertex3DItemCollection vcoll = new VIZCore3D.NET.Data.Vertex3DItemCollection(); if (i < center.Count - 1) { vcoll.Add(center[i + 0]); vcoll.Add(center[i + 1]); vitems.Add(vcoll); vizcore3d.ShapeDrawing.AddLine(vitems, 1, Color.Red, 2, true); } } }
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 ); }
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(); }