Exemplo n.º 1
0
 public List <XPolygon> Clip(ClipType clipType, XPolygon clip, double scaleBy = 1000)
 {
     return(XPolygon.Clip(clipType, new List <XPolygon>()
     {
         this
     }, new List <XPolygon>()
     {
         clip
     }, scaleBy));
 }
Exemplo n.º 2
0
        private void CreateSlabs(XPreviewBuildingStory story)
        {
            // For which we need the total footprint as defined by the units. But we can't boolean them together
            // because there are gaps between the spaces now - arrrghhhh!

            // Make the corridor polygon and then make each unit and boolean add them.
            XPolygon        corridor = CreateCorridorSpaceProfile(0).Transformed(story.Elements.First().LocalTransform);
            List <XPolygon> results  = new List <XPolygon>()
            {
                corridor
            };

            foreach (XPreviewSpace space in story.Elements.Where(elem => elem is XPreviewSpace space && space.LongName != null))
            {
                // Find the relating unit definition so we can create a polygon the extents of width and depth
                UnitParameters unitdef = unitsToCreate.Find(u => u.UnitType == space.LongName);
                if (unitdef != null)
                {
                    XPolygon fullProfile = unitdef.CreateFullSizeProfile().Transformed(space.LocalTransform);
                    results = XPolygon.Clip(ClipType.ctUnion, results, new List <XPolygon>()
                    {
                        fullProfile
                    });
                }
            }

            // We will place the slab at 0,0,0 on the story
            XPreviewSlab slab = new XPreviewSlab
            {
                Name        = "Slab " + story.StoryNumber,
                ProfilePath = results.First(),
                Thickness   = parameters.InterzoneSlabThickness,
                Container   = story,
                Height      = -parameters.InterzoneSlabThickness
            };
        }