private bool CheckComponentsIntersection2(Component2 cut, Feature feat, Component2 parentControl) { object boxb1 = cut.GetBox(true, true); object boxb2 = new object(); object boxb3 = parentControl.GetBox(true, true); //int count=0; //var faces = feat.GetFaces(); //double[] faceBox = null; //foreach (var f in faces) //{ // faceBox = (((Face)(f)).GetBody() as Body).GetBodyBox(); // //if ((boxb2 as double[]) == null) // // boxb2 = new double[6]; //} //if (faceBox != null) // boxb2 = faceBox; //else feat.GetBox(ref boxb2); if ((boxb2 as double[]) != null && boxb1 != null && boxb3 != null) { var box1 = (double[])boxb1; double xs1 = box1[0]; double ys1 = box1[1]; double zs1 = box1[2]; double xs2 = box1[3]; double ys2 = box1[4]; double zs2 = box1[5]; var box3 = (double[])boxb3; var box2 = (double[])boxb2; double xf1 = box2[0]; double yf1 = box2[1]; double zf1 = box2[2] + box3[2]; double xf2 = box2[3]; double yf2 = box2[4]; double zf2 = box2[5] + box3[5]; if ((((xf1 > xs1 && xf1 < xs2) || (xf1 > xs2 && xf1 < xs1)) && ((yf1 > ys1 && yf1 < ys2) || (yf1 > ys2 && yf1 < ys1)) && ((zf1 > zs1 && zf1 < zs2) || (zf1 > zs2 && zf1 < zs1))) || (((xf2 > xs1 && xf2 < xs2) || (xf2 > xs2 && xf2 < xs1)) && ((yf2 > ys1 && yf2 < ys2) || (yf2 > ys2 && yf2 < ys1)) && ((zf2 > zs1 && zf2 < zs2) || (zf2 > zs2 && zf2 < zs1))) || (((xf2 > xs1 && xf2 < xs2) || (xf2 > xs2 && xf2 < xs1)) && ((yf1 > ys1 && yf1 < ys2) || (yf1 > ys2 && yf1 < ys1)) && ((zf1 > zs1 && zf1 < zs2) || (zf1 > zs2 && zf1 < zs1))) || (((xf2 > xs1 && xf2 < xs2) || (xf2 > xs2 && xf2 < xs1)) && ((yf1 > ys1 && yf1 < ys2) || (yf1 > ys2 && yf1 < ys1)) && ((zf2 > zs1 && zf2 < zs2) || (zf2 > zs2 && zf2 < zs1))) || (((xf2 > xs1 && xf2 < xs2) || (xf2 > xs2 && xf2 < xs1)) && ((yf2 > ys1 && yf2 < ys2) || (yf2 > ys2 && yf2 < ys1)) && ((zf1 > zs1 && zf1 < zs2) || (zf1 > zs2 && zf1 < zs1))) || (((xf1 > xs1 && xf1 < xs2) || (xf1 > xs2 && xf1 < xs1)) && ((yf2 > ys1 && yf2 < ys2) || (yf2 > ys2 && yf2 < ys1)) && ((zf1 > zs1 && zf1 < zs2) || (zf1 > zs2 && zf1 < zs1))) || (((xf1 > xs1 && xf1 < xs2) || (xf1 > xs2 && xf1 < xs1)) && ((yf1 > ys1 && yf1 < ys2) || (yf1 > ys2 && yf1 < ys1)) && ((zf2 > zs1 && zf2 < zs2) || (zf2 > zs2 && zf2 < zs1))) || (((xf1 > xs1 && xf1 < xs2) || (xf1 > xs2 && xf1 < xs1)) && ((yf2 > ys1 && yf2 < ys2) || (yf2 > ys2 && yf2 < ys1)) && ((zf2 > zs1 && zf2 < zs2) || (zf2 > zs2 && zf2 < zs1))) ) return true; else return false; } return false; }