public static double GetDepth(StbSections sections, StbSlab slab) { double depth = 0; switch (slab.kind_structure) { case StbSlabKind_structure.RC: object[] slabRc = sections.StbSecSlab_RC.First(sec => sec.id == slab.id_section).StbSecFigureSlab_RC.Items; switch (slabRc.Length) { case 1: var straight = slabRc[0] as StbSecSlab_RC_Straight; depth = straight.depth; break; case 2: var tapers = new[] { slabRc[0] as StbSecSlab_RC_Taper, slabRc[1] as StbSecSlab_RC_Taper }; depth = tapers.First(sec => sec.pos == StbSecSlab_RC_TaperPos.TIP).depth; break; case 3: var haunches = new[] { slabRc[0] as StbSecSlab_RC_Haunch, slabRc[1] as StbSecSlab_RC_Haunch, slabRc[2] as StbSecSlab_RC_Haunch }; depth = haunches.First(sec => sec.pos == StbSecSlab_RC_HaunchPos.CENTER).depth; break; } break; case StbSlabKind_structure.DECK: depth = sections.StbSecSlabDeck.FirstOrDefault(sec => sec.id == slab.id_section).StbSecFigureSlabDeck.StbSecSlabDeckStraight.depth; break; case StbSlabKind_structure.PRECAST: depth = sections.StbSecSlabPrecast.FirstOrDefault(sec => sec.id == slab.id_section).StbSecFigureSlabPrecast.StbSecSlabPrecastStraight.depth_concrete; break; default: throw new ArgumentOutOfRangeException(); } return(depth); }
private static void SetSectionInfo(StbSections sections, GH_Structure <GH_String> ghSecStrings, StbSlab slab, int index) { string secId = slab.id_section; var ghPath = new GH_Path(0, index); StbSlabKind_structure kindStruct = slab.kind_structure; switch (kindStruct) { case StbSlabKind_structure.RC: StbSecSlab_RC secRc = sections.StbSecSlab_RC.First(i => i.id == secId); foreach (object figure in secRc.StbSecFigureSlab_RC.Items) { ghSecStrings.AppendRange(TagUtils.GetSlabRcSection(figure, secRc.strength_concrete), ghPath); } break; case StbSlabKind_structure.DECK: StbSecSlabDeck secDeck = sections.StbSecSlabDeck.First(i => i.id == secId); ghSecStrings.AppendRange(TagUtils.GetSlabDeckSection(secDeck.StbSecFigureSlabDeck.StbSecSlabDeckStraight, secDeck.strength_concrete), ghPath); break; case StbSlabKind_structure.PRECAST: StbSecSlabPrecast secPrecast = sections.StbSecSlabPrecast.First(i => i.id == secId); ghSecStrings.AppendRange(TagUtils.GetSlabPrecastSection(secPrecast.precast_type, secPrecast.StbSecProductSlabPrecast, secPrecast.strength_concrete), ghPath); break; default: throw new ArgumentOutOfRangeException(nameof(kindStruct), kindStruct, null); } }