Ejemplo n.º 1
0
        /// <summary>
        /// Construct this type from an existing Revit element.
        /// </summary>
        /// <param name="dividedSurface"></param>
        /// <param name="isRevitOwned"></param>
        /// <returns></returns>
        internal static DividedSurface FromExisting(Autodesk.Revit.DB.DividedSurface dividedSurface, bool isRevitOwned)
        {
            if (dividedSurface == null)
            {
                throw new ArgumentNullException("dividedSurface");
            }

            return(new DividedSurface(dividedSurface)
            {
                IsRevitOwned = isRevitOwned
            });
        }
Ejemplo n.º 2
0
 public static DividedSurface Wrap(Autodesk.Revit.DB.DividedSurface ele, bool isRevitOwned)
 {
     return(DividedSurface.FromExisting(ele, isRevitOwned));
 }
Ejemplo n.º 3
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            var result = new List <List <FamilyInstance> >();

            //"Get an interface to the divided surfaces on this element."
            //TODO: do we want to select a face instead and try to get
            //the divided surface that way?
            DividedSurfaceData dsd = SelectedElement.GetDividedSurfaceData();

            if (dsd == null)
            {
                throw new Exception("The selected form has no divided surface data.");
            }

            foreach (Reference r in dsd.GetReferencesWithDividedSurfaces())
            {
                Autodesk.Revit.DB.DividedSurface ds = dsd.GetDividedSurfaceForReference(r);

                var gn = new GridNode();

                int u = 0;
                while (u < ds.NumberOfUGridlines)
                {
                    var lst = new List <FamilyInstance>();

                    gn.UIndex = u;

                    int v = 0;
                    while (v < ds.NumberOfVGridlines)
                    {
                        gn.VIndex = v;

                        //"Reports whether a grid node is a "seed node," a node that is associated with one or more tiles."
                        if (ds.IsSeedNode(gn))
                        {
                            FamilyInstance fi
                                = ds.GetTileFamilyInstance(gn, 0);

                            //put the family instance into the tree
                            lst.Add(fi);
                        }
                        v = v + 1;
                    }

                    //don't add list if it's empty
                    if (lst.Any())
                    {
                        result.Add(lst);
                    }

                    u = u + 1;
                }
            }

            _data = Value.NewList(
                Utils.SequenceToFSharpList(
                    result.Select(
                        row => Value.NewList(
                            Utils.SequenceToFSharpList(
                                row.Select(Value.NewContainer))))));

            return(_data);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Construct from an existing Element.  The resulting object is Dynamo owned.
 /// </summary>
 /// <param name="divSurf"></param>
 private DividedSurface(Autodesk.Revit.DB.DividedSurface divSurf)
 {
     InternalSetDividedSurface(divSurf);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Method to set the internal divided surface, id, and unique id
 /// </summary>
 /// <param name="divSurf"></param>
 private void InternalSetDividedSurface(Autodesk.Revit.DB.DividedSurface divSurf)
 {
     this.InternalDividedSurface = divSurf;
     this.InternalElementId      = divSurf.Id;
     this.InternalUniqueId       = divSurf.UniqueId;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Method to set the internal divided surface, id, and unique id
 /// </summary>
 /// <param name="divSurf"></param>
 private void InternalSetDividedSurface(Autodesk.Revit.DB.DividedSurface divSurf)
 {
     this.InternalDividedSurface = divSurf;
     this.InternalElementId = divSurf.Id;
     this.InternalUniqueId = divSurf.UniqueId;
 }