private static bool RecAddRbToFg(_AcDb.Entity rb, FgRbStructureInTrans stru, Dictionary <_AcDb.ObjectId, FgRbStructureInTrans> fgRbStructs) { var blockRef = rb as _AcDb.BlockReference; if (IsPosInFg(blockRef.Position, stru.FlaechenGrenze)) { foreach (var inner in stru.Inseln) { if (IsPosInFg(blockRef.Position, inner)) { var innerStru = fgRbStructs[inner.Id]; if (RecAddRbToFg(rb, innerStru, fgRbStructs)) { return(true); } } } stru.Raumbloecke.Add(rb); return(true); } return(false); }
internal static Dictionary <_AcDb.ObjectId, FgRbStructure> GetFgRbStructs(string rbName, string fgLayer, string afLayer, _AcDb.Database db) { NrOfOverlaps = 0; OrphanRaumblocks.Clear(); var structs = new Dictionary <_AcDb.ObjectId, FgRbStructureInTrans>(); using (var tr = db.TransactionManager.StartTransaction()) { var fgs = new List <_AcDb.Entity>(); var azf = new List <_AcDb.Entity>(); var rbs = new List <_AcDb.Entity>(); // Open the blocktable, get the modelspace GetAllFgsAbzsAndRbs(rbName, fgLayer, afLayer, db, tr, fgs, azf, rbs); foreach (var fg in fgs) { var fgRbStruct = new FgRbStructureInTrans() { FlaechenGrenze = fg }; // get inner polylines and rbs to ignore foreach (var inner in fgs) { if (PolyInPoly(tr, inner, fg)) { fgRbStruct.Inseln.Add(inner); } } foreach (var inner in azf) { if (PolyInPoly(tr, inner, fg)) { fgRbStruct.Abzugsflaechen.Add(inner); } } structs.Add(fg.Id, fgRbStruct); } foreach (var rb in rbs) { bool added = false; foreach (var stru in structs.Values) { if (RecAddRbToFg(rb, stru, structs)) { added = true; break; } } if (!added) { OrphanRaumblocks.Add(rb.Id); } } tr.Commit(); } return(AsFgRbStructs(structs)); }