/*****************************************************************************
**
** edit_boundary_manual_plane.c
**
** Description:
** Contains Unigraphics entry points for the application.
**
** Must have a part file with a CAM setup and a MILL_BND parent
** or a Planar_mill operation that does not have any boundary data
**
*****************************************************************************/
static UF_CAMBND_boundary_data_p_t create_and_init_bnd_data
(
UF_CAM_boundary_type_t type,
int plane_type,
double *origin,
double *matrix,
UF_CAM_material_side_t material_side,
int ignore_holes,
int ignore_islands,
int ignore_chamfers,
UF_CAMBND_app_data_p_t app_data
)
{
UF_CAMBND_boundary_data_p_t bnd_data;
int i, err_code;
sprintf(msg," creating and init bnd_app_data\n");
WRITE(msg);
/* Set flags. */
app_data->has_stock = 1;
app_data->has_tolerances = 0 ;
app_data->has_feedrate = 0 ;
app_data->has_blank_distance = 0;
// if creating this for a GEOM parent app_data->has_tool_position has to be set to 1
app_data->has_tool_position = 0;
if( part_tag != null_tag )
{
/* Get the highlighted/selected objects from Navigation Tool. */
UF_UI_ONT_ask_selected_nodes( &object_count, &objects );
if (object_count > 0)
{
sprintf(msg,"%d ONT objects selected\n",object_count);
WRITE(msg);
entity_count = 0;
while (TRUE)
{
// ************ This is for seclecting faces
UF_UI_select_with_single_dialog(cue_face, title,
UF_UI_SEL_SCOPE_NO_CHANGE, init_proc1, NULL,
&response, &eid, cursor, &view);
if (response == UF_UI_OBJECT_SELECTED)
{
entity_list[entity_count] = eid;
/* Allocate the memory for the boundary data of an item without app data. */
/* NOTE: there is no manual plane selection for faces
/* look at the second argument for create_and_init_bnd_data 1 = automatic */
/* origin and matrix not used */
bnd_data_list[entity_count] =
create_and_init_bnd_data(UF_CAM_boundary_type_closed,
1, origin, matrix,
UF_CAM_material_side_out_right,
0, 0, 0, NULL);
entity_count++;
}
else if (response == UF_UI_OK || response == UF_UI_CANCEL ||
response == UF_UI_BACK)
{
/* Geometry selection is finished. */
break;
}
}
/* Append the face boundaries. */
if (entity_count > 0)
{
for(i=0; i<object_count; i++)
{
UF_OBJ_ask_type_and_subtype(objects[i], &type, &subtype);
/* The object type must be Operation or Geometry Group. */
if( type == UF_machining_operation_type ||
type == UF_machining_geometry_grp_type)
{
for ( j = 0; j < entity_count; j++)
{
UF_CALL(UF_CAMBND_append_bnd_from_face(objects[i],
UF_CAM_part, entity_list[j], bnd_data_list[j]));
}
}
} // end of for(i=0; i<object_count; i++)
} // if (entity_count > 0)
/******* Free the boundary data. *********/
for (i=0; i<entity_count; i++)
{
UF_free(bnd_data_list[i]);
}
entity_count = 0;
/***************** Allow the user to select edges. *****************/
while (TRUE)
{
UF_UI_select_with_single_dialog(cue_edge, title,
UF_UI_SEL_SCOPE_NO_CHANGE, init_proc2, NULL,
&response, &eid, cursor, &view);
if (response == UF_UI_OBJECT_SELECTED)
{
sprintf(msg,"entity tag = %u\n",eid);
WRITE(msg);
entity_list[entity_count] = eid;
app_data_list[entity_count] = create_and_init_bnd_app_data();
entity_count++;
}
else if (response == UF_UI_OK || response == UF_UI_CANCEL ||
response == UF_UI_BACK)
{
/* Geometry selection is finished. */
sprintf(msg,"Geometry selection is finished\n");
WRITE(msg);
break;
}
} // end of while
/* Allocate the memory for the boundary data of an item */
/* NOTE: we are setting plane selection to auto
/* look at the second argument for create_and_init_bnd_data 1 = automatic */
/* origin and matrix not used */
if (entity_count > 0)
{
bnd_data = create_and_init_bnd_data(UF_CAM_boundary_type_open,
1, origin, matrix,
UF_CAM_material_side_out_right,
0, 0, 0, NULL);
sprintf(msg,"object_count is %d\n",object_count);
WRITE(msg);
for(i=0; i<object_count; i++)
{
UF_OBJ_ask_type_and_subtype(objects[i], &type, &subtype);
if( type == UF_machining_operation_type ||
type == UF_machining_geometry_grp_type)
{
UF_CALL(UF_CAMBND_append_bnd_from_curve(objects[i],
UF_CAM_part, entity_count,
entity_list, bnd_data, app_data_list));
}
}
sprintf(msg,"part_item_count is %d\n",part_item_count);
WRITE(msg);
UF_CALL(UF_CAMBND_ask_boundary_data(part_bnd_list[ii],
&boundary_data));
/* the following line is a workaround for PR5159435 */
/* UF_CAMBND_ask_boundary_data not initializing the app_data member */
boundary_data.app_data = NULL;
/* this is where we reset the boundary data for manual plane selection */
/* and fill in the plane origin and matrix */
/* boundary_data.plane_type = 0 ---> this is mauual plane */
boundary_data.plane_type = 0 ;
for (k=0; k<3; k++)
boundary_data.origin[k] = origin[k] ;
for (k=0; k<9; k++)
boundary_data.matrix[k] = matrix[k] ;
첫댓글 자료 감사합니다.