继续努力,互相交流,共同提高,谢谢您的支持---darkhorse
gzxzl wrote:
zzz你好,假如有如下程序,对一打开的prt文件做如下操作;
#include <stdio.h>
#include <uf.h>
#include <uf_curve.h>
#include <uf_modl.h>
#include <uf_part.h>
#include <uf_so.h>
#include <uf_defs.h>
#include <uf_object_types.h>
#include <uf_csys.h>
#include <uf_obj.h>
#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];
printf("%s, line %d, %s\n", file, line, call);
UF_get_fail_message (irc, messg);
printf(" returned a %d\n", irc);
printf(" returned error %d, %s\n", irc, messg);
}
return (irc);
}
static void do_ugopen_api (void)
{
double plane_data[9] = {100.0,0.0,50.0, 100.0,0.0,49.0, 100.0,1.0,50.0};
double vect[3] = {250.0, 0.0, 0.0};
double vect2[3] = {250.0, 50.0, 0.0};
int curr_part,num_parts,count_1;
tag_t part_tag, block_tag, plane_tag;
tag_t objects[1], planes[1];
tag_t section_curves_feature, *section_curves;
tag_t feature;
const logical flip = TRUE;
int num_section_curves, type;
UF_CURVE_section_general_data_t general_data;
UF_CURVE_section_planes_data_t planes_data;
UF_CURVE_section_parallel_data_t parallel_data;
char *part_name = "section_curves";
char *edge_lens[3] = {"300.0","25.0","150.0"};
在此应获得block_tag的值(也就是打开的part中的值),我不知如何处理,请大侠帮助解决?
int type, subtype;
part_tag = UF_PART_ask_display_part();
block_tag = NULL_TAG;
UF_OBJ_cycle_objs_in_part(part_tag, UF_solid_type, [$block_tag)]
while(block_tag)
{
UF_OBJ_ask_type_and_subtype(block_tag, [$type, &subtype)]
if(subtype == UF_solid_body_subtype)
{
break;
}
UF_OBJ_cycle_objs_in_part(part_tag, UF_solid_type, [$block_tag)]
} objects[0] = block_tag;
FTN(uf5374) (&plane_data[0], &plane_data[3], &plane_data[6],
[$plane_tag)]
planes[0] = plane_tag;
general_data.associate = 1;
general_data.objects = objects;
general_data.num_objects = 1;
general_data.grouping = 0;
general_data.join_type = 0;
general_data.tolerance = 0.0254;
planes_data.planes = planes;
planes_data.num_planes = 1;
UF_CALL (UF_CURVE_section_from_planes (&general_data, &planes_data,
[$section_curves_feature))]
printf (" section curves feature tag is %d\n", section_curves_feature);
parallel_data.base_plane = plane_tag;
parallel_data.step_distance = 3.0;
parallel_data.start_distance = 0.0;
parallel_data.end_distance = 10.0;
UF_CALL (UF_CURVE_section_from_parallel_planes ([$general_data, [$para]]llel_data,
[$section_curves_feature))]
UF_CALL (UF_CURVE_ask_feature_curves (section_curves_feature,
[$num_section_curves, §ion_curves))]
UF_free (section_curves);
}
void ufusr (char *param, int *retcode, int paramLen)
{
if (!UF_CALL(UF_initialize()))
{
do_ugopen_api();
UF_CALL(UF_terminate());
}
}
int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
} |