/// <summary> /// Executes the command. /// Creates, gets parameters and add a Concentrated line load to the selected line elements. /// </summary> /// <param name="services">CommandServices object to interact with the system</param> public override void Run(Canguro.Controller.CommandServices services) { ConcentratedSpanLoad load = new ConcentratedSpanLoad(); //services.GetProperties(Title, load, false); if (Canguro.Controller.Grid.LoadEditFrm.EditLoad(load) == System.Windows.Forms.DialogResult.OK) { List<Item> selection = services.GetSelection(); foreach (Item item in selection) { if (item is LineElement) ((LineElement)item).Loads.Add((ConcentratedSpanLoad)load.Clone()); } } }
/// <summary> /// Relocates a ConcentratedSpanLoad between the line element where it is and a new adjacent line element. /// </summary> /// <param name="newLineLoads">The AssignedLoads object of the new Line Element</param> /// <param name="lc">The Load Case to which the load belongs.</param> /// <param name="x">The dividing point of the two line elements [0, 1]</param> /// <param name="load">The Load to distribute in two elements</param> /// <returns>true if the load was moved to the new Line Element (so the caller removes it). false otherwise.</returns> private static bool RelocateConcentratedLoads(AssignedLoads newLineLoads, LoadCase lc, float x, ConcentratedSpanLoad load) { if (x > load.D) { load.D = load.D / x; return false; } else { load = (ConcentratedSpanLoad)load.Clone(); load.Id = 0; load.D = (load.D - x) / (1f - x); newLineLoads.Add(load, lc); return true; } }