CS_NXOpen_0008_Cylinder_RecGroove






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 CylinderRecGroove
{
    public class EX_Cylinder_RecGroove
    {
        private static UFSession theUfSession;
        private static Session theSession;

        public static void Main(string[] args)
        {

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

        // create Cylinder


            double[] origin = { 0.0, 0.0, 0.0 };
            string height = "4.0";
            string diam = "2.0";
            double[] direction = { 0.0, 0.0, 1.0 };
            Tag cyl_obj_id;


            theUfSession.Modl.CreateCyl1(FeatureSigns.Nullsign, origin, height, diam, direction,
out cyl_obj_id);


            // create Rec.groove


            double[] location = { 0.0, 0.0, 2.0 };
            string gr_diam = "1.0";
            string width = "1.0";


            int i;
            int count;
            Tag[] face_list;
            Tag face;
            Tag body;



            int type;
            double[] center = new double[3];
            double[] dir = new double[3];
            double[] box = new double[6];
            double radius;
            double rad_data;
            int norm_dir;
            Tag face_id = Tag.Null;
            Tag feature_id;


                        theUfSession.Modl.CreateList(out face_list);
                        theUfSession.Modl.AskFeatBody(cyl_obj_id, out body);
                        theUfSession.Modl.AskBodyFaces(body,out face_list);
                        theUfSession.Modl.AskListCount(face_list, out count);

                       

             for(i = 0; i < count; i++)
            {
                theUfSession.Modl.AskListItem(face_list,i,out face);

                theUfSession.Modl.AskFaceData(face, out type, center, dir, box, out radius,
    out rad_data, out norm_dir);

                                 if(type == UFConstants.UF_cylinder_type) face_id = face;

            }

                

            theUfSession.Modl.CreateRectGroove(location, direction, gr_diam, width,
face_id, out feature_id);


        }

    }
}


Comments

Popular posts from this blog

CS_NXOpen_0011_MoveBodies2Components

CS_NXOpen_0003_ProjectCurve

CS_NXOpen_0010_ExtrudeCurves