Example #1
0
        public Snap.Position Position(double value)
        {
            IntPtr ptr;
            UFEval eval = Globals.UFSession.Eval;

            eval.Initialize2(this.NXOpenTag, out ptr);
            double[] point       = new double[3];
            double[] derivatives = new double[3];
            value /= this.Factor;
            eval.Evaluate(ptr, 0, value, point, derivatives);
            return(new Snap.Position(point));
        }
Example #2
0
        public Vector Derivative(double value)
        {
            IntPtr ptr;
            UFEval eval = Globals.UFSession.Eval;

            eval.Initialize2(this.NXOpenTag, out ptr);
            double[] point       = new double[3];
            double[] derivatives = new double[3];
            value /= this.Factor;
            eval.Evaluate(ptr, 1, value, point, derivatives);
            Vector vector = new Vector(derivatives);

            return((Vector)(vector / this.Factor));
        }
Example #3
0
        public Snap.Position[] PositionArray(double[] values)
        {
            IntPtr ptr;
            UFEval eval = Globals.UFSession.Eval;

            eval.Initialize2(this.NXOpenTag, out ptr);
            double[] point       = new double[3];
            double[] derivatives = new double[3];
            double   num2        = 1.0 / this.Factor;

            Snap.Position[] positionArray = new Snap.Position[values.LongLength];
            for (long i = 0L; i < values.LongLength; i += 1L)
            {
                double parm = values[(int)((IntPtr)i)] * num2;
                eval.Evaluate(ptr, 0, parm, point, derivatives);
                positionArray[(int)((IntPtr)i)] = new Snap.Position(point);
            }
            return(positionArray);
        }
Example #4
0
        public Vector[] Derivatives(double value, int order)
        {
            IntPtr ptr;
            UFEval eval = Globals.UFSession.Eval;

            eval.Initialize2(this.NXOpenTag, out ptr);
            double[] point       = new double[3];
            double[] derivatives = new double[3 * order];
            value = this.Factor * value;
            eval.Evaluate(ptr, order, value, point, derivatives);
            Vector[] vectorArray = new Vector[order + 1];
            vectorArray[0] = point;
            for (int i = 0; i < order; i++)
            {
                vectorArray[i + 1] = new Vector(derivatives[3 * i], derivatives[(3 * i) + 1], derivatives[(3 * i) + 2]);
                if ((this.NXOpenEdge.SolidEdgeType == NXOpen.Edge.EdgeType.Circular) || (this.NXOpenEdge.SolidEdgeType == NXOpen.Edge.EdgeType.Elliptical))
                {
                    vectorArray[i + 1] = (Vector)(System.Math.Pow(0.017453292519943295, (double)(i + 1)) * vectorArray[i + 1]);
                }
            }
            return(vectorArray);
        }
Example #5
0
        public Vector[] Derivatives(double value, int order)
        {
            IntPtr ptr;
            bool   flag = this.ObjectType == ObjectTypes.Type.Arc;
            UFEval eval = Globals.UFSession.Eval;

            eval.Initialize2(this.NXOpenTag, out ptr);
            double[] point       = new double[3];
            double[] derivatives = new double[3 * order];
            value /= this.Factor;
            eval.Evaluate(ptr, order, value, point, derivatives);
            Vector[] vectorArray = new Vector[order + 1];
            vectorArray[0] = point;
            for (int i = 0; i < order; i++)
            {
                vectorArray[i + 1] = new Vector(derivatives[3 * i], derivatives[(3 * i) + 1], derivatives[(3 * i) + 2]);
                if (flag)
                {
                    vectorArray[i + 1] = (Vector)(System.Math.Pow(0.017453292519943295, (double)(i + 1)) * vectorArray[i + 1]);
                }
            }
            return(vectorArray);
        }