/****************************************************************************** Copyright (c) 1999 Unigraphics Solutions, Inc. Unpublished - All Rights Reserved *******************************************************************************/ /* The following example sets the material type, scale, and angle for all Area Fills in the part. */ #include #include #include #include #include #include #include #include #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(); }