How to display a small and a large object with OCC 6.5

Hello,

I have to display a large and a small object. Both object are TopoDS_Shape. It worked well with OCC 6.3
But with OCC 6.5 the faces of the small object are totally wrong. The wireframe is ok. The size relation between both object is 1:200.

Any ideas what i can do?

Thanks,
Brandt

sergey zaritchny's picture

Hi Brandt,
Can you provide the mentioned shapes?
I will try to check it.
Regards
Sergey

Thornton's picture

Hi Sergey,

here is some code that reproduces the problem.
For testing i have modified the example Viewer3d that comes with OCC 6.5.
I have used vs2008 64-bit.

#include
#include
#include
void CViewer3dDoc::OnCylinder()
{
if(myCylinder.IsNull()) {
{
TopoDS_Shape sc1 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0,0,1)),200,1).Shape();
TopoDS_Shape sc2 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0,0,220),gp_Dir(0,0,1)),1,2).Shape();

TopTools_IndexedMapOfShape fmap;

TopExp::MapShapes(sc2,TopAbs_FACE,fmap);

TopoDS_Shell Sh;
BRep_Builder B;
B.MakeShell(Sh);
for(int i = 1; i <= fmap.Extent(); ++i){
B.Add(Sh,fmap(i));
}
ShapeFix_Shell FS(Sh);
FS.Perform();

TopoDS_Compound ResultShape;
BRep_Builder CompoundBuilder;
CompoundBuilder.MakeCompound(ResultShape);
CompoundBuilder.Add(ResultShape,FS.Shape());
CompoundBuilder.Add(ResultShape,sc1);
Handle_AIS_Shape c = new AIS_Shape(ResultShape);
myAISContext->SetDisplayMode(c,1);

myAISContext->Display(c);
}
TCollection_AsciiString Message("\
gp_Ax2 CylAx2(gp_Pnt(0,0,-100), gp_Dir(gp_Vec(gp_Pnt(0,0,-100),gp_Pnt(0,0,100))));\n\
C = new User_Cylinder(CylAx2, 80.,200.);;\n\
");

UpdateResultMessageDlg("Create Cylinder",Message);

}
}

regards,
Brandt

Thornton's picture

Hi Sergey,

MakeShell and ShapeFix_shell are not necessary to reproduce the problem.

TopoDS_Shape sc1 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0,0,220),gp_Dir(0,0,1)),200,1).Shape();
TopoDS_Shape sc2 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0,0,1)),1,2).Shape();

TopoDS_Compound ResultShape;
BRep_Builder CompoundBuilder;
CompoundBuilder.MakeCompound(ResultShape);
CompoundBuilder.Add(ResultShape,sc2);
CompoundBuilder.Add(ResultShape,sc1);
Handle_AIS_Shape c = new AIS_Shape(ResultShape);
myAISContext->SetDisplayMode(c,1);

myAISContext->Display(c);

regard,
Brandt

sergey zaritchny's picture

Hi Brandt,
The problem described by you (totally wrong faces of the small cylinder) is not reproducible on the delivered binary version of OCCT. See the attached file with pictures (small cylinder looks Ok) and Draw script below used to reproduce the problem.
pload MODELING AISV
plane p1 0 0 220 0 0 1
plane p2 0 0 0 0 0 1
pcylinder p1 p1 200 1
pcylinder p2 p2 1 2
compound p1 p2 c
vdisplay c
vsetdispmode c 1
vfit

Regards
Sergey

Attachments: 
sergey zaritchny's picture

Hi Brandt,
I found how to reproduce the problem.
If first you set display mode and only after display it the problem is reproducible.
I.e. if compound is displayed in shading mode first(not in wireframe first!) faces of the small cylinder looks wrong).
....
vsetdispmode c 1
vdisplay c
vfit
The corresponding issue with ID = OCC22318 has been registered.
Later you can know if the issue is resolved by checking references to the specified ID in OCCT Release Notes. The analysis of the issue will take some time depending on our technical capability and availability of resources.

Regards

Thornton's picture

Hi Sergey,

swapping Display and SetDisplayMode solved the problem.

Thanks for your help.

Regards,
Brandt