/* Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved. */ #include <ProToolkit.h> #include <ProMdl.h> #include <ProArray.h> #include <ProModelitem.h> #include <ProImportfeat.h> #include <ProToolkitDll.h> /* for ProArgument */ #include <ProWstring.h> #include <UtilString.h> #include <ProUtil.h> /*--------------------------------------------------------------------*\ Prototypes \*--------------------------------------------------------------------*/ ProIntfData* PTTestPrismCreate (double x_value, double y_value, double z_value, ProSolid solid); ProIntfData* PTTestSphereCreate (double, ProMdl); typedef enum { USER_IMPFEATOPT_PRISM, USER_IMPFEATOPT_SPHERE } UserImpfeatopt; typedef struct { double length; double width; double height; } UserPrismdata; typedef struct { double radius; } UserSpheredata; typedef struct { UserImpfeatopt type; union { UserPrismdata prism; UserSpheredata sphere; } dims; ProCsys csys; ProImportfeatAttr attr; } UserImportfeatOption; int UserImportfeatOptionsGet (UserImportfeatOption** options) { UserImportfeatOption* tmp_opt; UserImportfeatOption* opt; /* tmp */ ProArrayAlloc (3, sizeof (UserImportfeatOption), 1, (ProArray*)&tmp_opt); opt = &tmp_opt [0]; opt->type = USER_IMPFEATOPT_PRISM; opt->dims.prism.height = 20; opt->dims.prism.length = 30; opt->dims.prism.width = 40; opt->csys = NULL; opt->attr.join_surfaces = 1; opt->attr.attempt_make_solid = 1; opt->attr.cut_or_add = 0; opt->attr.add_bodies = 0; opt->attr.body_use_opt = PRO_IMPORT_BODY_USE_DEFAULT; opt->attr.body_arr = NULL; opt = &tmp_opt[1]; opt->type = USER_IMPFEATOPT_PRISM; opt->dims.prism.height = -10; opt->dims.prism.length = -20; opt->dims.prism.width = 30; opt->csys = NULL; opt->attr.join_surfaces = 0; opt->attr.attempt_make_solid = 0; opt->attr.cut_or_add = 0; opt->attr.add_bodies = 0; opt->attr.body_use_opt = PRO_IMPORT_BODY_USE_DEFAULT; opt->attr.body_arr = NULL; opt = &tmp_opt [2]; opt->type = USER_IMPFEATOPT_SPHERE; opt->dims.sphere.radius = 22.5; opt->csys = NULL; opt->attr.join_surfaces = 1; opt->attr.attempt_make_solid = 1; opt->attr.cut_or_add = 1; opt->attr.add_bodies = 0; opt->attr.body_use_opt = PRO_IMPORT_BODY_USE_DEFAULT; opt->attr.body_arr = NULL; *options = tmp_opt; return PRO_TK_NO_ERROR; } ProError UserArgumentByLabelGet (ProArgument* args, ProName name, ProValueData* data) { int size, i; ProError status; status = ProArraySizeGet (args, &size); if (status != PRO_TK_NO_ERROR) return PRO_TK_INVALID_TYPE; for (i = 0; i < size; i++) { status = ProUtilWstrcmp (args [i].label, name); if (status == 0) { *data = args [i].value; return PRO_TK_NO_ERROR; } } return PRO_TK_E_NOT_FOUND; } /* The following example function demonstrates how to set up and implement a Pro/TOOLKIT task function accessible from other Pro/ENGINEER auxiliary applications. It uses the required signature and macro for task functions. It parses the input argument array searching for parameters required by the task. */ /*====================================================================*\ FUNCTION: UserCreateImpfeatTask PURPOSE: Example task function in a Pro/TOOLKIT DLL \*====================================================================*/ PRO_TK_DLL_EXPORT ProError UserCreateImpfeatTask (ProArgument* inputs, ProArgument** outputs) { ProError status; ProSolid solid; ProArgument arg; ProValueData data; UserImpfeatopt type; ProMdlType model_type; ProIntfData *interface_data; ProImportfeatAttr attr; ProCsys csys = NULL; ProIntfDataSource data_source; ProFeature feature; ProSelection sel; attr.join_surfaces = PRO_B_TRUE; attr.attempt_make_solid = PRO_B_TRUE; attr.cut_or_add = PRO_B_FALSE; attr.add_bodies = 0; attr.body_use_opt = PRO_IMPORT_BODY_USE_DEFAULT; attr.body_arr = NULL; status = ProMdlCurrentGet ((ProMdl*)&solid); if (status != PRO_TK_NO_ERROR) return PRO_TK_BAD_CONTEXT; status = ProMdlTypeGet (solid, &model_type); if (model_type != PRO_MDL_PART) return PRO_TK_INVALID_TYPE; /*--------------------------------------------------------------------*\ Look up required input arguments (by name) \*--------------------------------------------------------------------*/ /* status = ProArgumentByLabelGet (inputs, L"IMPGEOMTYPE", &data);*/ status = UserArgumentByLabelGet (inputs, L"IMPGEOMTYPE", &data); if (status != PRO_TK_NO_ERROR) return PRO_TK_EMPTY; type = (UserImpfeatopt)data.v.i; switch (type) { case USER_IMPFEATOPT_PRISM: { double length, width, height; /* Characteristic inputs: L, W, H */ /* status = ProArgumentByLabelGet (inputs, L"LENGTH", &data); */ status = UserArgumentByLabelGet (inputs, L"LENGTH", &data); if (status != PRO_TK_NO_ERROR) return PRO_TK_BAD_INPUTS; length = data.v.d; /* status = ProArgumentByLabelGet (inputs, L"WIDTH", &data); */ status = UserArgumentByLabelGet (inputs, L"WIDTH", &data); if (status != PRO_TK_NO_ERROR) return PRO_TK_BAD_INPUTS; width = data.v.d; /* status = ProArgumentByLabelGet (inputs, L"HEIGHT", &data); */ status = UserArgumentByLabelGet (inputs, L"HEIGHT", &data); if (status != PRO_TK_NO_ERROR) return PRO_TK_BAD_INPUTS; height = data.v.d; /*--------------------------------------------------------------------*\ Create interface data describing a rectangular prism with given dimensions \*--------------------------------------------------------------------*/ interface_data = PTTestPrismCreate (length, width, height, solid); break; } case USER_IMPFEATOPT_SPHERE: { double radius; /* status = ProArgumentByLabelGet (inputs, L"RADIUS", &data); */ status = UserArgumentByLabelGet (inputs, L"RADIUS", &data); if (status != PRO_TK_NO_ERROR) return PRO_TK_BAD_INPUTS; radius = data.v.d; /*--------------------------------------------------------------------*\ Create interface data describing a spherical boundary with given dimension \*--------------------------------------------------------------------*/ interface_data = PTTestSphereCreate (radius, solid); break; } } /*--------------------------------------------------------------------*\ Look up coordinate system (optional argument to this task) \*--------------------------------------------------------------------*/ /* status = ProArgumentByLabelGet (inputs, L"CSYS", &data); */ status = UserArgumentByLabelGet (inputs, L"CSYS", &data); if (status == PRO_TK_NO_ERROR) { ProSelection sel; ProModelitem item; sel = data.v.r; ProSelectionModelitemGet (sel, &item); ProGeomitemToCsys (&item, &csys); } /*--------------------------------------------------------------------*\ Look for cut flag \*--------------------------------------------------------------------*/ /* status = ProArgumentByLabelGet (inputs, L"CUT", &data); */ status = UserArgumentByLabelGet (inputs, L"CUT", &data); if (status == PRO_TK_NO_ERROR) { if (data.v.b) attr.cut_or_add = 1; } /*--------------------------------------------------------------------*\ Create import feature with parameters \*--------------------------------------------------------------------*/ status = ProIntfDataSourceInit (PRO_INTF_NEUTRAL, interface_data, &data_source); status = ProImportfeatCreate ( solid, &data_source, csys, &attr, &feature); if (status != PRO_TK_NO_ERROR) return PRO_TK_GENERAL_ERROR; /* status = ProArgumentByLabelGet (inputs, L"NAME", &data); */ status = UserArgumentByLabelGet (inputs, L"NAME", &data); if (status == PRO_TK_NO_ERROR) { ProModelitemNameSet (&feature, data.v.w); } /*--------------------------------------------------------------------*\ Note that function does not free input arguments (memory belongs to calling application) \*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*\ Send output arguments containing selection of created feature \*--------------------------------------------------------------------*/ status = ProArrayAlloc (0, sizeof (ProArgument), 1, (ProArray*)outputs); if (status == PRO_TK_NO_ERROR) { ProSelectionAlloc (NULL, &feature, &sel); ProStringToWstring (arg.label, "NEW_FEATURE"); arg.value.type = PRO_VALUE_TYPE_SELECTION; arg.value.v.r = sel; ProArrayObjectAdd( (ProArray*)outputs, -1, 1, &arg ); return PRO_TK_NO_ERROR; } else return PRO_TK_GENERAL_ERROR; } int UserCreateImportFeatures() { int status; ProName proname, model_proname; ProMdlType type; char name[100]; ProIntfData *interface_data; ProIntfDataSource data_source; ProFeature feature_1, feature_2, feature_3; ProImportfeatRedefSource redefine_source; ProMdl solid; UserImportfeatOption* options; int i_opt; UserImportfeatOption opt; status = ProMdlCurrentGet (&solid); if (status != PRO_TK_NO_ERROR) return PRO_TK_BAD_CONTEXT; status = ProMdlTypeGet (solid, &type); if (type != PRO_MDL_PART) return PRO_TK_INVALID_TYPE; UserImportfeatOptionsGet (&options); for (i_opt = 0; i_opt < 3; i_opt ++) { opt = options [i_opt]; if (opt.type == USER_IMPFEATOPT_PRISM) { /*-------------------------------------------------- Creating the import feature: Prism of Size:40x30x20 ---------------------------------------------------*/ interface_data = PTTestPrismCreate (opt.dims.prism.length, opt.dims.prism.width, opt.dims.prism.height, solid); } if (opt.type == USER_IMPFEATOPT_SPHERE) { interface_data = PTTestSphereCreate (opt.dims.sphere.radius, solid); } status = ProIntfDataSourceInit (PRO_INTF_NEUTRAL, interface_data, &data_source); ProTKPrintf ("status of ProIntfDataSourceInit is %d \n", status); status = ProImportfeatCreate ( solid, &data_source, opt.csys, &opt.attr, &feature_2); ProTKPrintf ("status of ProImportfeatCreate is %d \n", status); } return (PRO_TK_NO_ERROR); } ProIntfData* PTTestSphereCreate (double rad, ProMdl solid) { ProSrftype surface_type; ProUvParam uvsurf_min, uvsurf_max; ProSurfaceOrient surf_orient; ProSurfaceshapedata shape_data; int surf_id; ProSurfacedata surface_data; ProVector vector1, vector2, vector3; ProVector vector_1, vector_2, vector_3, origin; double radius, radius1, radius2; ProIntfData *interfacedata; ProCurvedata *curve_data; ProEdgedata *edge_data; ProFeature feature; int status; int i, edge_id, surface_id[2]; ProEdgeDir edge_dir[2]; ProUvParam (*edge_uvpt)[2]; Pro3dPnt point1, point2; int num_edges; double start_angle, end_angle; ProContourdata *contour, *array_contours; ProContourTraversal traversal; int *array_edge_ids; ProIntfDataSource data_source; ProFeature feature_1; /* double PI = 3.141593; */ ProUvParam (*array_uv_points)[2]; status = ProIntfDataAlloc( &interfacedata); ProTKPrintf ("status ofmProIntfDataAlloc is %d \n", status); status = ProEdgedataAlloc (&edge_data); ProTKPrintf ("status of ProEdgedataAlloc is %d \n", status); /*------ Edge-1 ------*/ edge_id = 1; surface_id[0] = 100, surface_id[1] = 101; edge_dir[0] = 0, edge_dir[1] = 1; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); vector_1[0]= 0.0, vector_1[1]= -1.0, vector_1[2]=0.0; vector_2[0]= 1.0, vector_2[1]= 0.0, vector_2[2] =0.0; origin[0] = 0.0, origin[1] = 0.0, origin[2] =0.0; start_angle = 0.0; end_angle = 3.1451593; radius = rad; status = ProArcdataInit ( vector_1, vector_2, origin, start_angle, end_angle, radius, curve_data); ProTKPrintf ("status of ProArcdataInit is %d \n", status); status = ProArrayAlloc (23, (sizeof (ProUvParam) * 2), 1, (ProArray *) &array_uv_points); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); for (i=0; i<23; i++) { array_uv_points[i][0][0] = -1 * PI; array_uv_points[i][0][1] = PI * 0.5 *(1 - i/11); array_uv_points[i][1][0] = -1 * PI; array_uv_points[i][1][1] = array_uv_points[i][0][1]; } status = ProEdgedataInit ( edge_id, surface_id, edge_dir, array_uv_points, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-2 ------*/ edge_id = 2; surface_id[0] = 100, surface_id[1] = 101; edge_dir[0] = 1, edge_dir[1] = 0; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); vector_1[0]= 0.0, vector_1[1]= -1.0, vector_1[2] =0.0; vector_2[0]= -1.0, vector_2[1]= 0.0, vector_2[2] =0.0; origin[0] = 0.0, origin[1] = 0.0, origin[2] =0.0; start_angle = 0.0; end_angle = 3.1451593; radius = rad; status = ProArcdataInit ( vector_1, vector_2, origin, start_angle, end_angle, radius, curve_data); ProTKPrintf ("status of ProArcdataInit is %d \n", status); status = ProArrayAlloc (23, (sizeof (ProUvParam) * 2), 1, (ProArray *) &array_uv_points); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); for (i=0; i<23; i++) { array_uv_points[i][0][0] = -2 * PI; array_uv_points[i][0][1] = PI * 0.5 * (1 - i/11); array_uv_points[i][1][0] = 0; array_uv_points[i][1][1] = array_uv_points[i][0][1]; } status = ProEdgedataInit ( edge_id, surface_id, edge_dir, array_uv_points, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*----------------------- Surface -1 -----------------------*/ surface_type = PRO_SRF_TORUS; uvsurf_min[0] = -3.204425, uvsurf_min[1] = -1.570796; uvsurf_max[0] = 0.062832, uvsurf_max[1]= 1.570796; surf_orient = 1; vector1[0] = -1.0, vector1[1]= 0.0, vector1[2] =0.0; vector2[0] = 0.0, vector2[1]= 0.0, vector2[2] =-1.0; vector3[0] = 0.0, vector3[1]= -1.0, vector3[2] =0.0; origin[0] = 0.0, origin[1]= 0.0, origin[2] = 0.0; radius1 = 0.0; radius2 = rad; status = ProTorusdataInit (vector1, vector2, vector3, origin, radius1, radius2, &shape_data); ProTKPrintf ("status of ProPlanedataInit is %d \n", status); surf_id = 101; status = ProArrayAlloc (2, sizeof(int), 1, (ProArray *) &array_edge_ids); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); array_edge_ids[0]= 1, array_edge_ids[1] = 2; status = ProArrayAlloc (1, sizeof (ProContourdata), 1, (ProArray *) &array_contours); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); status = ProContourdataAlloc (&contour); ProTKPrintf ("status of ProContourdataAlloc is %d \n", status); traversal = 1; status = ProContourdataInit ( traversal, contour); ProTKPrintf ("status of ProContourdataInit is %d \n", status); status = ProContourdataEdgeIdArraySet (contour, array_edge_ids); ProTKPrintf ("status of ProContourdataEdgeIdArraySet is %d \n", status); array_contours[0] = *contour; status = ProSurfacedataInit (surface_type, uvsurf_min, uvsurf_max, surf_orient, &shape_data, surf_id, &surface_data); ProTKPrintf ("status of ProSurfacedataInit is %d \n", status); status = ProSurfacedataContourArraySet (&surface_data, array_contours); ProTKPrintf ("status of ProSurfacedataContourArraySet is %d \n", status); status = ProIntfDataSurfaceAppend (interfacedata, &surface_data); ProTKPrintf ("status of ProIntfDataSurfaceAppend is %d \n", status); /*----------------------- Surface -2 -----------------------*/ surface_type = PRO_SRF_TORUS; uvsurf_min[0] = -6.346017, uvsurf_min[1] = -1.570796; uvsurf_max[0] = -3.078761, uvsurf_max[1]= 1.570796; surf_orient = 1; vector1[0] = -1.0, vector1[1]= 0.0, vector1[2] =0.0; vector2[0] = 0.0, vector2[1]= 0.0, vector2[2] =-1.0; vector3[0] = 0.0, vector3[1]= -1.0, vector3[2] =0.0; origin[0] = 0.0, origin[1]= 0.0, origin[2] = 0.0; radius1 = 0.0; radius2 = rad; status = ProTorusdataInit (vector1, vector2, vector3, origin, radius1, radius2, &shape_data); ProTKPrintf ("status of ProPlanedataInit is %d \n", status); surf_id = 102; status = ProArrayAlloc (2, sizeof(int), 1, (ProArray *) &array_edge_ids); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); array_edge_ids[0]= 1, array_edge_ids[1] = 2; status = ProArrayAlloc (1, sizeof (ProContourdata), 1, (ProArray *) &array_contours); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); status = ProContourdataAlloc (&contour); ProTKPrintf ("status of ProContourdataAlloc is %d \n", status); traversal = 1; status = ProContourdataInit ( traversal, contour); ProTKPrintf ("status of ProContourdataInit is %d \n", status); status = ProContourdataEdgeIdArraySet (contour, array_edge_ids); ProTKPrintf ("status of ProContourdataEdgeIdArraySet is %d \n", status); array_contours[0] = *contour; status = ProSurfacedataInit (surface_type, uvsurf_min, uvsurf_max, surf_orient, &shape_data, surf_id, &surface_data); ProTKPrintf ("status of ProSurfacedataInit is %d \n", status); status = ProSurfacedataContourArraySet (&surface_data, array_contours); ProTKPrintf ("status of ProSurfacedataContourArraySet is %d \n", status); status = ProIntfDataSurfaceAppend (interfacedata, &surface_data); ProTKPrintf ("status of ProIntfDataSurfaceAppend is %d \n", status); return ( interfacedata); } ProIntfData* PTTestPrismCreate (double x_value, double y_value, double z_value, ProSolid solid) { ProSrftype surface_type; ProUvParam uvsurf_min, uvsurf_max; ProSurfaceOrient surf_orient; ProSurfaceshapedata shape_data; int surf_id; ProSurfacedata surface_data; ProVector vector1, vector2, vector3, origin; ProContourdata *contour, *array_contours; ProContourTraversal traversal; int *array_edge_ids; int edge_id, surface_id[2]; ProEdgeDir edge_dir[2]; ProUvParam (*edge_uvpt)[2]; Pro3dPnt point1, point2; int num_edges; ProIntfData *interfacedata; ProCurvedata *curve_data; ProEdgedata *edge_data; ProFeature feature; int status; status = ProIntfDataAlloc( &interfacedata); ProTKPrintf ("status ofmProIntfDataAlloc is %d \n", status); status = ProEdgedataAlloc (&edge_data); ProTKPrintf ("status of ProEdgedataAlloc is %d \n", status); /*------ Edge-1 ------*/ edge_id = 1; surface_id[0] = 1, surface_id[1] = 2; edge_dir[0] = 0, edge_dir[1] = 1; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = 0.0, point1[1] = 0.0, point1[2] = 0.0; point2[0] = x_value, point2[1] = 0.0, point2[2] =0.0; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-2 ------*/ edge_id = 2; surface_id[0] = 1, surface_id[1] = 5; edge_dir[0] = 0, edge_dir[1] = 1; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = x_value, point1[1] = 0.0, point1[2] = 0.0; point2[0] = x_value, point2[1] = y_value, point2[2] =0.0; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-3 ------*/ edge_id = 3; surface_id[0] = 1, surface_id[1] = 4; edge_dir[0] = 0, edge_dir[1] = 1; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = x_value, point1[1] = y_value, point1[2] = 0.0; point2[0] = 0.0, point2[1] = y_value, point2[2] = 0.0; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-4 ------*/ edge_id = 4; surface_id[0] = 1, surface_id[1] = 3; edge_dir[0] = 0, edge_dir[1] = 1; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = 0.0, point1[1] = y_value, point1[2] = 0.0; point2[0] = 0.0, point2[1] = 0.0, point2[2] = 0.0; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-5 ------*/ edge_id = 5; surface_id[0] = 6, surface_id[1] = 2; edge_dir[0] = 1, edge_dir[1] = 0; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = 0.0, point1[1] = 0.0, point1[2] = z_value; point2[0] = x_value, point2[1] = 0.0, point2[2] =z_value; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-6 ------*/ edge_id = 6; surface_id[0] = 6, surface_id[1] = 5; edge_dir[0] = 1, edge_dir[1] = 0; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = x_value, point1[1] = 0.0, point1[2] = z_value; point2[0] = x_value, point2[1] = y_value, point2[2] =z_value; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-7 ------*/ edge_id = 7; surface_id[0] = 6, surface_id[1] = 4; edge_dir[0] = 1, edge_dir[1] = 0; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = x_value, point1[1] = y_value, point1[2] = z_value; point2[0] = 0.0, point2[1] = y_value, point2[2] =z_value; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-8 ------*/ edge_id = 8; surface_id[0] = 6, surface_id[1] = 3; edge_dir[0] = 1, edge_dir[1] = 0; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = 0.0, point1[1] = y_value, point1[2] = z_value; point2[0] = 0.0, point2[1] = 0.0, point2[2] =z_value; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-9 ------*/ edge_id = 9; surface_id[0] = 2, surface_id[1] = 3; edge_dir[0] = 0, edge_dir[1] = 1; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = 0.0, point1[1] = 0.0, point1[2] = 0.0; point2[0] = 0.0, point2[1] = 0.0, point2[2] =z_value; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-10 ------*/ edge_id = 10; surface_id[0] = 5, surface_id[1] = 2; edge_dir[0] = 0, edge_dir[1] = 1; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = x_value, point1[1] = 0.0, point1[2] = 0.0; point2[0] = x_value, point2[1] = 0.0, point2[2] = z_value; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-11 ------*/ edge_id = 11; surface_id[0] = 4, surface_id[1] = 5; edge_dir[0] = 0, edge_dir[1] = 1; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = x_value, point1[1] = y_value, point1[2] = 0.0; point2[0] = x_value, point2[1] = y_value, point2[2] = z_value; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*------ Edge-12 ------*/ edge_id = 12; surface_id[0] = 3, surface_id[1] = 4; edge_dir[0] = 0, edge_dir[1] = 1; status = ProCurvedataAlloc (&curve_data); ProTKPrintf ("status of ProCurvedataAlloc is %d \n", status); point1[0] = 0.0, point1[1] = y_value, point1[2] = 0.0; point2[0] = 0.0, point2[1] = y_value, point2[2] = z_value; status = ProLinedataInit (point1, point2, curve_data); ProTKPrintf ("status of ProLinedataInit is %d \n", status); status = ProEdgedataInit ( edge_id, surface_id, edge_dir, NULL, NULL, curve_data, edge_data); ProTKPrintf ("status of ProEdgedataInit is %d \n", status); status = ProIntfDataEdgeAppend (interfacedata, edge_data); ProTKPrintf ("status of ProIntfDataEdgeAppend is %d \n", status); status = ProCurvedataFree ( curve_data); ProTKPrintf ("status of ProCurvedataFree is %d \n", status); /*----------------------- Surface -1 -----------------------*/ surface_type = PRO_SRF_PLANE; uvsurf_min[0] = 0 , uvsurf_min[1] = 0; /*-- 1--*/ /* uvsurf_max[0] = x_value, uvsurf_max[1]= y_value; */ uvsurf_max[0] = 0, uvsurf_max[1]= 0; surf_orient = -1; vector1[0] = 1.0, vector1[1]= 0.0, vector1[2] =0.0; vector2[0] = 0.0, vector2[1]= 1.0, vector2[2] =0.0; vector3[0] = 0.0, vector3[1]= 0.0, vector3[2] =1.0; origin[0] = 0.0, origin[1]=0.0, origin[2] = 0.0; status = ProPlanedataInit (vector1, vector2, vector3, origin, &shape_data); ProTKPrintf ("status of ProPlanedataInit is %d \n", status); surf_id = 1; status = ProArrayAlloc (4, sizeof(int), 1, (ProArray *) &array_edge_ids); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); array_edge_ids[0]= 1, array_edge_ids[1] = 2, array_edge_ids[2] =3, array_edge_ids[3]=4; status = ProArrayAlloc (1, sizeof (ProContourdata), 1, (ProArray *) &array_contours); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); status = ProContourdataAlloc (&contour); ProTKPrintf ("status of ProContourdataAlloc is %d \n", status); traversal = 1; status = ProContourdataInit ( traversal, contour); ProTKPrintf ("status of ProContourdataInit is %d \n", status); status = ProContourdataEdgeIdArraySet (contour, array_edge_ids); ProTKPrintf ("status of ProContourdataEdgeIdArraySet is %d \n", status); array_contours[0] = *contour; status = ProSurfacedataInit (surface_type, uvsurf_min, uvsurf_max, surf_orient, &shape_data, surf_id, &surface_data); ProTKPrintf ("status of ProSurfacedataInit is %d \n", status); status = ProSurfacedataContourArraySet (&surface_data, array_contours); ProTKPrintf ("status of ProSurfacedataContourArraySet is %d \n", status); status = ProIntfDataSurfaceAppend (interfacedata, &surface_data); ProTKPrintf ("status of ProIntfDataSurfaceAppend is %d \n", status); /*----------------------- Surface -2 -----------------------*/ surface_type = PRO_SRF_PLANE; uvsurf_min[0] = 0, uvsurf_min[1] = 0; /* uvsurf_max[0] = x_value, uvsurf_max[1]= y_value; */ uvsurf_max[0] = 0, uvsurf_max[1]= 0; surf_orient = 1; vector1[0] = 1.0, vector1[1]= 0.0, vector1[2] =0.0; vector2[0] = 0.0, vector2[1]= 0.0, vector2[2] =1.0; vector3[0] = 0.0, vector3[1]= -1.0, vector3[2] =0.0; origin[0] = 0.0, origin[1]=0.0, origin[2] = 0.0; status = ProPlanedataInit (vector1, vector2, vector3, origin, &shape_data); ProTKPrintf ("status of ProPlanedataInit is %d \n", status); surf_id = 2; status = ProArrayAlloc (4, sizeof(int), 1, (ProArray *) &array_edge_ids); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); array_edge_ids[0]= 1, array_edge_ids[1] = 9, array_edge_ids[2] =5, array_edge_ids[3]=10; status = ProArrayAlloc (1, sizeof (ProContourdata), 1, (ProArray *) &array_contours); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); status = ProContourdataAlloc (&contour); ProTKPrintf ("status of ProContourdataAlloc is %d \n", status); traversal = 1; status = ProContourdataInit ( traversal, contour); ProTKPrintf ("status of ProContourdataInit is %d \n", status); status = ProContourdataEdgeIdArraySet (contour, array_edge_ids); ProTKPrintf ("status of ProContourdataEdgeIdArraySet is %d \n", status); array_contours[0] = *contour; status = ProSurfacedataInit (surface_type, uvsurf_min, uvsurf_max, surf_orient, &shape_data, surf_id, &surface_data); ProTKPrintf ("status of ProSurfacedataInit is %d \n", status); status = ProSurfacedataContourArraySet (&surface_data, array_contours); ProTKPrintf ("status of ProSurfacedataContourArraySet is %d \n", status); status = ProIntfDataSurfaceAppend (interfacedata, &surface_data); ProTKPrintf ("status of ProIntfDataSurfaceAppend is %d \n", status); /*----------------------- Surface -3 -----------------------*/ surface_type = PRO_SRF_PLANE; uvsurf_min[0] = 0.0, uvsurf_min[1] = 0.0; /* uvsurf_max[0] = y_value, uvsurf_max[1]= z_value; */ uvsurf_max[0] = 0, uvsurf_max[1]= 0; surf_orient = 1; vector1[0] = 0.0, vector1[1]= -1.0, vector1[2] =0.0; vector2[0] = 0.0, vector2[1]= 0.0, vector2[2] =1.0; vector3[0] = -1.0, vector3[1]= 0.0, vector3[2] =0.0; origin[0] = 0.0, origin[1]=y_value, origin[2] = 0.0; status = ProPlanedataInit (vector1, vector2, vector3, origin, &shape_data); ProTKPrintf ("status of ProPlanedataInit is %d \n", status); surf_id = 3; status = ProArrayAlloc (4, sizeof(int), 1, (ProArray *) &array_edge_ids); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); array_edge_ids[0]= 4, array_edge_ids[1] = 12, array_edge_ids[2] =8, array_edge_ids[3]=9; status = ProArrayAlloc (1, sizeof (ProContourdata), 1, (ProArray *) &array_contours); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); status = ProContourdataAlloc (&contour); ProTKPrintf ("status of ProContourdataAlloc is %d \n", status); traversal = 1; status = ProContourdataInit ( traversal, contour); ProTKPrintf ("status of ProContourdataInit is %d \n", status); status = ProContourdataEdgeIdArraySet (contour, array_edge_ids); ProTKPrintf ("status of ProContourdataEdgeIdArraySet is %d \n", status); array_contours[0] = *contour; status = ProSurfacedataInit (surface_type, uvsurf_min, uvsurf_max, surf_orient, &shape_data, surf_id, &surface_data); ProTKPrintf ("status of ProSurfacedataInit is %d \n", status); status = ProSurfacedataContourArraySet (&surface_data, array_contours); ProTKPrintf ("status of ProSurfacedataContourArraySet is %d \n", status); status = ProIntfDataSurfaceAppend (interfacedata, &surface_data); ProTKPrintf ("status of ProIntfDataSurfaceAppend is %d \n", status); /*----------------------- Surface -4 -----------------------*/ surface_type = PRO_SRF_PLANE; uvsurf_min[0] = 0.0, uvsurf_min[1] = 0.0; /* uvsurf_max[0] = x_value, uvsurf_max[1]= z_value; */ uvsurf_max[0] = 0, uvsurf_max[1]= 0; surf_orient = 1; vector1[0] = -1.0, vector1[1]= 0.0, vector1[2] =0.0; vector2[0] = 0.0, vector2[1]= 0.0, vector2[2] =1.0; vector3[0] = 0.0, vector3[1]= 1.0, vector3[2] =0.0; origin[0] = x_value, origin[1]=y_value, origin[2] = 0.0; status = ProPlanedataInit (vector1, vector2, vector3, origin, &shape_data); ProTKPrintf ("status of ProPlanedataInit is %d \n", status); surf_id = 4; status = ProArrayAlloc (4, sizeof(int), 1, (ProArray *) &array_edge_ids); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); array_edge_ids[0]= 3, array_edge_ids[1] = 11, array_edge_ids[2] =7, array_edge_ids[3]=12; status = ProArrayAlloc (1, sizeof (ProContourdata), 1, (ProArray *) &array_contours); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); status = ProContourdataAlloc (&contour); ProTKPrintf ("status of ProContourdataAlloc is %d \n", status); traversal = 1; status = ProContourdataInit ( traversal, contour); ProTKPrintf ("status of ProContourdataInit is %d \n", status); status = ProContourdataEdgeIdArraySet (contour, array_edge_ids); ProTKPrintf ("status of ProContourdataEdgeIdArraySet is %d \n", status); array_contours[0] = *contour; status = ProSurfacedataInit (surface_type, uvsurf_min, uvsurf_max, surf_orient, &shape_data, surf_id, &surface_data); ProTKPrintf ("status of ProSurfacedataInit is %d \n", status); status = ProSurfacedataContourArraySet (&surface_data, array_contours); ProTKPrintf ("status of ProSurfacedataContourArraySet is %d \n", status); status = ProIntfDataSurfaceAppend (interfacedata, &surface_data); ProTKPrintf ("status of ProIntfDataSurfaceAppend is %d \n", status); /*----------------------- Surface -5 -----------------------*/ surface_type = PRO_SRF_PLANE; uvsurf_min[0] = 0.0, uvsurf_min[1] = 0.0; /* uvsurf_max[0] = y_value, uvsurf_max[1]= z_value; */ uvsurf_max[0] = 0, uvsurf_max[1]= 0; surf_orient = 1; vector1[0] = 0.0, vector1[1]= 1.0, vector1[2] =0.0; vector2[0] = 0.0, vector2[1]= 0.0, vector2[2] =1.0; vector3[0] = 1.0, vector3[1]= 0.0, vector3[2] =0.0; origin[0] = x_value, origin[1]= 0.0, origin[2] = 0.0; status = ProPlanedataInit (vector1, vector2, vector3, origin, &shape_data); ProTKPrintf ("status of ProPlanedataInit is %d \n", status); surf_id = 5; status = ProArrayAlloc (4, sizeof(int), 1, (ProArray *) &array_edge_ids); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); array_edge_ids[0]= 2, array_edge_ids[1] = 10, array_edge_ids[2] =6, array_edge_ids[3]=11; status = ProArrayAlloc (1, sizeof (ProContourdata), 1, (ProArray *) &array_contours); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); status = ProContourdataAlloc (&contour); ProTKPrintf ("status of ProContourdataAlloc is %d \n", status); traversal = 1; status = ProContourdataInit ( traversal, contour); ProTKPrintf ("status of ProContourdataInit is %d \n", status); status = ProContourdataEdgeIdArraySet (contour, array_edge_ids); ProTKPrintf ("status of ProContourdataEdgeIdArraySet is %d \n", status); array_contours[0] = *contour; status = ProSurfacedataInit (surface_type, uvsurf_min, uvsurf_max, surf_orient, &shape_data, surf_id, &surface_data); ProTKPrintf ("status of ProSurfacedataInit is %d \n", status); status = ProSurfacedataContourArraySet (&surface_data, array_contours); ProTKPrintf ("status of ProSurfacedataContourArraySet is %d \n", status); status = ProIntfDataSurfaceAppend (interfacedata, &surface_data); ProTKPrintf ("status of ProIntfDataSurfaceAppend is %d \n", status); /*----------------------- Surface -6 -----------------------*/ surface_type = PRO_SRF_PLANE; uvsurf_min[0] = 0.0, uvsurf_min[1] = 0.0; /* uvsurf_max[0] = x_value, uvsurf_max[1]= y_value; */ uvsurf_max[0] = 0, uvsurf_max[1]= 0; surf_orient = 1; vector1[0] = 1.0, vector1[1]= 0.0, vector1[2] =0.0; vector2[0] = 0.0, vector2[1]= 1.0, vector2[2] =0.0; vector3[0] = 0.0, vector3[1]= 0.0, vector3[2] =1.0; origin[0] = 0.0, origin[1]= 0.0, origin[2] = z_value; status = ProPlanedataInit (vector1, vector2, vector3, origin, &shape_data); ProTKPrintf ("status of ProPlanedataInit is %d \n", status); surf_id = 6; status = ProArrayAlloc (4, sizeof(int), 1, (ProArray *) &array_edge_ids); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); array_edge_ids[0]= 5, array_edge_ids[1] = 8, array_edge_ids[2] =7, array_edge_ids[3]=6; status = ProArrayAlloc (1, sizeof (ProContourdata), 1, (ProArray *) &array_contours); ProTKPrintf ("status of ProArrayAlloc is %d \n", status); status = ProContourdataAlloc (&contour); ProTKPrintf ("status of ProContourdataAlloc is %d \n", status); traversal = 1; status = ProContourdataInit ( traversal, contour); ProTKPrintf ("status of ProContourdataInit is %d \n", status); status = ProContourdataEdgeIdArraySet (contour, array_edge_ids); ProTKPrintf ("status of ProContourdataEdgeIdArraySet is %d \n", status); array_contours[0] = *contour; status = ProSurfacedataInit (surface_type, uvsurf_min, uvsurf_max, surf_orient, &shape_data, surf_id, &surface_data); ProTKPrintf ("status of ProSurfacedataInit is %d \n", status); status = ProSurfacedataContourArraySet (&surface_data, array_contours); ProTKPrintf ("status of ProSurfacedataContourArraySet is %d \n", status); status = ProIntfDataSurfaceAppend (interfacedata, &surface_data); ProTKPrintf ("status of ProIntfDataSurfaceAppend is %d \n", status); return (interfacedata); /* status = ProIntfDataSourceInit (PRO_INTF_NEUTRAL, interfacedata, &data_source); printf ("status of ProIntfDataSourceInit is %d \n", status); status = ProImportfeatCreate ( solid, &data_source, NULL, NULL, &feature); printf ("status of ProImportfeatCreate is %d \n", status); status = ProImportfeatRedefSourceInit (PRO_IMPORT_FEAT_REDEF_SUBSTITUTE, interfacedata, &redefine_source); printf ("status of ProImportfeatRedefSourceInit is %d \n", status); status = ProImportfeatRedefine ( &feature, &redefine_source); printf ("status of ProImportfeatRedefine is %d \n", status); */ }