NX二次开发源码分享:显示面的法相方向
经常能用的到,通过选择面,显示临时法线方向和点!
static bool DisplayNormal(Face theFace)
{
double[] param = new double;
double[] p1 = new double;
double[] u1 = new double;
double[] v1 = new double;
double[] u2 = new double;
double[] v2 = new double;
double[] unit_norm = new double;
double[] radii = new double;
double[] uv_min_max = new double;
theUFSession.Modl.AskFaceUvMinmax(theFace.Tag, uv_min_max);
param = (uv_min_max+uv_min_max) / 2;
param = (uv_min_max+uv_min_max) / 2;
theUFSession.Modl.AskFaceProps(theFace.Tag, param, p1, u1, v1, u2, v2, unit_norm, radii);
DisplayTemporaryPoint(p1);
DisplayConehead(p1, unit_norm);
return true;
}
static void DisplayTemporaryPoint(Double[] loc)
{
UFObj.DispProps color = new UFObj.DispProps();
color.color = 6;
theUFSession.Disp.DisplayTemporaryPoint(Tag.Null, UFDisp.ViewType.UseWorkView,
loc, ref color, UFDisp.PolyMarker.FilledCircle);
}
static void DisplayConehead(Double[] loc, Double[] dir)
{
theUFSession.Disp.Conehead(UFConstants.UF_DISP_WORK_VIEW_ONLY, loc, dir, 0);
}
如果使用ufun的函数基本如下:
//获取面的uv极值
int UF_MODL_ask_face_uv_minmax
(
tag_t face_tag,
double uv_min_max [ 4 ]
)
//获取位置点信息--double param [ 2 ] 的输入就是上一步的输出
int UF_MODL_ask_face_props
(
tag_t face_id,
double param [ 2 ] ,
double point [ 3 ] ,
double u1 [ 3 ] ,
double v1 [ 3 ] ,
double u2 [ 3 ] ,
double v2 [ 3 ] ,
double unit_norm [ 3 ] ,
double radii [ 2 ]
)
//将点输入到显示临时的函数中
int UF_DISP_display_temporary_point
(
tag_t view_tag,
UF_DISP_view_type_t which_views,
double markerpos [ 3 ] ,
UF_OBJ_disp_props_t * color,
UF_DISP_poly_marker_t marker_type
)
//显示
void UF_DISP_conehead
(
int display_flag,
double coord [ 3 ] ,
double vector [ 3 ] ,
int anchor_flag
)
页:
[1]