View Issue Details

IDProjectCategoryView StatusLast Update
0032071CommunityOCCT:Visualizationpublic2021-02-15 13:41
Reporterxuweibin Assigned Tobugmaster  
PrioritynormalSeverityjust a question 
Status closedResolutionno change required 
PlatformWindowsOSVC++ 2013 
Product Version7.4.0 
Target Version7.6.0 
Summary0032071: Visualization - does AIS_Shape::SetColor() affect the FaceBoundaryAspect of other AIS_Shape?
DescriptionI have two AIS_Shape,and each of them have own FaceBoundaryAspect.
When I SetColor for one,the other's FaceBoundaryAspect's color is changed.
And the faceboundary's color is the set color.
This is a bug for occ7.5?
Occ7.3 is right.
TagsNo tags attached.
Test case number

Relationships

child of 0029988 closedbugmaster AIS_Shape - SetWidth() and SetColor() has no effect for FaceBoundary 

Activities

kgv

2021-01-25 02:03

developer   ~0098383

I can barely see in code any reason for described misbehavior.
Could you please share a reproducing code / script?

xuweibin

2021-01-25 04:19

reporter   ~0098384

auto topo_box = BRepPrimAPI_MakeBox(gp_Pnt(0,0,0), gp_Pnt(10,10,10));
Handle(AIS_Shape) ais_box = new AIS_Shape(topo_box);
myContext->Display(ais_box,true);
auto aspect = new Prs3d_LineAspect(Quantity_NOC_BLACK,Aspect_TOL_SOLID, 1.0);
ais_box->Attributes()->SetFaceBoundaryAspect(aspect);
ais_box->Attributes()->SetFaceBoundaryDraw(true);
ais_box->SetColor(Quantity_NOC_RED1);
mycontext->Redisplay(ais_box,true);

The boundary color is red not black!
The methond SetColor() changes the color of boundary!

kgv

2021-01-25 10:30

developer   ~0098387

Last edited: 2021-01-25 10:32

Well, this is different from what one may guess from issue description.
AIS_Shape::SetColor()/SetTransparency()/SetMaterial() are just convenient short-cuts implementing some general behavior.
As long as you are using only these methods, it might provide more or less convenient behavior, but modifying attributes manually might easily break the logic.

AIS_Shape::SetColor() indeed sets color to FaceBoundaryAspect() aspect, which is an expected behavior.
As there is no AIS_Shape::hasOwnBoundary color similar to AIS_Shape::hasOwnColor/AIS_Shape::hasOwnMaterial and similar, method is unaware if currently set face boundary color was intentional or should be overridden.

As long as your application sets attributes directly - it is better not using AIS_Shape::SetColor() and similar methods at all, or override them to implement desired behavior.

xuweibin

2021-01-25 11:00

reporter   ~0098390

okay,thank you!

kgv

2021-01-25 11:21

developer   ~0098391

Dear bugmaster,

please close the issue.

Issue History

Date Modified Username Field Change
2021-01-21 08:47 xuweibin New Issue
2021-01-21 08:47 xuweibin Assigned To => kgv
2021-01-21 17:47 kgv Severity minor => just a question
2021-01-21 17:47 kgv Summary AIS_Shape::SetColor() affect the FaceBoundaryAspect of other AIS_Shape? => Visualization - does AIS_Shape::SetColor() affect the FaceBoundaryAspect of other AIS_Shape?
2021-01-25 02:03 kgv Note Added: 0098383
2021-01-25 02:03 kgv Assigned To kgv => xuweibin
2021-01-25 02:03 kgv Severity just a question => minor
2021-01-25 02:03 kgv Product Version => 7.5.0
2021-01-25 02:03 kgv Target Version => 7.6.0
2021-01-25 02:03 kgv Status new => feedback
2021-01-25 04:19 xuweibin Note Added: 0098384
2021-01-25 10:30 kgv Note Added: 0098387
2021-01-25 10:30 kgv Severity minor => just a question
2021-01-25 10:30 kgv Resolution open => no change required
2021-01-25 10:31 kgv Note Edited: 0098387
2021-01-25 10:32 kgv Note Edited: 0098387
2021-01-25 11:00 xuweibin Note Added: 0098390
2021-01-25 11:21 kgv Note Added: 0098391
2021-01-25 11:21 kgv Assigned To xuweibin => bugmaster
2021-01-25 14:52 kgv Relationship added child of 0029988
2021-01-25 14:53 kgv Product Version 7.5.0 => 7.4.0
2021-02-15 13:41 bugmaster Status feedback => closed