CS_NXOpen_0003_ProjectCurve
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 ProjectCurve
{
public class EX_Curve_ProjCurves
{
private static UFSession theUfSession;
private static Session theSession;
public static void Main(string[] args)
{
theSession = Session.GetSession();
theUfSession = UFSession.GetUFSession();
//
Creating Block
double[] origin = { 0.0, 0.0, 0.0 };
String[] edge_lens = { "300.0", "25.0", "150.0" };
Tag block_tag;
theUfSession.Modl.CreateBlock1(FeatureSigns.Nullsign,
origin, edge_lens, out block_tag);
//
Creating Line
UFCurve.Line line_data = new UFCurve.Line();
Tag[] curves_to_proj = new Tag[1];
line_data.start_point = new double[3];
line_data.start_point[0] = 25.0;
line_data.start_point[1] = 50.0;
line_data.start_point[2] = 25.0;
line_data.end_point = new double[3];
line_data.end_point[0] = 275.0;
line_data.end_point[1] = 50.0;
line_data.end_point[2] = 125.0;
theUfSession.Curve.CreateLine(ref line_data, out curves_to_proj[0]);
//
Create project curve feature
UFCurve.Proj proj_data = new UFCurve.Proj();
Console.WriteLine("curves to
project tag = {0}\n", curves_to_proj[0]);
Tag[] face_list;
int num_faces, num_proj_curves;
Tag proj_curve_feature;
Tag[] proj_curves;
theUfSession.Modl.AskFeatFaces(block_tag, out face_list);
theUfSession.Modl.AskListCount(face_list, out num_faces);
proj_data.proj_type = 3;
proj_data.proj_vec = new Double[3];
proj_data.proj_vec[0] = 0.0;
proj_data.proj_vec[1] = 1.0;
proj_data.proj_vec[2] = 0.0;
proj_data.multiplicity = 2;
theUfSession.Curve.CreateProjCurves(1, curves_to_proj, face_list.Length,
face_list, 3, ref proj_data, out proj_curve_feature);
theUfSession.Curve.AskProjCurves(proj_curve_feature, out num_proj_curves, out proj_curves);
}
}
}
Comments
Post a Comment