For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

AIS_Shape::SetColor without changing boundary edges color

Alexey's picture
Forums: 

Hello! 

I have AIS_Shape in viewer with shading color (superColor) and black color of boundary edges.

Then I do context->SetColor (aisShape, otherSuperColor) and my shape color changed to this color. But color of boundary edges changes color too.

How can I change shading color and leave boundary color? 

Open Cascade 7.2.0, win 32 bit

Thank you.

Kirill Gavrilov's picture

AIS_InteractiveObject::SetColor() provides only a basic meaning of assigning a single color to the presentation.
It is unable to foresee all possible ideas of what user actually expects from this operation in particular case.
Hence, when standard SetColor() method produces something unexpected, application should go through Prs3d_Drawer and configure all aspects manually in the way.

The source code of Draw Harness command vshowfaceboundary can be used as reference for configuring Face Boundary aspects.
Though your post does not quote the complete code for configuring AIS_Shape aspects, and maybe "boundary edges" means something different for you.

Alexey's picture

Kirill, thank you.

I tried to work with drawer: aisShape->Attributes (), but it did not change my presentations. 

Is working with aisShape->Attributes() right way ?

Kirill Gavrilov's picture

AIS_InteractiveObject::Attributes() is a proper way for accessing Prs3d_Drawer, but you should be aware of multiple nuances of using it.
E.g., changing Prs3d_Drawer do not affect already computed presentations without extra actions (they have to be recomputed or synchronized). In addition, Prs3d_Drawer stores aspects by handles and by default inherit (default) settings from AIS_InteractiveContext (stored as Prs3d_Drawer::Link() after displaying object in context) - you need to create and assign new aspects to Prs3d_Drawer instead of modifying aspects returned by it (which would redirect to Link()).

The source code of vshowfaceboundary and vaspects commands takes this into account and could be used as reference
(or at least - try using them directly in Draw Harness to see if they do what you want).

Alexey's picture

Thank you. I will try it and research vshowfaceboundary and vaspects.