/// <summary>
        /// Draws the available arrows.
        /// </summary>
        /// <param name="rivieraEntity">The riviera entity.</param>
        /// <param name="arrow">The arrow direction.</param>
        /// <param name="blockDirPath">The Design line bloick directory path.</param>
        /// <param name="insertionPoint">The insertion point.</param>
        /// <param name="rotation">The arrwo rotation.</param>
        /// <param name="tr">The active transaction.</param>
        /// <returns>The drew the available arrows</returns>
        public static ObjectIdCollection DrawArrows(this ISowable rivieraEntity, Func <ArrowDirection, Boolean> filter, Point3d insertionPoint, Double rotation, String blockDirPath, Transaction tr)
        {
            ObjectIdCollection           ids    = new ObjectIdCollection();
            IEnumerable <ArrowDirection> arrows = rivieraEntity.GetAvailableDirections().Where(x => filter(x));

            arrows.ToList().ForEach(x => ids.Add(x.DrawArrow(insertionPoint, rotation, blockDirPath, tr)));
            return(ids);
        }
        /// <summary>
        /// Gets the arrow direction.
        /// </summary>
        /// <returns>The selected arrow direction</returns>
        public static ArrowDirection GetDirection(this ISowable rivieraEntity, Transaction tr)
        {
            ObjectId id;

            if (Picker.ObjectId(MSG_SEL_ARROW_DIR, out id, typeof(BlockReference)))
            {
                BlockReference block   = id.Open <BlockReference>(tr);
                string         suffix  = SUFFIX_ARROW.Replace("{0}", ""),
                               blkName = block.Name.Replace(suffix, "");
                return(blkName.GetArrowDirection());
            }
            else
            {
                return(ArrowDirection.NONE);
            }
        }
        /// <summary>
        /// Defines the transaction that draws the arrows of a Bordeo Entity
        /// </summary>
        /// <param name="doc">The active document.</param>
        /// <param name="tr">The active transaction.</param>
        /// <param name="input">The transaction input, needs a <see cref="ISowable"/>,a <see cref="RivieraObject"/>, start point flag as <see cref="Boolean"/> and
        /// end point flag as <see cref="Boolean"/>.</param>
        /// <returns>The arrows drew ids</returns>
        private static ObjectIdCollection DrawArrows(Document doc, Transaction tr, params Object[] input)
        {
            ISowable sowEnt        = (ISowable)input[0];
            Boolean  atStart       = (Boolean)input[1],
                     atEnd         = (Boolean)input[2];
            RivieraObject      obj = (RivieraObject)input[3];
            ObjectIdCollection ids = new ObjectIdCollection();

            if (atStart)
            {
                foreach (ObjectId id in sowEnt.DrawArrows(BordeoGeometryUtils.IsBack, obj.Start.ToPoint3d(), obj.Angle, tr))
                {
                    ids.Add(id);
                }
            }
            if (atEnd)
            {
                foreach (ObjectId id in sowEnt.DrawArrows(BordeoGeometryUtils.IsFront, obj.End.ToPoint3d(), obj.Angle, tr))
                {
                    ids.Add(id);
                }
            }
            return(ids);
        }
Beispiel #4
0
        /// <summary>
        /// Picks the arrow.
        /// </summary>
        /// <param name="sowEntity">The sow entity.</param>
        /// <param name="rivObject">The riv object.</param>
        /// <param name="atStartPoint">if set to <c>true</c> [at start point].</param>
        /// <param name="atEndPoint">if set to <c>true</c> [at end point].</param>
        public override ArrowDirection PickArrow(ISowable sowEntity, Boolean atStartPoint = false, Boolean atEndPoint = false)
        {
            Editor        ed        = Application.DocumentManager.MdiActiveDocument.Editor;
            RivieraObject rivObject = (RivieraObject)sowEntity;
            String        keyFront  = ArrowDirection.FRONT.GetArrowDirectionName(),
                          keyBack   = ArrowDirection.BACK.GetArrowDirectionName();

            atStartPoint = !rivObject.Children.ContainsKey(keyBack) || rivObject.Children[keyBack] == 0;
            atEndPoint   = !rivObject.Children.ContainsKey(keyFront) || rivObject.Children[keyFront] == 0;
            if (!atStartPoint && !atEndPoint)
            {
                return(ArrowDirection.NONE);
            }
            var drewIds = BordeoAutoCADTransactions.DrawArrows(sowEntity, rivObject, atStartPoint, atEndPoint);

            //Se borra las direcciones de los tamaños no soportados
            //this.EraseUnsupportedDirections(drewIds);
            rivObject.ZoomAt(2.5d);
            ed.Regen();
            ArrowDirection direction = AutoCADTransactions.PickArrowDirection(sowEntity, drewIds);

            ed.Regen();
            return(direction);
        }
Beispiel #5
0
 /// <summary>
 /// Picks an arrow direction.
 /// After the arrow is selected, the other arrows are erased.
 /// </summary>
 /// <param name="sowEntity">The sow entity.</param>
 /// <param name="arrowsIds">The arrows ids.</param>
 /// <returns>The picked arrow direction</returns>
 public static ArrowDirection PickArrowDirection(ISowable sowEntity, ObjectIdCollection arrowsIds)
 {
     return(new TransactionWrapper <Object, ArrowDirection>(AutoCADTransactions.PickAndEraseArrows).Run(sowEntity, arrowsIds));
 }
 /// <summary>
 /// Draws the arrows.
 /// </summary>
 /// <param name="sowEntity">The sow entity.</param>
 /// <param name="rivObject">The riviera object.</param>
 /// <param name="atStartPoint">if set to <c>true</c> draw arrows [at start point].</param>
 /// <param name="atEndPoint">if set to <c>true</c> draw arrows [at end point].</param>
 /// <returns></returns>
 public static ObjectIdCollection DrawArrows(ISowable sowEntity, RivieraObject rivObject, Boolean atStartPoint = false, Boolean atEndPoint = false)
 {
     return(new TransactionWrapper <Object, ObjectIdCollection>(BordeoAutoCADTransactions.DrawArrows).Run(sowEntity, atStartPoint, atEndPoint, rivObject));
 }
Beispiel #7
0
 /// <summary>
 /// Picks the arrow.
 /// </summary>
 /// <param name="sowEntity">The sow entity.</param>
 /// <param name="atStartPoint">if set to <c>true</c> [at start point].</param>
 /// <param name="atEndPoint">if set to <c>true</c> [at end point].</param>
 public abstract ArrowDirection PickArrow(ISowable sowEntity, Boolean atStartPoint = false, Boolean atEndPoint = false);