购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_DRF_set_areafill_material( tag_t areafill_id, UF_DRF_valid_material_t material) 函数说明:
为指定的区域填充对象的区域的填充材料。该地区填充材料型结构,UF_DRF_valid_material_t定义的材料的类型。
函数参数:
第1个参数为输入:
areafill_id代表参数变量,tag_t 为输入参数类型,区域填充对象标识符
第2个参数为输入:
material代表参数变量,UF_DRF_valid_material_t 为输入参数类型,区域填充材料类型
UF_DRF_set_areafill_material函数实例代码演示:
下面的示例设置材料类型,规模和角度对所有区域填充的一部分。
[quote]
#include <stdio.h>
#include <string.h>
#include <uft.h>
#include <uf.h>
#include <uf_drf.h>
#include <uf_obj.h>
#include <uf_part.h>
#include <uf_object_types.h>
#define PI 3.14159265358979324
static int rmDraftingAid = UF_drafting_entity_type;
static char *areafill_matl_name[] = {
"Cork/Felt/Fiber",
"Sound Insulation",
"Concrete",
"Earth",
"Rock",
"Sand",
"Liquids",
"Wood - Across Grain",
"Wood - With Grain"};
void ufusr(char *param, int *retcod, int param_len)
{
UF_DRF_areafill_t areafill_data;
UF_PART_load_status_t open_status;
tag_t part_tag;
tag_t areafill_id;
int error;
char part_name[133];
char message[133];
UF_initialize();
/* retrieve the part containing Area Fill objects */
strcpy(part_name, "areafill.prt");
error = UF_PART_open(part_name, &part_tag, &open_status);
if (error)
{
UF_get_fail_message(error, message);
printf("*ERROR (UF_PART_open) %d: Invalid Part Retrieval,
%s\n", error, message);
}
else
{
/* find first drafting aid entity */
areafill_id = NULL_TAG;
FTN(uf5201)(&areafill_id, &rmDraftingAid);
while (areafill_id)
{
/* extract areafill data: material, scale, angle */
error = UF_DRF_ask_areafill_data(areafill_id,
&areafill_data);
if (error)
{
UF_get_fail_message(error, message);
printf("*ERROR %d: Area Fill ask, %s\n", error,
message);
}
else
{
/* change material, scale, and angle */
areafill_data.material = (UF_DRF_valid_material_t)
((int) areafill_data.material + 1);
areafill_data.scale = areafill_data.scale * 2.0;
areafill_data.angle = areafill_data.angle + PI;
error = UF_DRF_set_areafill_material(areafill_id,
areafill_data.material);
if (!error) error =
UF_DRF_set_areafill_scale(areafill_id, areafill_data.scale);
if (!error) error =
UF_DRF_set_areafill_angle(areafill_id, areafill_data.angle);
if (error)
{
UF_get_fail_message(error, message);
printf("*ERROR %d: Area Fill set, %s\n", error,
message);
}
/* list the material, scale, and angle in degrees */
printf("Material = %s\n",
areafill_matl_name[areafill_data.material - 1]);
printf(" Scale = %.2f\n", areafill_data.scale);
printf(" Angle = %.2f\n", areafill_data.angle *
RADEG);
}
/* find next drafting aid entity */
FTN(uf5201)(&areafill_id, &rmDraftingAid);
}
}
/* save the test part */
if (!error)
{
error = UF_PART_save();
if (error)
{
UF_get_fail_message(error, message);
printf("*ERROR (UF_PART_save) %d: Invalid Part Save,
%s\n", error, message);
}
}
UF_terminate();
}
[/quote]