Example #1
0
        public static BHE.Opening ToBHoM(this BHX.Opening gbOpening)
        {
            BHE.Opening opening = new BHE.Opening();

            BHG.Polyline pLine = gbOpening.PlanarGeometry.PolyLoop.ToBHoM();
            opening.Edges = pLine.ToEdges();

            string[] cadSplit = gbOpening.CADObjectID.Split('[');
            if (cadSplit.Length > 0)
            {
                opening.Name = cadSplit[0].Trim();
            }
            if (cadSplit.Length > 1)
            {
                BHP.OriginContextFragment envContext = new BHP.OriginContextFragment();
                envContext.ElementID = cadSplit[1].Split(']')[0].Trim();
                envContext.TypeName  = opening.Name;

                if (opening.Fragments == null)
                {
                    opening.Fragments = new List <IBHoMFragment>();
                }
                opening.Fragments.Add(envContext);
            }

            opening.Type = gbOpening.OpeningType.ToBHoMOpeningType();

            return(opening);
        }