cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Crash while calling ProImportfeatCreate()

ptechnologies
10-Marble

Crash while calling ProImportfeatCreate()

Issue while creation of import feature using ProImportfeatCreate().
I am trying to create import feature but it gives crash.

Sample code is as follows.

Void CreateImportFeature()

{

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]; ProIntfData *interfacedata; ProCurvedata *curve_data;ProEdgedata *edge_data; ProFeature feature;int status;

status = ProIntfDataAlloc(&interfacedata);
status = ProEdgedataAlloc(&edge_data);
//edge 1
{
status = ProCurvedataAlloc(&curve_data);
edge_id = 1;
surface_id[0] = 1, surface_id[1] = 1;
edge_dir[0] = ProEdgeDir::PRO_EDGE_NO_FLIP;
edge_dir[1] = ProEdgeDir::PRO_EDGE_FLIP;

int numU = 4;
int numCt = 2;
double *u_par_arr, *wts;
Pro3dPnt *c_point_arr;
ProArrayAlloc(numU, sizeof(double), 1, (ProArray*)&u_par_arr);
ProArrayAlloc(numCt, sizeof(Pro3dPnt), 1, (ProArray*)&wts);
ProArrayAlloc(numCt, sizeof(Pro3dPnt), 1, (ProArray*)&c_point_arr);
u_par_arr[0] = 0;u_par_arr[1] = 0;u_par_arr[2] = 1;u_par_arr[3] = 1;
wts[0] = 1;wts[1] = 1;
c_point_arr[0][0] = 0;c_point_arr[0][1] = 0;c_point_arr[0][2] = 0;
c_point_arr[1][0] = 100;c_point_arr[1][1] = 0;c_point_arr[1][2] = 0;
status = ProBsplinedataInit(1, u_par_arr, wts, c_point_arr, numU, numCt, curve_data);
}
status = ProEdgedataInit(edge_id, surface_id, edge_dir, NULL, NULL,
curve_data, edge_data);

status = ProIntfDataEdgeAppend(interfacedata, edge_data);

status = ProCurvedataFree(curve_data);
//edge 2
{
status = ProCurvedataAlloc(&curve_data);
edge_id = 2;
surface_id[0] = 1, surface_id[1] = 1;
edge_dir[0] = ProEdgeDir::PRO_EDGE_NO_FLIP;
edge_dir[1] = ProEdgeDir::PRO_EDGE_FLIP;
int numU = 4;
int numCt = 2;
double *u_par_arr, *wts;
Pro3dPnt *c_point_arr;
ProArrayAlloc(numU, sizeof(double), 1, (ProArray*)&u_par_arr);
ProArrayAlloc(numCt, sizeof(Pro3dPnt), 1, (ProArray*)&wts);
ProArrayAlloc(numCt, sizeof(Pro3dPnt), 1, (ProArray*)&c_point_arr);
u_par_arr[0] = 0;u_par_arr[1] = 0;u_par_arr[2] = 1;u_par_arr[3] = 1;
wts[0] = 1;
wts[1] = 1;
c_point_arr[0][0] = 100;c_point_arr[0][1] = 0;c_point_arr[0][2] = 0;
c_point_arr[1][0] = 100;c_point_arr[1][1] = 100;c_point_arr[1][2] = 0;
status = ProBsplinedataInit(1, u_par_arr, wts, c_point_arr, numU, numCt, curve_data);
}
status = ProEdgedataInit(edge_id, surface_id, edge_dir, NULL, NULL,
curve_data, edge_data);
status = ProIntfDataEdgeAppend(interfacedata, edge_data);
status = ProCurvedataFree(curve_data);
//edge 3
{
status = ProCurvedataAlloc(&curve_data);
edge_id = 3;
surface_id[0] = 1, surface_id[1] = 1;
edge_dir[0] = ProEdgeDir::PRO_EDGE_NO_FLIP;
edge_dir[1] = ProEdgeDir::PRO_EDGE_FLIP;

int numU = 4;
int numCt = 2;
double *u_par_arr, *wts;
Pro3dPnt *c_point_arr;
ProArrayAlloc(numU, sizeof(double), 1, (ProArray*)&u_par_arr);
ProArrayAlloc(numCt, sizeof(Pro3dPnt), 1, (ProArray*)&wts);
ProArrayAlloc(numCt, sizeof(Pro3dPnt), 1, (ProArray*)&c_point_arr);
u_par_arr[0] = 0;u_par_arr[1] = 0;u_par_arr[2] = 1;u_par_arr[3] = 1;
wts[0] = 1;
wts[1] = 1;
c_point_arr[0][0] = 100;c_point_arr[0][1] = 100;c_point_arr[0][2] = 0;
c_point_arr[1][0] = 0;c_point_arr[1][1] = 100;c_point_arr[1][2] = 0;
status = ProBsplinedataInit(1, u_par_arr, wts, c_point_arr, numU, numCt, curve_data);
}

status = ProEdgedataInit(edge_id, surface_id, edge_dir, NULL, NULL,
curve_data, edge_data);
status = ProIntfDataEdgeAppend(interfacedata, edge_data);
status = ProCurvedataFree(curve_data);
//edge 4
{
status = ProCurvedataAlloc(&curve_data);
edge_id = 4;
surface_id[0] = 1, surface_id[1] = 1;
edge_dir[0] = ProEdgeDir::PRO_EDGE_NO_FLIP;
edge_dir[1] = ProEdgeDir::PRO_EDGE_FLIP;

int numU = 4;
int numCt = 2;
double *u_par_arr, *wts;
Pro3dPnt *c_point_arr;
ProArrayAlloc(numU, sizeof(double), 1, (ProArray*)&u_par_arr);
ProArrayAlloc(numCt, sizeof(Pro3dPnt), 1, (ProArray*)&wts);
ProArrayAlloc(numCt, sizeof(Pro3dPnt), 1, (ProArray*)&c_point_arr);
u_par_arr[0] = 0;u_par_arr[1] = 0;u_par_arr[2] = 1;u_par_arr[3] = 1;
wts[0] = 1;
wts[1] = 1;

c_point_arr[0][0] = 0;c_point_arr[0][1] = 100;c_point_arr[0][2] = 0;
c_point_arr[1][0] = 0;c_point_arr[1][1] = 0;c_point_arr[1][2] = 0;
status = ProBsplinedataInit(1, u_par_arr, wts, c_point_arr, numU, numCt, curve_data);
}
status = ProEdgedataInit(edge_id, surface_id, edge_dir, NULL, NULL,
curve_data, edge_data);
status = ProIntfDataEdgeAppend(interfacedata, edge_data);
status = ProCurvedataFree(curve_data);

surface_type = PRO_SRF_B_SPL;
uvsurf_min[0] = 0, uvsurf_min[1] = 0;
uvsurf_max[0] = 0, uvsurf_max[1] = 0;
surf_orient = ProSurfaceOrient::PRO_SURF_ORIENT_IN;

{
int degree[] = { 1,1 };
int num_u = 4;
int num_v = 4;
int num_c_point = 4;
double *u_par_arr, *v_par_arr, *wts;
Pro3dPnt *c_point_arr;
ProArrayAlloc(num_u, sizeof(double), 1, (ProArray*)&u_par_arr);
ProArrayAlloc(num_v, sizeof(double), 1, (ProArray*)&v_par_arr);
ProArrayAlloc(num_c_point, sizeof(Pro3dPnt), 1, (ProArray*)&wts);
ProArrayAlloc(num_c_point, sizeof(Pro3dPnt), 1, (ProArray*)&c_point_arr);
u_par_arr[0] = 0;
u_par_arr[1] = 0;
u_par_arr[2] = 1;
u_par_arr[3] = 1;
v_par_arr[0] = 0;
v_par_arr[1] = 0;
v_par_arr[2] = 1;
v_par_arr[3] = 1;
wts[0] = 1;
wts[1] = 1;
wts[2] = 1;
wts[3] = 1;
c_point_arr[0][0] = 0;
c_point_arr[0][1] = 0;
c_point_arr[0][2] = 0;
c_point_arr[1][0] = 200;
c_point_arr[1][1] = 0;
c_point_arr[1][2] = 0;
c_point_arr[2][0] = 0;
c_point_arr[2][1] = 200;
c_point_arr[2][2] = 0;
c_point_arr[3][0] = 200;
c_point_arr[3][1] = 200;
c_point_arr[3][2] = 0;
status = ProBsplinesrfdataInit(degree, u_par_arr, v_par_arr, wts, c_point_arr, num_u, num_v, num_c_point, &shape_data);

}
surf_id = 1;
status = ProArrayAlloc(1, sizeof(ProContourdata), 1, (ProArray *)&array_contours);
status = ProArrayAlloc(4, sizeof(int), 1, (ProArray *)&array_edge_ids);
array_edge_ids[0] = 1; array_edge_ids[1] = 2;
array_edge_ids[2] = 3; array_edge_ids[3] = 4;
status = ProContourdataAlloc(&contour);
traversal = ProContourTraversal::PRO_CONTOUR_TRAV_EXTERNAL;
status = ProContourdataInit(traversal, contour);
status = ProContourdataEdgeIdArraySet(contour, array_edge_ids);
array_contours[0] = *contour;

status = ProSurfacedataInit(surface_type, uvsurf_min, uvsurf_max, surf_orient,
&shape_data, surf_id, &surface_data);

status = ProSurfacedataContourArraySet(&surface_data, array_contours);
status = ProIntfDataSurfaceAppend(interfacedata, &surface_data);

ProIntfDataSource data_source;
ProFeature feature_2;

ProMdl solid;
status = ProMdlCurrentGet(&solid);
status = ProIntfDataSourceInit(PRO_INTF_NEUTRAL, interfacedata, &data_source);
status = ProImportfeatCreate((ProSolid)solid, &data_source, NULL, NULL, &feature_2);

}

0 REPLIES 0
Top Tags