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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Dimension Visit to find a dimension by name

Manjunath
12-Amethyst

Dimension Visit to find a dimension by name

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;
1 ACCEPTED SOLUTION

Accepted Solutions

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;
}

View solution in original post

2 REPLIES 2

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;
}

@GabrielZaha , its working tnx for the info..

Top Tags