Exemplo n.º 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));
        }
Exemplo n.º 2
0
        public Vector Tangent(double value)
        {
            IntPtr ptr;
            UFEval eval = Globals.UFSession.Eval;

            eval.Initialize2(this.NXOpenTag, out ptr);
            double[] point    = new double[3];
            double[] tangent  = new double[3];
            double[] normal   = new double[3];
            double[] binormal = new double[3];
            value /= this.Factor;
            eval.EvaluateUnitVectors(ptr, value, point, tangent, normal, binormal);
            return(new Vector(tangent));
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
0
        private static double ArcPercentage(Snap.NX.ICurve curve, Snap.Position point1, Snap.Position point2)
        {
            IntPtr ptr;
            double num  = 0.0;
            double num2 = curve.MaxU - curve.MinU;
            double num3 = (curve.Parameter(point1) - curve.MinU) / num2;
            double num4 = (curve.Parameter(point2) - curve.MinU) / num2;
            UFEval eval = Globals.UFSession.Eval;

            eval.Initialize2(curve.NXOpenTag, out ptr);
            double[] numArray2 = new double[2];
            numArray2[1] = 1.0;
            double[] limits = numArray2;
            eval.AskLimits(ptr, limits);
            Globals.UFSession.Curve.AskArcLength(curve.NXOpenTag, num3, num4, ModlUnits.ModlMmeter, out num);
            return((num / curve.ArcLength) * 100.0);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
 /// <summary>
 ///     Returns the arc data of the evaluator of a circular curve or edge.
 /// </summary>
 /// <remarks>
 ///     Refer to <see href="..ugopen_doc/uf_eval/global.html#UF_EVAL_ask_arc">UF_EVAL_ask_arc</see> for documentation<br/>
 ///     License requirements:None
 /// </remarks>
 /// <param name="ufEval"></param>
 /// <param name="arcTag">Object identifier of a curve</param>
 /// <param name="arc">arc data</param>
 public static void AskArc(this UFEval ufEval, Tag arcTag, out UFEval.Arc arc)
 {
     ufEval.Initialize(arcTag, out IntPtr evaluator);
     ufEval.AskArc(evaluator, out arc);
     ufEval.Free(evaluator);
 }