Message 1 of 2
CheckInterference - running time too long
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I have a function for checking overlapping Solid3D entities. This function works well and it is very accuracy.
But in cases where you need check really lots of entities is there problem with CheckInterference function.
This command takes almost 99 % elapsed time this function and this is problem for me.
Does anybody have experiences with this?... or any advices?
public static bool CheckConnectorsOverlap(List connWrap, CoreDatabase data, List currentList) { try { List overlapChecker = new List(); List listOfTransformedEntity = new List(); var groupResult = connWrap.GroupBy(x => x.ParentID).Select(y => y.ToList()).ToList(); foreach (List entitiesList in groupResult) { foreach (EntityWrapper entityWraper in entitiesList) { Solid3d solid3DEntity = (Solid3d)entityWraper.Entity.Clone(); for (int i = entityWraper.PartenList.Count - 1; i >= 0; i--) { solid3DEntity.TransformBy(entityWraper.PartenList[i].BlockTransform); } var filterResult = groupResult.Where(x => x.First().ParentID != entitiesList.First().ParentID); foreach (List subEntitiesList in filterResult) { foreach (EntityWrapper subEntityWraper in subEntitiesList) { Solid3d subSolid3DEntity = (Solid3d)subEntityWraper.Entity.Clone(); for (int i = subEntityWraper.PartenList.Count - 1; i >= 0; i--) { subSolid3DEntity.TransformBy(subEntityWraper.PartenList[i].BlockTransform); } try { if (solid3DEntity.CheckInterference(subSolid3DEntity) == true) { if (overlapChecker.Contains($"{entityWraper.ParentID};{subEntityWraper.ParentID}") == false) { data.ErrorList.Add($"WARNING: Connector| { entityWraper.ParentName} X: { Math.Round(solid3DEntity.MassProperties.Centroid.X, 2)} Y: { Math.Round(solid3DEntity.MassProperties.Centroid.Y, 2)} Z: { Math.Round(solid3DEntity.MassProperties.Centroid.Z, 2)} overlaps Connector: { subEntityWraper.ParentName} X: { Math.Round(subSolid3DEntity.MassProperties.Centroid.X, 2)} Y: {Math.Round(subSolid3DEntity.MassProperties.Centroid.Y, 2)} Z: { Math.Round(subSolid3DEntity.MassProperties.Centroid.Z, 2)}"); overlapChecker.Add($"{entityWraper.ParentID};{subEntityWraper.ParentID}"); overlapChecker.Add($"{subEntityWraper.ParentID};{entityWraper.ParentID}"); } } } catch { } } } } } return true; } catch { return false; } }
...