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

Entity Color

Highlighted

Entity Color

Hello all,

Does anyone know how to modify the color of a component in a assembly or a color of a surface in a part??

I find only the function ProCurveColorSet....but for other features???

Thanks in advance

7 REPLIES 7

Entity Color

Marco,

That is an excellent question. Pro/TOOLKIT does not have the API calls
to modify the color of assembly components or surfaces. However,
Pro/DEVELOP does have that functionality. Read the API Wizard under
User's Guide->Graphics and Object Display->Cosmetic Properties->Surface
Properties. The function you are looking for is
prodb_set_surface_props(). Sadly these functions have not been replaced
by equivalent Pro/TOOLKIT functions.



Patrick Williams | Sr. Application Engineer | CAM Systems | Steelcase
Inc. | 616.698.4078


Entity Color

Marco -

Once you have the component identified, you can you something like this
to change the color properties of a component. LIke Patrick said, there
isn't a Pro/TOOLKIT function to do this... I'm reverting back to the
old Pro/DEVELOP functions, so don't forget to include the libraries for
that.

RE: Entity Color

Dear Paul,

i was also searching the same for 1 of my requirement and i find the answer over here. thanks for posting the help over here.

But i have small problem. probably i am not feeling comfortable with prodevelop functions. reason might be i havn't done much on prodevelop front than protoolkit or very little help is available.

i used the same code prodb_set_surface_props(assembly, SEL_3D_PART,
p_asmcomp.id, 0, &properties); but my compiler is giving error 'SEL_3D_PART' : undeclared identifier.

should i need to pass selection object or i need to add any header file? help required.

🙂

Thanks & Regards

Nikhil Gothankar




In Reply to Paul Crane:

In Reply to Paul Crane:
Marco -

Once you have the component identified, you can you something like this
to change the color properties of a component. LIke Patrick said, there
isn't a Pro/TOOLKIT function to do this... I'm reverting back to the
old Pro/DEVELOP functions, so don't forget to include the libraries for
that.

Entity Color

Nikhil,

You need to
#include <select3d.h>

It is clearly specified in documentation.

Regards,

Vinay


2009/3/13 Nikhil Gothankar <->

> Dear Paul,
>
> i was also searching the same for 1 of my requirement and i find the answer
> over here. thanks for posting the help over here.
>
> But i have small problem. probably i am not feeling comfortable with
> prodevelop functions. reason might be i havn't done much on prodevelop front
> than protoolkit or very little help is available.
>
> i used the same code prodb_set_surface_props(assembly, SEL_3D_PART,
> p_asmcomp.id, 0, &properties); but my compiler is giving error 'SEL_3D_PART'
> : undeclared identifier.
>
> should i need to pass selection object or i need to add any header file?
> help required.
>
> 🙂
>
> Thanks & Regards
> Nikhil Gothankar
>
>
>
>
> In Reply to Paul Crane:
> In Reply to Paul Crane:
>
> Marco -
>
> Once you have the component identified, you can you something like this
> to change the color properties of a component. LIke Patrick said, there
> isn't a Pro/TOOLKIT function to do this... I'm reverting back to the
> old Pro/DEVELOP functions, so don't forget to include the libraries for
> that.
>
>

RE: Entity Color

Dear Friends,

i am using the following code for coloring a part, but all my functions of surface properties returning -2.

ProError setpartColor(ProMdl mdl, double r,double g, double b){

Pro_surf_props *surProps;

ProModelitem mdlItem;

ProSelection sel;

int ret=0;

status=ProMdlToModelitem(mdl,&mdlItem);

ProTKFprintf(fp, "\n\t *id=%d",mdlItem.id);

status=ProSelectionAlloc(NULL,&mdlItem,&sel);

ret=prodb_get_surface_props((Prohandle)mdl,SEL_3D_SRF,-1,0,surProps);

ProTKFprintf(fp, "*\n\t ret0=%d\n", ret);memset(surProps,'\0',sizeof(Pro_surf_props));

surProps->color_rgb[0]=(r/255);

surProps->color_rgb[1]=(g/255);

surProps->color_rgb[2]=(b/255);

surProps->transparency=1;

ret=prodb_unset_surface_props((Prohandle)mdl,SEL_3D_SRF,-1,0);

ProTKFprintf(fp, "*\n\t ret1=%d\n", ret);if (ret==0)

ret=prodb_set_surface_props((Prohandle)mdl,SEL_3D_SRF,-1,0,surProps);

ProTKFprintf(fp, "*\n\t ret2=%d\n", ret);

return status;

}

will it work?

Waiting for response.

Nikhil Gothankar


In Reply to Vinay Marje:

Nikhil,

You need to
#include <select3d.h>

It is clearly specified in documentation.

Regards,

Vinay


2009/3/13 Nikhil Gothankar <->

> Dear Paul,
>
> i was also searching the same for 1 of my requirement and i find the answer
> over here. thanks for posting the help over here.
>
> But i have small problem. probably i am not feeling comfortable with
> prodevelop functions. reason might be i havn't done much on prodevelop front
> than protoolkit or very little help is available.
>
> i used the same code prodb_set_surface_props(assembly, SEL_3D_PART,
> p_asmcomp.id, 0, &properties); but my compiler is giving error 'SEL_3D_PART'
> : undeclared identifier.
>
> should i need to pass selection object or i need to add any header file?
> help required.
>
> 🙂
>
> Thanks & Regards
> Nikhil Gothankar
>
>
>
>
> In Reply to Paul Crane:
> In Reply to Paul Crane:
>
> Marco -
>
> Once you have the component identified, you can you something like this
> to change the color properties of a component. LIke Patrick said, there
> isn't a Pro/TOOLKIT function to do this... I'm reverting back to the
> old Pro/DEVELOP functions, so don't forget to include the libraries for
> that.
>
>

Entity Color

Following code to get part color works for me. Try using SEL_3D_PART and
correct model Id.

int status, model_id;

status = ProMdlIdGet(mdl, &model_id);

status = prodb_get_surface_props(mdl, SEL_3D_PART, model_id, 0,
&properties);

status will be PRODEV_SURF_PROPS_SET if color is set on the part.

I haven't tried prodb_get_surface_props(), but hope it works.

Regards,

Vinay


2009/3/20 Nikhil Gothankar <->

> Dear Friends,
>
> i am using the following code for coloring a part, but all my functions of
> surface properties returning -2.
> ProError setpartColor(ProMdl mdl, double r,double g, double b){
>
> Pro_surf_props *surProps;
>
> ProModelitem mdlItem;
>
> ProSelection sel;
> int ret=0;
>
> status=ProMdlToModelitem(mdl,&mdlItem);
> ProTKFprintf(fp, "\n\t *id=%d",mdlItem.id);
>
> status=ProSelectionAlloc(NULL,&mdlItem,&sel);
>
> ret=prodb_get_surface_props((Prohandle)mdl,SEL_3D_SRF,-1,0,surProps);
> ProTKFprintf(fp, "*\n\t ret0=%d\n", ret);memset(surProps,'\0',sizeof
> (Pro_surf_props));
>
> surProps->color_rgb[0]=(r/255);
>
> surProps->color_rgb[1]=(g/255);
>
> surProps->color_rgb[2]=(b/255);
>
> surProps->transparency=1;
>
> ret=prodb_unset_surface_props((Prohandle)mdl,SEL_3D_SRF,-1,0);
> ProTKFprintf(fp, "*\n\t ret1=%d\n", ret);if (ret==0)
>
> ret=prodb_set_surface_props((Prohandle)mdl,SEL_3D_SRF,-1,0,surProps);
>
> ProTKFprintf(fp, "*\n\t ret2=%d\n", ret);
> return status;
>
> }
>
> will it work?
>
> Waiting for response.
>
> Nikhil Gothankar
>
>
> In Reply to Vinay Marje:
>
> Nikhil,
>
> You need to
> #include <select3d.h>
>
> It is clearly specified in documentation.
>
> Regards,
>
> Vinay
>
>
> 2009/3/13 Nikhil Gothankar <->
>
> > Dear Paul,
> >
> > i was also searching the same for 1 of my requirement and i find the
> answer
> > over here. thanks for posting the help over here.
> >
> > But i have small problem. probably i am not feeling comfortable with
> > prodevelop functions. reason might be i havn't done much on prodevelop
> front
> > than protoolkit or very little help is available.
> >
> > i used the same code prodb_set_surface_props(assembly, SEL_3D_PART,
> > p_asmcomp.id, 0, &properties); but my compiler is giving error
> 'SEL_3D_PART'
> > : undeclared identifier.
> >
> > should i need to pass selection object or i need to add any header file?
> > help required.
> >
> > 🙂
> >
> > Thanks & Regards
> > Nikhil Gothankar
> >
> >
> >
> >
> > In Reply to Paul Crane:
> > In Reply to Paul Crane:
> >
> > Marco -
> >
> > Once you have the component identified, you can you something like this
> > to change the color properties of a component. LIke Patrick said, there
> > isn't a Pro/TOOLKIT function to do this... I'm reverting back to the
> > old Pro/DEVELOP functions, so don't forget to include the libraries for
> > that.
> >
> >

RE: Entity Color

Friends,

Pro_surf_props surProps;

status=ProMdlCurrentGet(&mdl);

ProMdlIdGet(mdl, &model_id);

ProTKFprintf(fp, "\n\t *id=%d",model_id););

ProTKFprintf(fp, "*\n\t ret0=%d\n", ret);

surProps.color_rgb[0]=(0.0);

surProps.color_rgb[1]=(0.0);

surProps.color_rgb[2]=(0.0);

if (ret==0)

ret=prodb_set_surface_props((Prohandle)mdl,SEL_3D_SRF,model_id,0,&surProps);

ProTKFprintf(fp, "*\n\t ret2=%d\n", ret);

same result : ret2=-2

same result : ret2=-2

Nikhil Gothankar

In Reply to Vinay Marje:

Following code to get part color works for me. Try using SEL_3D_PART and
correct model Id.

int status, model_id;

status = ProMdlIdGet(mdl, &model_id);

status = prodb_get_surface_props(mdl, SEL_3D_PART, model_id, 0,
&properties);

status will be PRODEV_SURF_PROPS_SET if color is set on the part.

I haven't tried prodb_get_surface_props(), but hope it works.

Regards,

Vinay


2009320 Nikhil Gothankar <->

> Dear Friends,
>
> i am using the following code for coloring a part, but all my functions of
> surface properties returning -2.
> ProError setpartColor(ProMdl mdl, double r,double g, double b){
>
> Pro_surf_props *surProps;
>
> ProModelitem mdlItem;
>
> ProSelection sel;
> int ret=0;
>
> status=ProMdlToModelitem(mdl,&mdlItem);
> ProTKFprintf(fp, "\n\t *id=%d",mdlItem.id);
>
> status=ProSelectionAlloc(NULL,&mdlItem,&sel);
>
> ret=prodb_get_surface_props((Prohandle)mdl,SEL_3D_SRF,-1,0,surProps);
> ProTKFprintf(fp, "*\n\t ret0=%d\n", ret);memset(surProps,'\0',sizeof
> (Pro_surf_props));
>
> surProps->color_rgb[0]=(r255);
>
> surProps->color_rgb[1]=(g255);
>
> surProps->color_rgb[2]=(b255);
>
> surProps->transparency=1;
>
> ret=prodb_unset_surface_props((Prohandle)mdl,SEL_3D_SRF,-1,0);
> ProTKFprintf(fp, "*\n\t ret1=%d\n", ret);if (ret==0)
>
> ret=prodb_set_surface_props((Prohandle)mdl,SEL_3D_SRF,-1,0,surProps);
>
> ProTKFprintf(fp, "*\n\t ret2=%d\n", ret);
> return status;
>
> }
>
> will it work?
>
> Waiting for response.
>
> Nikhil Gothankar
>
>
> In Reply to Vinay Marje:
>
> Nikhil,
>
> You need to
> #include <select3d.h>
>
> It is clearly specified in documentation.
>
> Regards,
>
> Vinay
>
>
> 2009313 Nikhil Gothankar <->
>
> > Dear Paul,
> >
> > i was also searching the same for 1 of my requirement and i find the
> answer
> > over here. thanks for posting the help over here.
> >
> > But i have small problem. probably i am not feeling comfortable with
> > prodevelop functions. reason might be i havn't done much on prodevelop
> front
> > than protoolkit or very little help is available.
> >
> > i used the same code prodb_set_surface_props(assembly, SEL_3D_PART,
> > p_asmcomp.id, 0, &properties); but my compiler is giving error
> 'SEL_3D_PART'
> > : undeclared identifier.
> >
> > should i need to pass selection object or i need to add any header file?
> > help required.
> >
> > 🙂
> >
> > Thanks & Regards
> > Nikhil Gothankar
> >
> >
> >
> >
> > In Reply to Paul Crane:
> > In Reply to Paul Crane:
> >
> > Marco -
> >
> > Once you have the component identified, you can you something like this
> > to change the color properties of a component. LIke Patrick said, there
> > isn't a ProTOOLKIT function to do this... I'm reverting back to the
> > old ProDEVELOP functions, so don't forget to include the libraries for
> > that.
> >
> >