Exemple #1
0
        /// <summary>
        /// Create a new (or update an existing) panel element in the model
        /// </summary>
        /// <param name="geometry">The set-out geometry of the element</param>
        /// <param name="exInfo">Optional.  The execution information of the current action.
        /// If an object has been created previously with matching execution information then
        /// instead of creating a new item this previous one will be updated and returned instead.
        /// This enables this method to be used parametrically.</param>
        /// <returns>A new or previously created Panel elemet</returns>
        public PanelElement PanelElement(Surface geometry, ExecutionInfo exInfo = null)
        {
            PanelElement result = new PanelElement();

            result = Model.History.Update(exInfo, result);
            result.ReplaceGeometry(geometry);
            Model.Add(result);
            return(result);
        }
Exemple #2
0
        /// <summary>
        /// Create a new (or update an existing) panel element as a copy of another one
        /// </summary>
        /// <param name="element">The element to copy.</param>
        /// <param name="newGeometry">Optional.  The set-out geometry to be used for the new element.</param>
        /// <param name="exInfo">Optional.  The execution information of the current action.
        /// If an object has been created previously with matching execution information then
        /// instead of creating a new item this previous one will be updated and returned instead.
        /// This enables this method to be used parametrically.</param>
        /// <returns></returns>
        public PanelElement CopyOf(PanelElement element, Surface newGeometry = null, ExecutionInfo exInfo = null)
        {
            PanelElement result = element.Duplicate();

            result = (PanelElement)Model.History.Update(exInfo, result);
            if (newGeometry != null)
            {
                result.ReplaceGeometry(newGeometry);
            }
            Model.Add(result);
            return(result);
        }
Exemple #3
0
        /// <summary>
        /// Create a copy of an element from another model inside this one.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public PanelElement CopyFromAnotherModel(PanelElement element)
        {
            Model         oldModel   = element.Model;
            ExecutionInfo exInfo     = oldModel.History.ExecutionInfoFor(element);
            PanelElement  newElement = CopyOf(element, null, exInfo);

            if (element.Family != null)
            {
                ExecutionInfo famExInfo = oldModel.History.ExecutionInfoFor(element.Family);
                newElement.Family = CopyOf(element.Family, famExInfo);
            }
            //TODO: Copy other properties?
            return(newElement);
        }
 public ICoordinateSystem GetCoordinateSystem(PanelElement element)
 {
     return(element.LocalCoordinateSystem());
 }