Esempio n. 1
0
        /// <summary>
        /// Change the position of this node, optionally dragging any
        /// attached vertices through the same transformation.
        /// </summary>
        /// <param name="newPosition"></param>
        /// <param name="dragVertices"></param>
        public void MoveTo(Vector newPosition, bool dragVertices = true, ElementCollection excludeElements = null)
        {
            Vector move = newPosition - Position;

            Position = newPosition;
            if (dragVertices)
            {
                foreach (Vertex v in Vertices)
                {
                    if (excludeElements == null || v.Element == null || !excludeElements.Contains(v.Element))
                    {
                        v.Position += move;
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Automatically generate or update levels within this model to match the
        /// positions of horizontal elements
        /// </summary>
        /// <param name="minStoreyHeight">The minimum height above an existing level before a new one will be created</param>
        /// <param name="forElements"></param>
        public void GenerateLevels(double minStoreyHeight = 2.0, ElementCollection forElements = null, ExecutionInfo exInfo = null)
        {
            foreach (Element element in forElements)
            {
                if (element is LinearElement)
                {
                    BoundingBox bBox = element.GetGeometry().BoundingBox;
                    if (bBox.SizeZ < Tolerance.Distance) // Is flat
                    {
                        Level level = Levels.LevelOf(bBox.MidZ, Tolerance.Layer);
                        if (level.Z < bBox.MidZ - minStoreyHeight)
                        {
                            // Create a new level for the element to sit on
                            Create.Level(bBox.MidZ, exInfo);

                            // Hmmm... this could probably be improved a lot!
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Initialise this set to contain the specified base collection of items
 /// </summary>
 /// <param name="collection"></param>
 public LinearElementSet(ElementCollection collection) : base(collection)
 {
 }
Esempio n. 4
0
 /// <summary>
 /// Initialise this set to contain the specified base collection of items
 /// </summary>
 /// <param name="collection"></param>
 public ElementSet(ElementCollection collection) : base(collection)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Initialise a new MultiElementVertex for the specified elements and vertices
 /// </summary>
 /// <param name="elements"></param>
 /// <param name="vertices"></param>
 /// <param name="description"></param>
 public MultiElementVertex(ElementCollection elements, VertexCollection vertices, string description)
 {
     _Description = description;
     _Elements    = elements;
     _Vertices    = vertices;
 }