UF创建直纹面函数
/// <summary>
/// 通过两条曲线创建直纹面
/// </summary>
/// <param name="curve1"></param>
/// <param name="curve2"></param>
/// <returns></returns>
private Tag CreateRuled(Tag curve1, Tag curve2)
{
StringList s_section = new StringList();
theUFSession.Modl.InitStringList(ref s_section);
int aligment = 1;
double[] value = new double[6];
int end_point = 0;
int body_type = 0;
FeatureSigns boolean = FeatureSigns.Nullsign;
double[] tol = new double[3] { 0.001, 0.001, 0.001 };
Tag body_obj_id;
theUFSession.Modl.CreateStringList(2, 2, ref s_section);
s_section.num = 2;
s_section._string[0] = 1;
s_section._string[1] = 1;
s_section.dir[0] = 1;
s_section.dir[1] = -1; //反方向
s_section.id[0] = curve1;
s_section.id[1] = curve2;
StringList s_spine = new StringList();
theUFSession.Modl.InitStringList(ref s_spine);
s_spine.num = 0;
Session theSession = Session.GetSession();
//设置生成的自由曲面为B曲面
theSession.Preferences.Modeling.FreeFormConstructionResult =
NXOpen.Preferences.SessionModeling.FreeFormConstructionResultType.BSurface;
theUFSession.Modl.CreateRuled(ref s_section, ref s_spine, ref aligment, value, ref end_point,
ref body_type, boolean, tol, out body_obj_id);
//设置生成的自由曲面为默认值
theSession.Preferences.Modeling.FreeFormConstructionResult =
NXOpen.Preferences.SessionModeling.FreeFormConstructionResultType.Plane;
return body_obj_id;
}