Esempio n. 1
0
        private void DrawPoints(IWorkbook Doc)
        {
            AllPoints.Clear();
            int    errcount = 0;
            ISheet Sheet    = Doc.GetSheetAt(0);

            for (int i = 1; i < Sheet.PhysicalNumberOfRows; i++)
            {
                if (Sheet.GetRow(i) != null)
                {
                    try
                    {
                        IRow      Row       = Sheet.GetRow(i);
                        string    name      = Row.GetCell(0).ToString();
                        string    badsymbol = @"'";
                        double    X         = Convert.ToDouble(Row.GetCell(1).ToString().Replace('.', ',').Replace(badsymbol, "").Replace(" ", ""));
                        double    Y         = Convert.ToDouble(Row.GetCell(2).ToString().Replace('.', ',').Replace(badsymbol, "").Replace(" ", ""));
                        double    Z         = Convert.ToDouble(Row.GetCell(3).ToString().Replace('.', ',').Replace(badsymbol, "").Replace(" ", ""));
                        NodePoint iNode     = new NodePoint(name, X, Y, Z, null);
                        AllPoints.Add(iNode);
                    }
                    catch
                    {
                        errcount++;
                    }
                }
            }
            ////
            CATIA = (INFITF.Application)Marshal.GetActiveObject("Catia.Application");
            var partDoc = CATIA.ActiveDocument as PartDocument;

            if (partDoc != null)
            {
                var Part    = partDoc.Part;
                var HBodies = Part.HybridBodies;
                var HBody   = HBodies.Add();
                HBody.set_Name("Import Points_" + AllPoints.Count.ToString());
                Part.Update();
                var ShapeFactory = Part.HybridShapeFactory as HybridShapeFactory;
                foreach (NodePoint iNode in AllPoints)
                {
                    var Point = ShapeFactory.AddNewPointCoord(iNode.X, iNode.Y, iNode.Z);
                    Point.set_Name(iNode.Name);
                    iNode.link = Point as HybridShapeTypeLib.Point;
                    HBody.AppendHybridShape(Point);
                }
                Part.Update();
            }
            else
            {
                throw new InvalidOperationException("Документ не найден.Проставление точек невозможно при работе с CATProduct.Откройте нужную деталь(CATPart) отдельно.");
            }
        }
        public override Vector3 GetPosition(float time)
        {
            if (AllPoints != null && AllPoints.ContainsKey(time))
            {
                return(AllPoints[time]);
            }

            int     numSections = Nodes.Count - 1;
            int     currentNode = Mathf.Min(Mathf.FloorToInt(time * (float)numSections), numSections - 1);
            float   u           = time * (float)numSections - (float)currentNode;
            Vector3 point       = GetHermitNode(currentNode + 1, u);

            AllPoints.Add(time, point);
            return(point);
        }
Esempio n. 3
0
        public override Vector3 GetPosition(float time)
        {
            if (time == 0)
            {
                return(Nodes[0].Position);
            }
            if (AllPoints != null && AllPoints.ContainsKey(time))
            {
                return(AllPoints[time]);
            }
            Vector3 output = cubicSplineInterpolation(time);

            AllPoints.Add(time, output);
            return(output);
        }
Esempio n. 4
0
        public override Vector3 GetPosition(float time)
        {
            if (AllPoints != null && AllPoints.ContainsKey(time))
            {
                return(AllPoints[time]);
            }

            int     N     = Nodes.Count - 1;
            Vector3 point = deCasteljauBezier(N, 0, time);

            AllPoints.Add(time, point);
            return(point);

            // float d = 1f - time;
            //return d * d * d * Nodes[0].Position + 3f * d * d * time * Nodes[1].Position + 3f * d * time * time * Nodes[2].Position + time * time * time * Nodes[3].Position;
        }
Esempio n. 5
0
        /// <summary>
        /// Add a new entry to represent a new event.
        /// </summary>
        /// <param name="date">Date of the event</param>
        public void AddNewEvent(CommonPoints newPoints)
        {
            AllPoints.Add(newPoints);

            this.PositionPoints = this.CalculatePositionPoints();
        }