@@ -523,22 +523,46 @@ private bool CreateCollection(IEnumerable<Panel> bhomPanels)
523
523
524
524
if ( ( openMin . Z . ToInch ( ) >= ramStory . dElevation - ramStory . dFlrHeight ) && ( openMin . Z . ToInch ( ) < ramStory . dElevation ) )
525
525
{
526
- //Get opening on wall extents
527
- if ( ! ( outline . IsContaining ( openOutline , false ) ) )
526
+ IFinalWallOpenings ramWallOpenings = ramWall . GetFinalOpenings ( ) ;
527
+
528
+ int openOverlapCount = 0 ;
529
+
530
+ for ( int j = 0 ; i < ramWallOpenings . GetCount ( ) ; j ++ )
528
531
{
529
- openOutline = outline . BooleanIntersection ( openOutline ) [ 0 ] ;
530
- Engine . Reflection . Compute . RecordWarning ( "Panel " + name + " opening intersects wall boundary. Boolean intersection was used to get opening extents on panel." ) ;
532
+ IFinalWallOpening testOpen = ramWallOpenings . GetAt ( j ) ;
533
+ IPoints openingPts = testOpen . GetOpeningVertices ( ) ;
534
+
535
+ //Re-add first point to close Polygon
536
+ IPoint firstOPt = openingPts . GetAt ( 0 ) ;
537
+ SCoordinate firstOCoord = new SCoordinate ( ) ;
538
+ firstOPt . GetCoordinate ( ref firstOCoord ) ;
539
+ openingPts . Add ( firstOCoord ) ;
540
+
541
+ Polyline wallOpeningOutline = openingPts . ToPolyline ( ) ;
542
+ List < Point > intPts = wallOpeningOutline . ICurveIntersections ( openOutline ) ;
543
+ if ( wallOpeningOutline . IsContaining ( openOutline ) || openOutline . IsContaining ( wallOpeningOutline ) || intPts . Count > 0 )
544
+ { openOverlapCount += 1 ; }
531
545
}
532
546
533
- Point closestOpenPt = BH . Engine . Geometry . Query . ClosestPoint ( wallMin , openOutline . ControlPoints ( ) ) ;
534
- double distX = Math . Sqrt ( Math . Pow ( closestOpenPt . X - wallMin . X , 2 ) + Math . Pow ( closestOpenPt . Y - wallMin . Y , 2 ) ) ;
535
- double distZinch = openBounds . Min . Z . ToInch ( ) - ( ramStory . dElevation - ramStory . dFlrHeight ) ;
536
- double openWidth = Math . Sqrt ( Math . Pow ( openBounds . Max . X - openBounds . Min . X , 2 ) + Math . Pow ( openBounds . Max . Y - openBounds . Min . Y , 2 ) ) ;
537
- double openHt = openBounds . Max . Z - openBounds . Min . Z ;
538
-
539
- //Add opening to RAM
540
- IRawWallOpenings ramWallOpenings = ramWall . GetRawOpenings ( ) ;
541
- ramWallOpenings . Add ( EDA_MEMBER_LOC . eBottomStart , distX . ToInch ( ) , distZinch , openWidth . ToInch ( ) , openHt . ToInch ( ) ) ;
547
+ if ( openOverlapCount == 0 )
548
+ {
549
+ //Get opening on wall extents
550
+ if ( ! ( outline . IsContaining ( openOutline , false ) ) )
551
+ {
552
+ openOutline = outline . BooleanIntersection ( openOutline ) [ 0 ] ;
553
+ Engine . Reflection . Compute . RecordWarning ( "Panel " + name + " opening intersects wall boundary. Boolean intersection was used to get opening extents on panel." ) ;
554
+ }
555
+
556
+ Point closestOpenPt = BH . Engine . Geometry . Query . ClosestPoint ( wallMin , openOutline . ControlPoints ( ) ) ;
557
+ double distX = Math . Sqrt ( Math . Pow ( closestOpenPt . X - wallMin . X , 2 ) + Math . Pow ( closestOpenPt . Y - wallMin . Y , 2 ) ) ;
558
+ double distZinch = openBounds . Min . Z . ToInch ( ) - ( ramStory . dElevation - ramStory . dFlrHeight ) ;
559
+ double openWidth = Math . Sqrt ( Math . Pow ( openBounds . Max . X - openBounds . Min . X , 2 ) + Math . Pow ( openBounds . Max . Y - openBounds . Min . Y , 2 ) ) ;
560
+ double openHt = openBounds . Max . Z - openBounds . Min . Z ;
561
+
562
+ //Add opening to RAM
563
+ IRawWallOpenings ramRawWallOpenings = ramWall . GetRawOpenings ( ) ;
564
+ ramRawWallOpenings . Add ( EDA_MEMBER_LOC . eBottomStart , distX . ToInch ( ) , distZinch , openWidth . ToInch ( ) , openHt . ToInch ( ) ) ;
565
+ }
542
566
}
543
567
}
544
568
}
@@ -592,17 +616,20 @@ private bool CreateCollection(IEnumerable<Level> bhomLevels)
592
616
for ( int i = 0 ; i < sortedBhomLevels . Count ( ) ; i ++ )
593
617
{
594
618
Level level = sortedBhomLevels . ElementAt ( i ) ;
595
- double levelHt = level . Elevation . ToInch ( ) ;
619
+ double levelHtDbl = level . Elevation . ToInch ( ) ;
620
+ double levelHt = Math . Round ( levelHtDbl , 3 ) ;
596
621
597
622
// Get elevations and skip if level elevation already in RAM
598
623
ramStories = m_Model . GetStories ( ) ;
599
624
List < double > ramElevs = new List < double > ( ) ;
625
+ List < string > ramStoryNames = new List < string > ( ) ;
600
626
for ( int j = 0 ; j < ramStories . GetCount ( ) ; j ++ )
601
627
{
602
628
ramElevs . Add ( ramStories . GetAt ( j ) . dElevation ) ;
629
+ ramStoryNames . Add ( ramStories . GetAt ( j ) . strLabel ) ;
603
630
}
604
631
605
- if ( ramElevs . Contains ( levelHt ) != true )
632
+ if ( ramElevs . Contains ( levelHt ) != true && ramStoryNames . Contains ( level . Name ) != true )
606
633
{
607
634
double height ;
608
635
// Ground floor ht = 0 for RAM
@@ -631,9 +658,10 @@ private bool CreateCollection(IEnumerable<Level> bhomLevels)
631
658
Boolean floorTypeExists = false ;
632
659
for ( int j = 0 ; j < ramFloorTypes . GetCount ( ) ; j ++ )
633
660
{
634
- if ( ramFloorTypes . GetAt ( j ) . strLabel == level . Name )
661
+ IFloorType testFloorType = ramFloorTypes . GetAt ( j ) ;
662
+ if ( testFloorType . strLabel == level . Name )
635
663
{
636
- ramFloorType = ramFloorTypes . GetAt ( j ) ;
664
+ ramFloorType = testFloorType ;
637
665
floorTypeExists = true ;
638
666
}
639
667
}
@@ -653,7 +681,6 @@ private bool CreateCollection(IEnumerable<Level> bhomLevels)
653
681
{
654
682
IStory ramStoryBelow = ramStories . GetAt ( newIndex - 1 ) ;
655
683
height = levelHt - ramStoryBelow . dElevation ;
656
-
657
684
}
658
685
659
686
// Insert story at index
0 commit comments