Message 1 of 7
faceobject.Intersects(faceobject) giving obscure results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I was trying to generate a list of all walls that intersects mep objects(i.e., pipe,ducts)
Below is the code that I have written but its retuning clash for every Elements, also I have checked by drawing lines in from the intersecting curves and its returning obscure lines.
Any Idea why? or am I doing something wrong here?
private IEnumerable<WallPipe> WallMEPfromFace(List<Element> mepElements, List<Element> walls)
{
var allWallFaces = walls.Select(x => new ElemSolidFace()
{
faceList = x.get_Geometry(new Options() { DetailLevel = ViewDetailLevel.Fine }).Cast<Solid>().SelectMany(z => z.Faces.Cast<Face>()),
Elem = x
});
var allMEPFaces = mepElements.Select(x => new ElemSolidFace()
{
faceList = x.get_Geometry(new Options() { DetailLevel = ViewDetailLevel.Fine }).Cast<Solid>().SelectMany(z => z.Faces.Cast<Face>()),
Elem = x
});
return allWallFaces.SelectMany(x =>
{
return allMEPFaces.Select(y =>
{
var MEPfaces = y.faceList;
var WallFaces = x.faceList;
var state = MEPfaces.Any(mf => WallFaces.Any(wf =>
{
Curve curve = null;
var check = wf.Intersect(mf) == FaceIntersectionFaceResult.Intersecting;
var check1 = wf.Intersect(mf, out curve);
if (curve is Line)
{
SMethodsBeta.TransDrawLine(curve as Line, document);
}
return wf.Intersect(mf) == FaceIntersectionFaceResult.Intersecting;
}));
var statetool = MEPfaces.Where(mf => WallFaces.Any(wf => mf.Intersect(wf) == FaceIntersectionFaceResult.Intersecting));
if (state)
{
return new WallPipe() { mepElement = y.Elem, wall = x.Elem };
}
else
{
return null;
}
}).Where(it => it != null);
}).Where(x => x != null);