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

Our Solutions Need professional assistance?
Consider our:

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

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

Intersections between the parallel planes Forums:

Hello,

I want to identify the parallel planar planes that have gap between of a part (in attached photo). The distance of gaps is 5.5 mm. Hereby my code. But I don't understand why OCC is just identify exactly some pairs of planes that have gap and some of pairs, it just identify 1 face in the pair of 2 opposite faces.

//create map of all faces in part

TopoDS_Shape expShapeFace = getShape1();

TopTools_IndexedMapOfShape MapOther;

for (int Face = 1; Face <= MapOther.Size(); Face++)

{

//indentify initial face of parellel faces

TopoDS_Shape aOFace = MapOther.FindKey(Face);

TopoDS_Face myOFace = TopoDS::Face(aOFace);

Standard_Real uMin, uMax, vMin, vMax;

BRepTools::UVBounds(myOFace, uMin, uMax, vMin, vMax);

Handle(Geom_Surface) myOSurf = BRep_Tool::Surface(myOFace);

GeomLProp_SLProps Prop(myOSurf, uMin, vMin, 1, 0.2);

gp_Dir ONormal = Prop.Normal();

if (myOFace.Orientation() == TopAbs_REVERSED)

ONormal.Reverse();

gp_Vec myONormal(ONormal);

GProp_GProps Propss;

BRepGProp::SurfaceProperties(myOFace, Propss);

//from the face that is identified, create a point in the center of face, from this point create an infinite curve to cut the other parallel faces to get intersections

gp_Pnt Gpoint = Propss.CentreOfMass();

gp_Lin aLin(Gpoint, myONormal);

BRepBuilderAPI_MakeEdge myMaker(aLin);

TopoDS_Edge myOEdge = myMaker.Edge();

Standard_Real first = 0, last = 180.0;

Handle(Geom_Curve) myOCurve = BRep_Tool::Curve(myOEdge, first, last);

for (int i = 1; i <= MapOther.Size(); i++)

{

TopoDS_Shape FaceX = MapOther.FindKey(i);

if (aOFace.IsPartner(FaceX))

else

{

TopoDS_Face subFaceX = TopoDS::Face(FaceX);

Standard_Real uMin, uMax, vMin, vMax;

BRepTools::UVBounds(subFaceX, uMin, uMax, vMin, vMax);

Handle(Geom_Surface) mysubSurfX = BRep_Tool::Surface(subFaceX);

GeomLProp_SLProps Prop1(mysubSurfX, uMin, vMin, 1, 0.2);

gp_Dir subXNormal = Prop1.Normal();

if (subFaceX.Orientation() == TopAbs_REVERSED)

subXNormal.Reverse();

gp_Vec mysubXNormal(subXNormal);

GeomAPI_IntCS myIntersection(myOCurve, mysubSurfX);

if (myIntersection.NbPoints() > 0)

{

for (int m = 1; m <= myIntersection.NbPoints(); m++)

{

//if it idenfy the intersection nearest with the initial face, calculacte the distance and compare with 5.5

gp_Pnt IntPoint=myIntersection.Point(m);

gp_Vec VMagn(Gpoint, IntPoint);

Standard_Real dist = VMagn.Magnitude();

if (myONormal.IsOpposite(mysubXNormal, 0.001) && dist <= 5.5)

{

NbOther++;

//color the faces that have the gap=5.5 between them.

Handle(AIS_Shape) anAIS1 = new AIS_Shape(myOFace);

Handle(AIS_InteractiveObject) anOB1;

anOB1 = anAIS1;

anOB1->SetColor(Quantity_NOC_YELLOW);

myContext->Display(anOB1, true);

}

}

}

}

}

}

Anyone has the suggestions for me in this problem?

Attachments: Check part.STEP