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

toolkit: How to save existing Appearance Gallery

MadhaviG
11-Garnet

toolkit: How to save existing Appearance Gallery

Hello all,

Using toolkit functions I rename the model and add few parameters to it.

After this renamed model does not have the same color as it had before.

Seems like toolkit function does not copy the Appearance while renaming model.

It works fine when I do it manually using menu File->save as etc.

 

Does anybody know what is going wrong?

Any help will be appreciated.

MadhaviG

 

 

3 REPLIES 3
skashyap
4-Participant
(To:MadhaviG)

when are you exactly renaming the model?

I fetch the current model and then I rename it.

I know the same behaivoir while remove Instances from a Generic. So we copy the colors manually by ProDevelop:

                                                            if (breakUpFamilytableVisitAction_pdm == 1) {
								int i;
								breakUpFamilytableInner_highestid = 0;
								if (prodb_get_surface_props((Prohandle)mdl, SEL_3D_PART, -1, 0, &psp) == PRODEV_SURF_PROPS_SET) {
									prodb_set_surface_props((Prohandle)instance_mdl, SEL_3D_PART, -1, 0, &psp);
								}
								ProSolidFeatVisit((ProSolid)mdl, (ProFeatureVisitAction)breakUpFamilytableInner_colorcopy_feat, NULL, NULL);
								ProSolidSurfaceVisit((ProSolid)instance_mdl, breakUpFamilytableInner_colorcopy_srf, NULL, NULL);
								for (i = 0; i <= breakUpFamilytableInner_highestid + 100; i++) {
									if (prodb_get_surface_props((Prohandle)mdl, SEL_3D_SRF, i, 0, &psp) == PRODEV_SURF_PROPS_SET)
										prodb_set_surface_props((Prohandle)instance_mdl, SEL_3D_SRF, i, 0, &psp);
									if (prodb_get_surface_props((Prohandle)mdl, SEL_3D_SRF, i, 1, &psp) == PRODEV_SURF_PROPS_SET)
										prodb_set_surface_props((Prohandle)instance_mdl, SEL_3D_SRF, i, 1, &psp);
								}
								
								ProMdlSave(instance_mdl);
							}

 

the other two functions:

ProError breakUpFamilytableInner_colorcopy_srf(ProSurface p_surface, ProError status, ProAppData app_data) {
	int id;
	if (ProSurfaceIdGet(p_surface, &id) == PRO_TK_NO_ERROR) {
		if (id > breakUpFamilytableInner_highestid) breakUpFamilytableInner_highestid = id;
	}
	return PRO_TK_NO_ERROR;
}

ProError breakUpFamilytableInner_colorcopy_feat(ProFeature * p_feature, ProError status, ProAppData app_data) {
	if (p_feature->id > breakUpFamilytableInner_highestid) breakUpFamilytableInner_highestid = p_feature->id;
	return PRO_TK_NO_ERROR;
}

There should be replacement functions inside of Creo 4.0 that replace the ProDevelop functions, but I haven't changed my code to the "new" functionalitys because lack of time.

 

Br,

Eike 

Announcements