Exemple #1
0
    public bool Validate(EDeckType type)
    {
        if (deck.Count < Rules.instance._MinimumDeckSize || deck.Count > Rules.instance._MaximumDeckSize)
        {
            UnityEngine.Debug.LogError("Invalid Deck Size " + deck.Count + ". Size must be between "
                                       + Rules.instance._MinimumDeckSize + " and " + Rules.instance._MaximumDeckSize + ". See RuleManager object in the scene.");
            return(false);
        }
        switch (type)
        {
        case EDeckType.Standard:
            break;

        case EDeckType.All_Unique:
            break;

        case EDeckType.Max_Two:
            break;

        case EDeckType.Max_Three:
            break;

        case EDeckType.Max_Four:
            break;

        case EDeckType.No_Rules:
            break;

        default:
            return(false);

            break;
        }
        return(true);
    }
Exemple #2
0
        /***************************************************/

        public static Panel ToBHoMObject(IDeck ramDeck, IModel ramModel, int ramStoryUID)
        {
            //Get panel props
            EDeckType type = ramDeck.eDeckPropType;

            //Find polylines of deck in RAM Model

            //get count of deck polygons
            double deckPolyCount = ramDeck.GetNumFinalPolygons(ramStoryUID);

            if (deckPolyCount == 0)
            {
                Engine.Base.Compute.RecordWarning($"Floor with RAM lUID {ramDeck.lUID} contains no edges.");
                return(null);
            }
            //Initial only gets first outline poly for exterior edge, rest for openings
            IPoints pplPoints = ramDeck.GetFinalPolygon(ramStoryUID, 0);

            //Re-add first point to close Polygon
            IPoint      first      = pplPoints.GetAt(0);
            SCoordinate firstCoord = new SCoordinate();

            first.GetCoordinate(ref firstCoord);
            pplPoints.Add(firstCoord);

            //Create outline polyline
            Polyline outline = ToPolyline(pplPoints);

            //Create opening outlines
            List <ICurve> openingPLs = new List <ICurve>();

            for (int i = 1; i < deckPolyCount; i++)
            {
                IPoints openingPts = ramDeck.GetFinalPolygon(ramStoryUID, i);

                //Re-add first point to close Polygon
                IPoint      firstOPt    = openingPts.GetAt(0);
                SCoordinate firstOCoord = new SCoordinate();
                firstOPt.GetCoordinate(ref firstOCoord);
                openingPts.Add(firstOCoord);

                ICurve openingOutline = ToPolyline(openingPts);

                //Create openings per outline polylines
                openingPLs.Add(openingOutline);
            }

            //Create panel per outline polyline
            List <Opening> bhomOpenings = new List <Opening>();
            Panel          bhomPanel    = Engine.Structure.Create.Panel(outline, bhomOpenings);
            //Create openings per openings polylines
            int numOpenings = openingPLs.Count();

            //Create openings
            for (int i = 0; i < numOpenings; i++)
            {
                Opening bhomOpening = Engine.Structure.Create.Opening(openingPLs[i]);
                bhomOpenings.Add(bhomOpening);
            }

            //Create panel and add attributes;
            bhomPanel.Openings = bhomOpenings;

            HashSet <String> tag = new HashSet <string>();

            tag.Add("Floor");

            bhomPanel.Tags = tag;
            bhomPanel.Name = type.ToString();

            RAMId RAMId = new RAMId();

            RAMId.Id = ramDeck.lUID;
            bhomPanel.SetAdapterId(RAMId);

            return(bhomPanel);
        }