大家好,今天继续介绍我们的通用方法系列。
下面是今天的通用方法:
(1)这个通用方法为获取平面矢量
/// <summary>
/// 获取平面矢量
/// </summary>
/// <param name="c"></param>
/// <returns></returns>
public static double[] GetVector(Tag c)//获取平面矢量
{
double[] point = new double[3];
double[] dir = new double[3];
double[] box = new double[6];
double radius;
double raddata;
int normdir;
int type2;
theUFSession.Modl.AskFaceData(c, out type2, point, dir, box, out radius, out raddata, out normdir);
return dir;
}
(2)这个通用方法为判断是螺纹孔
Public void JudgeThreadHole()
{
NXOpen.Features.FeatureCollection featureCollection = workPart.Features;
NXOpen.Features.Feature[] baseParts = featureCollection.ToArray();
for (int i = 0; i < baseParts.Length; i++)
{
if (baseParts[i].FeatureType == "HOLE PACKAGE")
{
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType. Information, "是螺纹孔");
}
}
}
(3)这个通用方法为创建直线
Public void CreateLine()
{
UFCurve.Line line1 = new UFCurve.Line();
line1.start_point = new double[3];
line1.end_point = new double[3];
line1.start_point[0] = point3.X;
line1.start_point[1] = point3.Y;
line1.start_point[2] = point3.Z + 5;
line1.end_point[0] = point3.X + 10;
line1.end_point[1] = point3.Y;
line1.end_point[2] = point3.Z + 5;
Tag line1tag;
theUFSession.Curve.CreateLine(ref line1, out line1tag);
}
今天要介绍的通用方法就这么多,我们下篇文章再见。