private void AddPanels(FloorMounting floor) { // найти блоки панелей-СБ входящих внутрь границ блока стороны фасада var panels = new List<MountingPanel>(); foreach (var panelSb in floor.RemainingPanels) { if (Extents.IsPointInBounds(panelSb.ExtTransToModel.MinPoint) && Extents.IsPointInBounds(panelSb.ExtTransToModel.MaxPoint)) { panels.Add(panelSb); } } Panels.AddRange(panels); floor.RemainingPanels.RemoveAll(p=>panels.Contains(p)); }
public static void AKR_CollectMountPlansTogether(IEnumerable <ObjectId> ids = null) { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; // Выбор блоков if (ids == null) { ids = ed.SelectBlRefs("\nВыбор блоков:").ToArray(); PluginStatisticsHelper.AddStatistic(); } //// Точка соединения всех блоков (точка вставки). //var ptInsert = ed.GetPointWCS("\nТочка вставки:"); using (var t = db.TransactionManager.StartTransaction()) { var cs = db.CurrentSpaceId.GetObject(OpenMode.ForWrite) as BlockTableRecord; var mountBlRefsBySections = new List <FloorMounting>(); AcadLib.Layers.LayerExt.CheckLayerState(SymbolUtilityServices.LayerZeroName); foreach (var idBlRef in ids) { if (!idBlRef.IsValidEx()) { continue; } var blRef = idBlRef.GetObject(OpenMode.ForRead, false, true) as BlockReference; if (blRef == null) { continue; } if (blRef.Name.StartsWith(Settings.Default.BlockPlaneMountingPrefixName)) { var floorMount = new FloorMounting(blRef, null); floorMount.DefineStorey(null); mountBlRefsBySections.Add(floorMount); } } // Группировка монтажных планов по x var idsBlRefMount = new List <ObjectId>(); var groupMountPlansByX = mountBlRefsBySections.GroupBy(g => g.PosBlMounting.X, new AcadLib.Comparers.DoubleEqualityComparer(30000)); var pt = Point3d.Origin; foreach (var mountsByX in groupMountPlansByX) { foreach (var mount in mountsByX) { // вставка нового вхождения этого блока var blRefNew = new BlockReference(pt, mount.IdBtrMounting); blRefNew.Layer = SymbolUtilityServices.LayerZeroName; cs.AppendEntity(blRefNew); t.AddNewlyCreatedDBObject(blRefNew, true); idsBlRefMount.Add(blRefNew.Id); } pt = new Point3d(pt.X + mountsByX.Max(m => m.Extents.Diagonal()) + 50000, pt.Y, pt.Z); } ed.Drag(idsBlRefMount.ToArray(), Point3d.Origin); t.Commit(); } }
//public void DefYForUpperAndParapetStorey() //{ // // определение уровней для Ч и П этажей в этом фасаде // // уровеь последнего этажа в фасаде // var floorsNumberType = Floors.Where(f => f.Storey.Type == EnumStorey.Number); // double yLastNumberFloor = 0; // if (floorsNumberType.Count() > 0) // { // yLastNumberFloor = floorsNumberType.Max(f => f.Storey.Y); // } // // чердак // // double yParapet = 0; // var floorUpper = Floors.Where(f => f.Storey.Type == EnumStorey.Upper).FirstOrDefault(); // if (floorUpper != null) // { // //var maxHeightPanel = floorUpper.PanelsSbInFront.Where(p => p.PanelAkr != null)?.Max(p => p.PanelAkr?.HeightPanelByTile); // //if (maxHeightPanel.HasValue) // //{ // floorUpper.Storey.Y = yLastNumberFloor + Settings.Default.FacadeFloorHeight; // //yParapet = floorUpper.Storey.Y + maxHeightPanel.Value; // //floorUpper.Height = maxHeightPanel.Value; // //} // } // var floorParapet = Floors.Where(f => f.Storey.Type == EnumStorey.Parapet).FirstOrDefault(); // if (floorParapet != null) // { // yParapet = yParapet != 0 ? yParapet : yLastNumberFloor + Settings.Default.FacadeFloorHeight; // floorParapet.Storey.Y = yParapet; // var maxHeightPanel = floorParapet.PanelsSbInFront.Where(p => p.PanelAkr != null)?.Max(p => p.PanelAkr?.HeightPanelByTile); // if (maxHeightPanel.HasValue) // { // floorParapet.Height = maxHeightPanel.Value; // } // } //} private static void captionFloor(double x, double yFloor, FloorMounting floor, BlockTableRecord ms, Transaction t) { // Подпись номера этажа DBText textFloor = new DBText(); textFloor.SetDatabaseDefaults(ms.Database); textFloor.Annotative = AnnotativeStates.False; textFloor.Height = Settings.Default.FacadeCaptionFloorTextHeight;// 250;// FacadeCaptionFloorTextHeight textFloor.TextString = floor.Storey.ToString(); var height =floor.Storey.Height != 0? floor.Storey.Height: 2000; textFloor.Position = new Point3d(x - Settings.Default.FacadeCaptionFloorIndent, yFloor + (height * 0.5), 0); ms.AppendEntity(textFloor); t.AddNewlyCreatedDBObject(textFloor, true); }