iCAx开思工具箱
标题:
UG OPEN API 如何在面所在的边上建3个点,有源码,高手请进来
[打印本页]
作者:
GANXIANLE
时间:
2012-9-29 00:07
标题:
UG OPEN API 如何在面所在的边上建3个点,有源码,高手请进来
请教如何在面的边上建三个点,最好不要是端点
/******************************************************************************
Copyright (c) 2006 Unigraphics Solutions, Inc.
DIMENSITION REPORT
*******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_part.h>
#include <uf_disp.h>
#include <uf_curve.h>
#include <uf_drf.h>
#include <uf_modl.h>
#include <uf_disp.h>
#include <uf_obj.h>
#include <uf_csys.h>
#include <uf_ui_ont.h>
#include <math.h>
#include <uf_so.h>
#include <uf_oper.h>
#include <UF_EVAL.h>
#include <uf_layer.h>
#include <uf_draw.h>
#include <uf_setup.h>
#include <uf_object_types.h>
#include <uf_cam_planes.h>
#include <uf_cam_prefs.h>
#include <uf_view.h>
#include <uf_mtx.h>
#include <time.h>
#include <string.h>
#include "custom.h"
#include <uf_mtx.h>
#include <uf_point.h>
#define gongcha0 0.0001
#define gongcha1 1.0001
#define gongcha2 0.9999
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
if (irc)
{
char messg[133],str[133];
printf("%s, line %d: %s\n", file, line, call);
(UF_get_fail_message(irc, messg)) ?
sprintf(str," returned a %d\n", irc) :
sprintf(str," returned error %d: %s\n", irc, messg);
uc1601(str,1);
}
return(irc);
}
static void do_ugopen_api(void)
{
int type;
int ask_type;
int ask_subtype;
int dis_num1;//选择实体的显示层
int dis_blank;//选择实体的显示层
int layer_status_out;//输出层的状态
int body_num=0 ;
int face_type ;
int face_liexing;
int face_liexing1;//输出
int list_count;
int edges_count;
int curve_type;
double uv_min_max[ 4 ];
double af_parm[ 2 ];
double kongjian_point[ 3 ]={10,20,30};
double face_pnt[ 3 ];
double face_pro_param1[ 2 ];
double face_pro_point1[ 3 ];
double face_pro_unit_norm1[ 3 ];
double face_pro_radii1[ 2 ];
double face_pro_param2[ 2 ];
double face_pro_point2[ 3 ];
double face_pro_unit_norm2[ 3 ];
double face_pro_radii2[ 2 ];
double bounding_box[ 6 ];
double mid_point[ 3 ];
double u1[ 3 ];
double v1[ 3 ];
double u2[ 3 ];
double v2[ 3 ];
double matrix_values[ 9 ];
double z_vec[ 3 ];
double * curve_data;
tag_t face_dis[20000];
tag_t display_part;
tag_t solid= NULL_TAG ;
tag_t point ;
tag_t line;
tag_t wcs_id;
tag_t matrix_id;
uf_list_t * edge_list;
tag_t edge;
tag_t point_feature_id;
UF_CURVE_struct_t * curve_struct;
UF_OBJ_disp_props_t disp_props;
UF_CURVE_line_t line_coords;
display_part=UF_PART_ask_display_part ( );
type = UF_solid_type;
UF_OBJ_cycle_objs_in_part( display_part, type, &solid );
while ( solid != NULL_TAG )
{
UF_CALL(UF_OBJ_cycle_objs_in_part( display_part, type, &solid ));
UF_OBJ_ask_type_and_subtype (solid, &ask_type,&ask_subtype );
UF_OBJ_ask_display_properties (solid, &disp_props );
dis_num1=disp_props.layer;
dis_blank=disp_props.blank_status;
UF_LAYER_ask_status (dis_num1, &layer_status_out );
UF_CURVE_line_t line_coords;
tag_t point;
if( ask_subtype==2 && layer_status_out<=2 && dis_blank==0 ) //面的状态
{
UF_MODL_ask_face_type ( solid, &face_liexing );
UF_MODL_ask_face_edges (solid, &edge_list );//得到面的所有边
UF_MODL_ask_list_count (edge_list, &edges_count );
for ( int i=0;i<edges_count;i++ )
{
UF_MODL_ask_list_item (edge_list, i, &edge );//面的一条边的TAG
//请教如何在面的边上建三个点,最好不要是端点
/*
有哪位高手能够补充下,万分感谢,困惑了好久,也试了不同的方法,有的思路总感觉太复杂了。
*/
//UF_CURVE_ask_curve_struct ( edge, &curve_struct );
// UF_CURVE_ask_curve_struct_data (curve_struct, &curve_type, &curve_data );
// UF_CURVE_free_curve_struct (curve_struct );
}
}
}//do_ugopen_api结束花括号
/*ARGSUSED*/
void ufusr(char *param, int *retcode, int param_len)
{
if (!UF_CALL(UF_initialize()))
{
do_ugopen_api();
UF_CALL(UF_terminate());
}
}
int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
}
作者:
GANXIANLE
时间:
2012-10-17 23:30
自已结贴
欢迎光临 iCAx开思工具箱 (https://t.icax.org/)
Powered by Discuz! X3.3