Beispiel #1
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;
        }
Beispiel #2
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;
            }
        }
Beispiel #3
0
        private void backgroundWorkerTurnOver_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            int step = e.ProgressPercentage;

            if (backgroundWorkerTurnOver.CancellationPending == true) return;

            vizcore3d.BeginUpdate();
            vizcore3d.Object3D.Transform.Rotate(BLOCK_NODES, -1, 0, 0, false, false);

            // LUG1 - ROLLER1
            // LUG2 - ROLLER4
            vizcore3d.ShapeDrawing.Clear();
            vizcore3d.ShapeDrawing.DepthTest = true;

            bool find = false;

            if (DisplayAngle == true)
                vizcore3d.Review.Measure.Clear();

            for (int i = 0; i < 7; i++)
            {
                VIZCore3D.NET.Data.Node lug1 = LUG1[i + 1];
                VIZCore3D.NET.Data.Object3DProperty propLug1 = vizcore3d.Object3D.GeometryProperty.FromNode(lug1);

                VIZCore3D.NET.Data.Node roller1 = ROLLER1[i + 1];
                VIZCore3D.NET.Data.Object3DProperty propRoller1 = vizcore3d.Object3D.GeometryProperty.FromNode(roller1);


                VIZCore3D.NET.Data.Node lug2 = LUG2[i + 1];
                VIZCore3D.NET.Data.Object3DProperty propLug2 = vizcore3d.Object3D.GeometryProperty.FromNode(lug2);

                VIZCore3D.NET.Data.Node roller2 = ROLLER4[i + 1];
                VIZCore3D.NET.Data.Object3DProperty propRoller2 = vizcore3d.Object3D.GeometryProperty.FromNode(roller2);

                {
                    List<VIZCore3D.NET.Data.Vertex3DItemCollection> item1 = new List<Data.Vertex3DItemCollection>();
                    VIZCore3D.NET.Data.Vertex3DItemCollection coll1 = new Data.Vertex3DItemCollection();
                    coll1.Add(propLug1.CenterPoint);
                    coll1.Add(propRoller1.CenterPoint);
                    item1.Add(coll1);
                    vizcore3d.ShapeDrawing.AddLine(item1, i, Color.Black, 1, true);
                    //vizcore3d.ShapeDrawing.AddCylinder(item1, i, Color.Black, 10, true);
                }

                {
                    List<VIZCore3D.NET.Data.Vertex3DItemCollection> item2 = new List<Data.Vertex3DItemCollection>();
                    VIZCore3D.NET.Data.Vertex3DItemCollection coll2 = new Data.Vertex3DItemCollection();
                    coll2.Add(propLug2.CenterPoint);
                    coll2.Add(propRoller2.CenterPoint);
                    item2.Add(coll2);
                    vizcore3d.ShapeDrawing.AddLine(item2, i + 7, Color.Black, 1, true);
                    //vizcore3d.ShapeDrawing.AddCylinder(item2, i + 7, Color.Black, 10, true);
                }

                CollisionItem collision1 = new CollisionItem();
                CollisionItem collision2 = new CollisionItem();

                bool find1 = AddCollisionData(step, lug1.NodeName, roller1.NodeName, propLug1.CenterPoint, propRoller1.CenterPoint, "TOB #1", out collision1);
                bool find2 = AddCollisionData(step, lug2.NodeName, roller2.NodeName, propLug2.CenterPoint, propRoller2.CenterPoint, "TOB #2", out collision2);

                if (find1 == true || find2 == true) find = true;

                AddAngle(lug1, propLug1.CenterPoint, propRoller1.CenterPoint, find1 == true ? collision1 : null);
                AddAngle(lug2, propLug2.CenterPoint, propRoller2.CenterPoint, find2 == true ? collision2 : null);
            }

            vizcore3d.EndUpdate();

            if (find == true && StopTurnOver == true) backgroundWorkerTurnOver.CancelAsync();

            Application.DoEvents();
        }