/// <summary> /// Draws the arrow. /// </summary> /// <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 arrow</returns> public static ObjectId DrawArrow(this ArrowDirection arrow, Point3d insertionPoint, Double rotation, String blockDirPath, Transaction tr) { //Se realiza la selección del archivo. String pth = Path.Combine(blockDirPath, FOLDER_MISC); FileInfo[] files; if (Directory.Exists(pth)) { files = new DirectoryInfo(pth).GetFiles(); } else { files = new FileInfo[0]; } string arrowName = arrow.GetArrowDirectionName(); FileInfo arrowFile = files.FirstOrDefault(x => x.Name.ToUpper() == String.Format("{0}.DWG", arrowName).ToUpper()); if (arrowFile != null && arrowFile.Exists) { AutoCADBlock arrowBlock = new AutoCADBlock(String.Format(SUFFIX_ARROW, arrowName), arrowFile, tr); BlockTableRecord currentSpace = (BlockTableRecord)Application.DocumentManager.MdiActiveDocument.Database.CurrentSpaceId.GetObject(OpenMode.ForWrite); BlockReference blkRef = arrowBlock.CreateReference(insertionPoint, rotation, 1); return(blkRef.Draw(currentSpace, tr)); } else { throw new RivieraException(String.Format(ERR_MISS_ARROW, arrowName, pth)); } }
/// <summary> /// Sows as L panel. /// </summary> /// <param name="doc">The active document.</param> /// <param name="tr">The active transaction.</param> protected RivieraObject InsertLPanel(RivieraObject obj, ArrowDirection direction, params RivieraMeasure[] sizes) { //1: Se calcula la dirección y orientación del panel Point3d end, start; //Siempre se inserta en la posición inicial del bloque insertado //Selección de la dirección start = obj.Start.ToPoint3d(); end = direction.IsFront() ? start.ToPoint2d().ToPoint2dByPolar(1, obj.Angle).ToPoint3d() //Misma dirección : start.ToPoint2d().ToPoint2dByPolar(1, obj.Angle + Math.PI).ToPoint3d(); //Dirección Invertida //Selección de la rotación SweepDirection rotation = direction.IsLeft() ? SweepDirection.Counterclockwise : SweepDirection.Clockwise; //Seleccion de tipo de L BordeoLPanelAngle lAng = direction.GetArrowDirectionName().Contains("90") ? BordeoLPanelAngle.ANG_90 : BordeoLPanelAngle.ANG_135; //Se convierten los tamaños a tamaños de bordeo IEnumerable <LPanelMeasure> pSizes = sizes.Select(x => x as LPanelMeasure); //El panel inferios se usa como distancia base del arreglo de paneles. var first = sizes[0] as LPanelMeasure; //Se crea el panel BordeoLPanelStack stack = new BordeoLPanelStack(start, end, first, rotation, lAng); //Se agregan los tamaños superiores for (int i = 1; i < sizes.Length; i++) { stack.AddPanel(sizes[i] as LPanelMeasure); } //Se dibuja en el plano y se borra el panel anterior RivieraObject objParent = obj.GetParent(); this.DrawObjects((Document doc, Transaction tr, RivieraObject[] objs) => obj.Delete(tr), stack); if (objParent != null) { objParent.Connect(direction, stack); } else { var db = App.Riviera.Database.Objects; if (db.FirstOrDefault(x => x.Handle.Value == stack.Handle.Value) == null) { db.Add(stack); } } //Se regresa el stack como objeto creado return(stack); }
/// <summary> /// Picks the riviera sizes. /// </summary> /// <param name="dir">The arrow direction.</param> /// <returns> /// The Riviera measure /// </returns> public override RivieraMeasure[] PickSizes(ArrowDirection dir) { TabBordeoMenu ctrl = this.Menu as TabBordeoMenu; RivieraMeasure[] sizes; if (dir == ArrowDirection.FRONT || dir == ArrowDirection.BACK) { sizes = ctrl.GetLinearPanels().ToArray(); } else if (dir.GetArrowDirectionName().Contains("90")) { sizes = ctrl.GetL90Panels().ToArray(); } else { sizes = ctrl.GetL135Panels().ToArray(); } return(sizes); }
/// <summary> /// Connects the specified object to this instance /// </summary> /// <param name="direction">The direction.</param> /// <param name="stack">The new bject to connect.</param> public virtual void Connect(ArrowDirection direction, RivieraObject newObject) { newObject.Parent = this.Handle.Value; String key = direction.GetArrowDirectionName(); if (this.Children.ContainsKey(key)) { this.Children[key] = newObject.Handle.Value; } else { this.Children.Add(key, newObject.Handle.Value); } var db = App.Riviera.Database.Objects; if (db.FirstOrDefault(x => x.Handle.Value == newObject.Handle.Value) == null) { db.Add(newObject); } }
/// <summary> /// Determines whether this instance is back. /// </summary> /// <param name="arrow">The arrow.</param> /// <returns> /// <c>true</c> if the specified arrow is back; otherwise, <c>false</c>. /// </returns> public static Boolean IsBack(this ArrowDirection arrow) { return(arrow.GetArrowDirectionName().Contains(KEY_DIR_BACK)); }
/// <summary> /// Determines whether this instance is right. /// </summary> /// <param name="arrow">The arrow.</param> /// <returns> /// <c>true</c> if the specified arrow is right; otherwise, <c>false</c>. /// </returns> public static Boolean IsRight(this ArrowDirection arrow) { return(arrow.GetArrowDirectionName().Contains(KEY_DIR_TAG_RGT)); }
/// <summary> /// Determines whether this instance is front. /// </summary> /// <param name="arrow">The arrow.</param> /// <returns> /// <c>true</c> if the specified arrow is front; otherwise, <c>false</c>. /// </returns> public static Boolean IsFront(this ArrowDirection arrow) { return(arrow.GetArrowDirectionName().Contains(KEY_DIR_FRONT)); }