CS_NXOpen_0007_Bsurf_Splines




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using NXOpen;
using NXOpen.UF;


namespace createBSurf
{
    public class EX_Bsurf
    {

        private static UFSession theUfSession;
        private static Session theSession;

        public static void Main(string[] args)
        {

            theSession = Session.GetSession();
            theUfSession = UFSession.GetUFSession();

            // create BSurf


            int[] bsurf_idata = { 4, 4, 4, 4 };

            double[] bsurf_uknot = { 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0 };
            double[] bsurf_vknot = { 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0 };

            double[] bsurf_poles = {0.0,0.0,6.0,1.0,
                                        2.0,2.0,6.0,1.0,
                                        5.0,1.5,6.0,1.0,
                                        8.0,3.0,6.0,1.0,
                                        0.0,2.0,4.0,1.0,
                                        2.0,4.0,4.0,1.0,
                                        5.0,3.5,4.0,1.0,
                                        8.0,5.0,4.0,1.0,
                                        0.0,2.0,2.0,1.0,
                                        2.0,4.0,2.0,1.0,
                                        5.0,3.5,2.0,1.0,
                                        8.0,5.0,2.0,1.0,
                                        0.0,0.0,0.0,1.0,
                                        2.0,2.0,0.0,1.0,
                                        5.0,1.5,0.0,1.0,
                                        8.0,3.0,0.0,1.0};

            Tag bsurf;
            int knot_fixup, pole_fixup;


            theUfSession.Modl.CreateBsurf(bsurf_idata[0],
               bsurf_idata[1],
               bsurf_idata[2],
               bsurf_idata[3],
               bsurf_uknot,
               bsurf_vknot,
               bsurf_poles,
               out bsurf,
               out knot_fixup,
               out pole_fixup);



            // create BSpline1


            int[] bcurv1_idata = { 3, 3 };

            double[] bcurv1_knots = { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 };

            double[] bcurv1_poles = {-0.5,-2.5,3.5,1.0,
                                         2.5,-2.5,3.5,1.0,
                                         2.5,-2.5,6.5,1.0};
            Tag bcurv1;
           
           
            theUfSession.Modl.CreateSpline(bcurv1_idata[0],
                bcurv1_idata[1],
                 bcurv1_knots,
                 bcurv1_poles,
                 out bcurv1,
                 out knot_fixup,
                 out pole_fixup);



            // create BSpline2



            int[] bcurv2_idata = { 8, 4 };

            double[] bcurv2_knots = {-0.6,-0.4,-0.2,0.0,0.2,
                                         0.4, 0.6, 0.8,1.0,1.2,
                                         1.4, 1.6};

            double[] bcurv2_poles = {3.0,-2.5,2.0,1.0,
                                         4.0,-2.5,1.0,1.0,
                                         7.0,-2.5,1.0,1.0,
                                         6.0,-2.5,3.0,1.0,
                                         3.0,-2.5,3.0,1.0,
                                         3.0,-2.5,2.0,1.0,
                                         4.0,-2.5,1.0,1.0,
                                         7.0,-2.5,1.0,1.0};
            Tag bcurv2;

            theUfSession.Modl.CreateSpline(bcurv2_idata[0],
    bcurv2_idata[1],
    bcurv2_knots,
    bcurv2_poles,
    out bcurv2,
    out knot_fixup,
    out pole_fixup);




        }
    }
}


Comments

Popular posts from this blog

CS_NXOpen_0011_MoveBodies2Components

CS_NXOpen_0003_ProjectCurve

CS_NXOpen_0010_ExtrudeCurves