CS_NXOpen_0005_lineArcFillet
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 curveFillet
{
public class EX_Curve_Fillet
{
private static UFSession theUfSession;
private static Session theSession;
//Constants
public const int UF_CURVE_2_CURVE = 0;
public const double DEGRA = .01745329251994328;
public static void Main(string[] args)
{
theSession = Session.GetSession();
theUfSession = UFSession.GetUFSession();
//
Creating line1
UFCurve.Line line_coords1 = new UFCurve.Line();
Tag line1;
line_coords1.start_point = new double[3];
line_coords1.start_point[0] = 0;
line_coords1.start_point[1] = 0;
line_coords1.start_point[2] = 0;
line_coords1.end_point = new double[3];
line_coords1.end_point[0] = 200;
line_coords1.end_point[1] = 0;
line_coords1.end_point[2] = 0;
theUfSession.Curve.CreateLine(ref line_coords1, out line1);
//
Creating Line2
UFCurve.Line line_coords2 = new UFCurve.Line();
Tag line2;
line_coords2.start_point = new double[3];
line_coords2.start_point[0] = 0;
line_coords2.start_point[1] = 200;
line_coords2.start_point[2] = 0.0;
line_coords2.end_point = new double[3];
line_coords2.end_point[0] = 200;
line_coords2.end_point[1] = 200;
line_coords2.end_point[2] = 0.0;
theUfSession.Curve.CreateLine(ref line_coords2, out line2);
//
WCS Reference
Tag
wcs_tag, matrix_tag;
theUfSession.Csys.AskWcs(out wcs_tag);
theUfSession.Csys.AskMatrixOfObject(wcs_tag,
out matrix_tag);
//
Create Arc1
UFCurve.Arc arc_coords1 = new UFCurve.Arc();
Tag arc1;
arc_coords1.matrix_tag = Tag.Null;
arc_coords1.start_angle = -90 *
DEGRA;
arc_coords1.end_angle = 90 * DEGRA;
arc_coords1.arc_center = new double[3];
arc_coords1.arc_center[0] = 200;
arc_coords1.arc_center[1] = 100;
arc_coords1.arc_center[2] = 0.0;
arc_coords1.radius = 100.0;
arc_coords1.matrix_tag =
matrix_tag;
theUfSession.Curve.CreateArc(ref arc_coords1, out arc1);
//
Create Arc2
UFCurve.Arc arc_coords2 = new UFCurve.Arc();
Tag arc2;
arc_coords2.matrix_tag = Tag.Null;
arc_coords2.start_angle = 90 *
DEGRA;
arc_coords2.end_angle = 270 *
DEGRA;
arc_coords2.arc_center = new double[3];
arc_coords2.arc_center[0] = 0;
arc_coords2.arc_center[1] = 100;
arc_coords2.arc_center[2] = 0.0;
arc_coords2.radius = 100;
arc_coords2.matrix_tag =
matrix_tag;
theUfSession.Curve.CreateArc(ref arc_coords2, out arc2);
// Creating
Line3
UFCurve.Line line_coords3 = new UFCurve.Line();
Tag line3;
line_coords3.start_point = new double[3];
line_coords3.start_point[0] = 100;
line_coords3.start_point[1] = 0;
line_coords3.start_point[2] = 0.0;
line_coords3.end_point = new double[3];
line_coords3.end_point[0] = 100;
line_coords3.end_point[1] = 200;
line_coords3.end_point[2] = 0.0;
theUfSession.Curve.CreateLine(ref line_coords3, out line3);
/*create
fillet between "line3" and "line1"*/
Tag[] curve_objs = new Tag[3];
double[] center = new double[3];
double radius;
int[] trim_opts = new int[3];
int[] arc_opts = { 0, 0, 0 };
Tag fillet_obj1;
curve_objs[0] = line3;
curve_objs[1] = line1;
center[0] = 120;
center[1] = 20;
center[2] = 0.0;
radius = 20;
trim_opts[0] = 0; /*trim
first UFCurve*/
trim_opts[1] = 0; /*trim
second UFCurve*/
theUfSession.Curve.CreateFillet(UF_CURVE_2_CURVE, curve_objs, center,
radius, trim_opts,
arc_opts, out fillet_obj1);
/*create
fillet between "line2" and "line3"*/
Tag fillet_obj2;
curve_objs[0] = line2;
curve_objs[1] = line3;
center[0] = 120;
center[1] = 180;
center[2] = 0.0;
radius = 20;
trim_opts[0] = 0; /*trim
first UFCurve*/
trim_opts[1] = 0; /*trim
second UFCurve*/
theUfSession.Curve.CreateFillet(UF_CURVE_2_CURVE, curve_objs, center,
radius, trim_opts,
arc_opts, out fillet_obj2);
}
}
}

Comments
Post a Comment