Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi All,
I use ProSolidDimensionVisit(), to get a dimension names "Test" from a part. And I need to add flexibility in Assembly. I use the following code, in this case it takes only first dimension. Kindly throw some light how to find the dimension with name.
ProError dim_visit(ProDimension* dimension,ProError status,ProAppData data)
ProName d_name;
char dim_name[PRO_NAME_SIZE];
status = ProModelitemNameGet(dimension,d_name);
ProWstringToString(dim_name,d_name);
if (strcmp(dim_name,"Test") == 0)
{
return status;
}
return PRO_TK_CONTINUE;
Solved! Go to Solution.
There are two things that you need to pay attention.
First: to get the dimension name you need to use ProDimensionSymbolGet function.
Second is the return of the visiting function. Anything other than PRO_TK_NO_ERROR will make the ProSolidDimensionVisit function to stop. In the example you posted the return is set to PRO_TK_CONTINUE wich will make the visiting stop.
I guess what you are looking for is something like this:
ProError dim_visit(ProDimension* dimension,ProError status,ProAppData data)
{
ProName d_name;
char dim_name[PRO_NAME_SIZE];
status = ProDimensionSymbolGet(dimension,d_name);
ProWstringToString(dim_name,d_name);
if (strcmp(dim_name,"Test") == 0)
{
//do something here
return PRO_TK_CONTINUE;
}
return PRO_TK_NO_ERROR;
}
There are two things that you need to pay attention.
First: to get the dimension name you need to use ProDimensionSymbolGet function.
Second is the return of the visiting function. Anything other than PRO_TK_NO_ERROR will make the ProSolidDimensionVisit function to stop. In the example you posted the return is set to PRO_TK_CONTINUE wich will make the visiting stop.
I guess what you are looking for is something like this:
ProError dim_visit(ProDimension* dimension,ProError status,ProAppData data)
{
ProName d_name;
char dim_name[PRO_NAME_SIZE];
status = ProDimensionSymbolGet(dimension,d_name);
ProWstringToString(dim_name,d_name);
if (strcmp(dim_name,"Test") == 0)
{
//do something here
return PRO_TK_CONTINUE;
}
return PRO_TK_NO_ERROR;
}
