Model Command to Join the Model. Deletes repeated Joints and Lines and isolated Joints.
Inheritance: Canguro.Commands.ModelCommand
Esempio n. 1
0
        public override void Run(Canguro.Controller.CommandServices services)
        {
            List <Item>        selecton = services.GetSelection();
            List <Joint>       joints   = new List <Joint>();
            List <LineElement> lines    = new List <LineElement>();

            foreach (Item item in selecton)
            {
                if (item is Joint)
                {
                    joints.Add((Joint)item);
                }
                else if (item is LineElement)
                {
                    lines.Add((LineElement)item);
                }
            }

            JoinCmd.Intersect(services.Model, joints, lines);
        }
Esempio n. 2
0
        /// <summary>
        /// Executes the command.
        /// Adds a set of Line Elements. Opens a properties window and asks the user for two points or Joints for each one.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            LineElement        line;
            Joint              joint1, joint2;
            LineProps          props    = new StraightFrameProps();
            List <LineElement> newLines = new List <LineElement>();
            List <AreaElement> newAreas = new List <AreaElement>();

            services.GetProperties(Culture.Get("addLineProps"), props);


            try
            {
                while ((joint1 = services.GetJoint(newLines)) != null)
                {
                    services.TrackingService = LineTrackingService.Instance;
                    services.TrackingService.SetPoint(joint1.Position);

                    while ((joint2 = services.GetJoint(newLines)) == joint1)
                    {
                        ;
                    }

                    if (joint2 == null)
                    {
                        services.Model.JointList.Remove(joint1);
                        break;
                    }
                    services.TrackingService = null;

                    services.Model.LineList.Add(line = new LineElement(props, joint1, joint2));
                    newLines.Add(line);

                    // Para que se refleje el cambio inmediatamente
                    services.Model.ChangeModel();
                }
            }
            catch (Canguro.Controller.CancelCommandException) { }
            JoinCmd.Join(services.Model, new List <Joint>(), newLines, newAreas);
        }
Esempio n. 3
0
        //public override void Run(Canguro.Controller.CommandServices services)
        //{
        //    objectCount = 0;
        //    if (Clipboard.ContainsData("Canguro"))
        //    {
        //        Stream stream = (Stream)Clipboard.GetData("Canguro");
        //        Magnet magnet = services.GetPoint(Culture.Get("pasteCmdTitle"));

        //        BinaryFormatter bformatter = new BinaryFormatter();
        //        Microsoft.DirectX.Vector3 pivot = (Microsoft.DirectX.Vector3)bformatter.Deserialize(stream);
        //        Microsoft.DirectX.Vector3 v = magnet.SnapPosition - pivot;
        //        List<Joint> newJoints = new List<Joint>();
        //        List<LineElement> newLines = new List<LineElement>();
        //        ItemList<Joint> jList = services.Model.JointList;
        //        ItemList<LineElement> lList = services.Model.LineList;
        //        Dictionary<uint, Joint> jSelection = new Dictionary<uint, Joint>();
        //        Joint nJoint;
        //        LineElement nLine;

        //        objectCount = (int) bformatter.Deserialize(stream);
        //        for (int i = 0; i < objectCount; i++)
        //        {
        //            Element elem = (Element)bformatter.Deserialize(stream);

        //            if (elem is Joint)
        //            {
        //                Joint j = (Joint)elem;
        //                jList.Add(nJoint = new Joint(j.X + v.X, j.Y + v.Y, j.Z + v.Z));
        //                nJoint.Masses = j.Masses;
        //                nJoint.DoF = j.DoF;
        //                jSelection.Add(j.Id, nJoint);
        //                newJoints.Add(nJoint);
        //                CopyLoads(services.Model, j, nJoint);
        //            }
        //            if (elem is LineElement)
        //            {
        //                LineElement l = (LineElement)elem;
        //                lList.Add(nLine = new LineElement(l.Properties));
        //                nLine.I = jSelection[l.I.Id];
        //                nLine.J = jSelection[l.J.Id];
        //                nLine.Angle = l.Angle;
        //                newLines.Add(nLine);
        //                CopyLoads(services.Model, l, nLine);
        //            }
        //            JoinCmd.Join(services.Model, newJoints, newLines);
        //        }
        //    }
        //}

        /// <summary>
        /// Executes the command.
        /// Pastes the Items in the Clpboard under the key Canguro, in the current Model.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            objectCount = 0;
            if (Clipboard.ContainsData("Canguro"))
            {
                object[] data = (object[])Clipboard.GetData("Canguro");
                Dictionary <uint, Joint>  joints     = (Dictionary <uint, Joint>)data[0];
                Dictionary <uint, Joint>  jSelection = new Dictionary <uint, Joint>();
                IList <LineElement>       lines      = (IList <LineElement>)data[1];
                IList <AreaElement>       areas      = (IList <AreaElement>)data[2];
                Microsoft.DirectX.Vector3 pivot      = (Microsoft.DirectX.Vector3)data[3];

                ItemList <Joint>       jList = services.Model.JointList;
                ItemList <LineElement> lList = services.Model.LineList;
                ItemList <AreaElement> aList = services.Model.AreaList;

                Joint       nJoint;
                LineElement nLine;
                AreaElement nArea;
                Magnet      magnet = services.GetPoint(Culture.Get("pasteCmdTitle"));
                if (magnet == null)
                {
                    objectCount = 0;
                }
                else
                {
                    objectCount = joints.Count + lines.Count;
                    Microsoft.DirectX.Vector3 v  = magnet.SnapPosition - pivot;
                    List <Joint>       newJoints = new List <Joint>();
                    List <LineElement> newLines  = new List <LineElement>();
                    List <AreaElement> newAreas  = new List <AreaElement>();

                    Dictionary <string, Layer> layers = new Dictionary <string, Layer>();
                    foreach (Layer l in services.Model.Layers)
                    {
                        if (l != null)
                        {
                            layers.Add(l.Name, l);
                        }
                    }


                    foreach (uint jid in joints.Keys)
                    {
                        Joint j = (joints[jid] == null) ? jList[jid] : joints[jid];
                        jList.Add(nJoint = new Joint(j.X + v.X, j.Y + v.Y, j.Z + v.Z));
                        nJoint.Masses    = j.Masses;
                        if (!layers.ContainsKey(j.Layer.Name))
                        {
                            Layer lay = new Layer(j.Layer.Name);
                            services.Model.Layers.Add(lay);
                            layers.Add(lay.Name, lay);
                        }
                        nJoint.Layer = layers[j.Layer.Name];
                        nJoint.DoF   = j.DoF;
                        jSelection.Add(jid, nJoint);
                        newJoints.Add(nJoint);
                        CopyLoads(services.Model, j, nJoint);
                    }
                    foreach (LineElement l in lines)
                    {
                        if (!layers.ContainsKey(l.Layer.Name))
                        {
                            Layer lay = new Layer(l.Layer.Name);
                            services.Model.Layers.Add(lay);
                            layers.Add(lay.Name, lay);
                        }
                        lList.Add(nLine = new LineElement(l, jSelection[l.I.Id], jSelection[l.J.Id]));
                        nLine.Layer     = layers[l.Layer.Name];
                        newLines.Add(nLine);
                        CopyLoads(services.Model, l, nLine);
                    }
                    foreach (AreaElement a in areas)
                    {
                        if (!layers.ContainsKey(a.Layer.Name))
                        {
                            Layer lay = new Layer(a.Layer.Name);
                            services.Model.Layers.Add(lay);
                            layers.Add(lay.Name, lay);
                        }

                        aList.Add(nArea = new AreaElement(a, jSelection[a.J1.Id], jSelection[a.J2.Id], jSelection[a.J3.Id], (a.J4 != null) ? jSelection[a.J4.Id] : null));
                        if (a.J4 != null)
                        {
                            nArea.J4 = jSelection[a.J4.Id];
                        }
                        nArea.Layer = layers[a.Layer.Name];
                        newAreas.Add(nArea);
                        CopyLoads(services.Model, a, nArea);
                    }
                    JoinCmd.Join(services.Model, newJoints, newLines, newAreas);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Executes the command.
        /// Opens the AnalysisOptionsDialog, creates the export file, sends it to the Server and waits for it to have results.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            gettingResults = false;
            System.Windows.Forms.DialogResult result = services.ShowDialog(new Canguro.Commands.Model.AnalysisOptionsDialog(services));
            string message = "";

            if (result == System.Windows.Forms.DialogResult.Cancel)
            {
                services.Model.Undo.Rollback();
            }
            else if (result == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    System.Windows.Forms.Cursor cursor = System.Windows.Forms.Cursor.Current;
                    bool isConnected;
                    bool canAnalyze = false;
                    JoinCmd.RepairJoints(services.Model);
                    new Canguro.Commands.Model.UnselectCmd().Run(services);
                    if (!(canAnalyze = AnalysisUtils.CanAnalyze(services.Model, ref message, out isConnected)))
                    {
                        if (!isConnected)
                        {
                            if (System.Windows.Forms.MessageBox.Show(message, Culture.Get("error"),
                                                                     System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Error) ==
                                System.Windows.Forms.DialogResult.Yes)
                            {
                                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

                                new JoinCmd().Run(services);
                                canAnalyze = AnalysisUtils.CanAnalyze(services.Model, ref message, out isConnected);

                                System.Windows.Forms.Cursor.Current = cursor;
                            }
                            else
                            {
                                return;
                            }
                        }
                    }
                    if (canAnalyze)
                    {
                        System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

                        string modelPath = System.IO.Path.GetTempFileName();
                        System.Diagnostics.Debug.WriteLine(modelPath);
                        FixPDelta(services.Model.AbstractCases);

                        Stream stream = File.Create(modelPath);
                        new Canguro.Model.Serializer.Serializer(services.Model).Serialize(stream, false);
                        stream.Close();

                        System.Windows.Forms.Cursor.Current = cursor;

                        System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

                        // TODO: ANALYZE STRUCTURE!!!
                        //analysisID = ws.Analyze(userNameURL, passwordURL, host, serial, file, analysisOptions, modelSize, quotation);

                        System.Windows.Forms.Cursor.Current = cursor;

                        services.Model.Results = new Canguro.Model.Results.Results(0);

                        // TODO: GET RESULTS
                        services.ReportProgress(5);
                    }
                    else // Can't analyze
                    {
                        if (!isConnected)
                        {
                            message = Culture.Get("structureIsDisconnectedWrn");
                        }

                        System.Windows.Forms.MessageBox.Show(message, Culture.Get("error"), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    }
                }
                catch (Exception)
                {
                    System.Windows.Forms.MessageBox.Show(Culture.Get("ErrorAnalyzing"), Culture.Get("error"), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Executes the command.
        /// Asks for selected Items repetitions and a Vector, and makes the copies.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Dictionary <Joint, Joint> joints     = new Dictionary <Joint, Joint>();
            Dictionary <Joint, Joint> jSelection = new Dictionary <Joint, Joint>();
            List <LineElement>        lines      = new List <LineElement>();
            List <LineElement>        lSelection = new List <LineElement>();
            List <AreaElement>        areas      = new List <AreaElement>();
            List <AreaElement>        aSelection = new List <AreaElement>();
            ItemList <Joint>          jList      = services.Model.JointList;
            ItemList <LineElement>    lList      = services.Model.LineList;
            ItemList <AreaElement>    aList      = services.Model.AreaList;
            Joint       nJoint;
            LineElement nLine;
            AreaElement nArea;

            List <Item> selection = services.GetSelection();

            if (selection.Count == 0)
            {
                return;
            }

            foreach (Item item in selection)
            {
                if (item is Joint)
                {
                    jSelection.Add((Joint)item, null);
                    joints.Add((Joint)item, null);
                }
                else if (item is LineElement)
                {
                    LineElement l = (LineElement)item;
                    lSelection.Add(l);
                    lines.Add(l);
                    if (!jSelection.ContainsKey(l.I))
                    {
                        jSelection.Add(l.I, null);
                        joints.Add(l.I, null);
                    }
                    if (!jSelection.ContainsKey(l.J))
                    {
                        jSelection.Add(l.J, null);
                        joints.Add(l.J, null);
                    }
                }
                else if (item is AreaElement)
                {
                    AreaElement a = (AreaElement)item;
                    aSelection.Add(a);
                    areas.Add(a);
                    for (int i = 0; i < ((a.J4 != null) ? 4 : 3); i++)
                    {
                        if (!jSelection.ContainsKey(a[i]))
                        {
                            jSelection.Add(a[i], null);
                            joints.Add(a[i], null);
                        }
                    }
                }
            }

            Microsoft.DirectX.Vector3 v;
            services.GetVector(out v);

            uint   n;
            string str = services.GetString(Culture.Get("getArrayRepetition"));

            n = Convert.ToUInt32(str);

            List <Joint>       newJoints = new List <Joint>();
            List <LineElement> newLines  = new List <LineElement>();
            List <AreaElement> newAreas  = new List <AreaElement>();

            for (int i = 1; i <= n; i++)
            {
                foreach (Joint j in joints.Keys)
                {
                    jList.Add(nJoint = new Joint(j.X + i * v.X, j.Y + i * v.Y, j.Z + i * v.Z));
                    nJoint.Masses    = j.Masses;
                    nJoint.DoF       = j.DoF;
                    jSelection[j]    = nJoint;
                    newJoints.Add(nJoint);
                }
                foreach (LineElement l in lines)
                {
                    lList.Add(nLine = new LineElement(l, jSelection[l.I], jSelection[l.J]));
                    newLines.Add(nLine);
                }
                foreach (AreaElement a in areas)
                {
                    aList.Add(nArea = new AreaElement(a, jSelection[a.J1], jSelection[a.J2], jSelection[a.J3], jSelection[a.J4]));
                    newAreas.Add(nArea);
                }
                services.ReportProgress((uint)(100 * i / n));
                System.Windows.Forms.Application.DoEvents();
            }
            JoinCmd.Join(services.Model, newJoints, newLines, newAreas);
        }
Esempio n. 6
0
        /// <summary>
        /// Executes the command.
        /// Copies the selected Items in a series around a given rotation axis.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Dictionary <Joint, Joint> joints     = new Dictionary <Joint, Joint>();
            Dictionary <Joint, Joint> jSelection = new Dictionary <Joint, Joint>();
            List <LineElement>        lines      = new List <LineElement>();
            List <LineElement>        lSelection = new List <LineElement>();
            List <AreaElement>        areas      = new List <AreaElement>();
            List <AreaElement>        aSelection = new List <AreaElement>();
            ItemList <Joint>          jList      = services.Model.JointList;
            ItemList <LineElement>    lList      = services.Model.LineList;
            ItemList <AreaElement>    aList      = services.Model.AreaList;
            Joint       nJoint;
            LineElement nLine;
            AreaElement nArea;

            List <Item> selection = services.GetSelection();

            if (selection.Count == 0)
            {
                return;
            }

            foreach (Item item in selection)
            {
                if (item is Joint)
                {
                    jSelection.Add((Joint)item, null);
                    joints.Add((Joint)item, null);
                }
                else if (item is LineElement)
                {
                    LineElement l = (LineElement)item;
                    lSelection.Add(l);
                    lines.Add(l);
                    if (!jSelection.ContainsKey(l.I))
                    {
                        jSelection.Add(l.I, null);
                        joints.Add(l.I, null);
                    }
                    if (!jSelection.ContainsKey(l.J))
                    {
                        jSelection.Add(l.J, null);
                        joints.Add(l.J, null);
                    }
                }
                else if (item is AreaElement)
                {
                    AreaElement a = (AreaElement)item;
                    aSelection.Add(a);
                    areas.Add(a);
                    if (!jSelection.ContainsKey(a.J1))
                    {
                        jSelection.Add(a.J1, null);
                        joints.Add(a.J1, null);
                    }
                    if (!jSelection.ContainsKey(a.J2))
                    {
                        jSelection.Add(a.J2, null);
                        joints.Add(a.J2, null);
                    }
                    if (!jSelection.ContainsKey(a.J3))
                    {
                        jSelection.Add(a.J3, null);
                        joints.Add(a.J3, null);
                    }
                    if (a.J4 != null && !jSelection.ContainsKey(a.J4))
                    {
                        jSelection.Add(a.J4, null);
                        joints.Add(a.J4, null);
                    }
                }
            }

            Microsoft.DirectX.Vector3 v, v2;
            uint n = (uint)services.GetSingle(Culture.Get("getArrayRepetition"));

            float dAngle = float.Parse(services.GetString(Culture.Get("getPolarArrayAngle")));

            dAngle *= (float)Math.PI / 180.0F;
            float angle = 0.0F;

            Controller.Snap.Magnet m = services.GetPoint(Culture.Get("getPolarRotationCenter"));
            if (m == null)
            {
                return;
            }
            v = m.SnapPosition;

            services.TrackingService = LineTrackingService.Instance;
            services.TrackingService.SetPoint(m.SnapPositionInt);

            m = services.GetPoint(Culture.Get("getPolarRotationCenter"));
            if (m == null)
            {
                return;
            }
            v2 = m.SnapPosition;
            if (v2.Equals(v))
            {
                Canguro.View.GraphicView view = Canguro.View.GraphicViewManager.Instance.ActiveView;
                Vector3 v1Tmp = new Vector3(0, 0, 0);
                Vector3 v2Tmp = new Vector3(0, 0, 1);
                view.Unproject(ref v1Tmp);
                view.Unproject(ref v2Tmp);
                v2 = v2 + v1Tmp - v2Tmp;
            }
            services.TrackingService = null;

            List <Joint>       newJoints = new List <Joint>();
            List <LineElement> newLines  = new List <LineElement>();
            List <AreaElement> newAreas  = new List <AreaElement>();


            for (int i = 1; i <= n; i++)
            {
                angle += dAngle;

                Matrix trans1 = new Matrix();
                trans1.Translate(-v);
                Matrix rot = new Matrix();
                rot.RotateAxis(v2 - v, angle);
                Matrix trans2 = new Matrix();
                trans2.Translate(v);
                rot = trans1 * rot * trans2;

                foreach (Joint j in joints.Keys)
                {
                    Vector3 pos = new Vector3(j.X, j.Y, j.Z);
                    pos.TransformCoordinate(rot);

                    jList.Add(nJoint = new Joint(pos.X, pos.Y, pos.Z));
                    nJoint.Masses    = j.Masses;
                    nJoint.DoF       = j.DoF;
                    jSelection[j]    = nJoint;
                    newJoints.Add(nJoint);
                }
                foreach (LineElement l in lines)
                {
                    lList.Add(nLine = new LineElement(l, jSelection[l.I], jSelection[l.J]));
                    newLines.Add(nLine);
                }
                foreach (AreaElement a in areas)
                {
                    aList.Add(nArea = new AreaElement(a, jSelection[a.J1], jSelection[a.J2], jSelection[a.J3], (a.J4 != null) ? jSelection[a.J4] : null));
                    newAreas.Add(nArea);
                }
            }
            JoinCmd.Join(services.Model, newJoints, newLines, newAreas);
        }
Esempio n. 7
0
        /// <summary>
        /// Reads a DXF file and adds all the lines defined in it to the given Model
        /// </summary>
        /// <param name="path">The path to the DXF file</param>
        /// <param name="model">The current Model object</param>
        public static void Import(string path, Canguro.Model.Model model)
        {
            if (path.Length > 0)
            {
                string[]           file      = File.ReadAllLines(path);
                List <string>      search    = new List <string>(new string[] { "LINE", "10", "20", "30", "11", "21", "31", "LWPOLYLINE" });
                int                state     = 0;
                Joint              ji        = null;
                Joint              jj        = null;
                StraightFrameProps props     = new StraightFrameProps();
                List <LineElement> newLines  = new List <LineElement>();
                List <AreaElement> newAreas  = new List <AreaElement>();
                List <Joint>       newJoints = new List <Joint>();

                bool addLine  = false;
                bool polyline = false;
                for (int i = 0; i < file.Length; i++)
                {
                    string line = file[i].Trim().ToUpper();
                    while (!search.Contains(line) && i < file.Length - 1)
                    {
                        line = file[++i].Trim().ToUpper();
                    }
                    state = search.IndexOf(line);
                    if (state == 0 || state > 6)
                    {
                        addLine = true;
                        jj      = null;
                        ji      = null;
                    }
                    if (state == 7)
                    {
                        polyline = true;
                    }

                    if (!addLine)
                    {
                        continue;
                    }
                    if (i == file.Length - 1)
                    {
                        break;
                    }
                    line = file[++i].Trim();
                    switch (state)
                    {
                    case 1:
                        jj = (polyline) ? ji : jj;
                        ji = new Joint(Convert.ToSingle(line), 0, 0);
                        if (polyline && jj != null)
                        {
                            AddLine(model, ji, jj, props, newJoints, newLines);
                        }
                        break;

                    case 2:
                        if (ji != null)
                        {
                            ji.Y = Convert.ToSingle(line);
                        }
                        break;

                    case 3:
                        if (ji != null)
                        {
                            ji.Z = Convert.ToSingle(line);
                        }
                        break;

                    case 4:
                        jj = new Joint(Convert.ToSingle(line), 0, 0);
                        break;

                    case 5:
                        if (addLine && jj != null)
                        {
                            jj.Y = Convert.ToSingle(line);
                        }
                        AddLine(model, ji, jj, props, newJoints, newLines);
                        polyline = false;
                        break;

                    case 6:
                        if (jj != null)
                        {
                            jj.Z = Convert.ToSingle(line);
                        }
                        break;
                    }
                }
                JoinCmd.Join(model, newJoints, newLines, newAreas);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Executes the command.
        /// Makes a copy of the selected items with inverted positions with respect to a mirror plane, defined by 3 points.
        /// If the points are colinear, the 3rd point is taken to be perpendicular to the view.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Dictionary <uint, Joint> joints = new Dictionary <uint, Joint>();
            List <LineElement>       lines  = new List <LineElement>();
            List <AreaElement>       areas  = new List <AreaElement>();

            services.GetSelection(joints, lines, areas);

            Dictionary <uint, Joint> jSelection = new Dictionary <uint, Joint>();

            Microsoft.DirectX.Vector3[] pivots = new Microsoft.DirectX.Vector3[3];

            // Get 3 Points
            Magnet m = services.GetPoint(Culture.Get("selectPlainPoints"));

            pivots[0] = m.SnapPosition;

            m         = services.GetPoint(Culture.Get("selectPlainPoints"));
            pivots[1] = m.SnapPosition;

            m         = services.GetPoint(Culture.Get("selectPlainPoints"));
            pivots[2] = m.SnapPosition;
            Vector3 v1 = pivots[0] - pivots[1];
            Vector3 v2 = pivots[1] - pivots[2];

            if (Vector3.Cross(v1, v2).LengthSq() < 0.0001)     // If Colinear, take perpendicular to the active view.
            {
                Canguro.View.GraphicView view = Canguro.View.GraphicViewManager.Instance.ActiveView;
                v1 = new Vector3(0, 0, 0);
                v2 = new Vector3(0, 0, 1);
                view.Unproject(ref v1);
                view.Unproject(ref v2);
                pivots[2] = pivots[2] + v1 - v2;
            }

            ItemList <Joint>       jList = services.Model.JointList;
            ItemList <LineElement> lList = services.Model.LineList;
            ItemList <AreaElement> aList = services.Model.AreaList;

            Joint              nJoint;
            LineElement        nLine;
            AreaElement        nArea;
            List <Joint>       newJoints = new List <Joint>();
            List <LineElement> newLines  = new List <LineElement>();
            List <AreaElement> newAreas  = new List <AreaElement>();

            foreach (uint jid in joints.Keys)
            {
                Joint   j          = jList[jid];
                Vector3 currentPos = new Vector3(j.X, j.Y, j.Z);
                Vector3 newPos     = Mirror(currentPos, pivots);
                jList.Add(nJoint = new Joint(newPos.X, newPos.Y, newPos.Z));
                nJoint.Masses    = j.Masses;
                nJoint.DoF       = j.DoF;
                jSelection.Add(jid, nJoint);
                newJoints.Add(nJoint);
            }
            foreach (LineElement l in lines)
            {
                lList.Add(nLine = new LineElement(l, jSelection[l.I.Id], jSelection[l.J.Id]));
                newLines.Add(nLine);
            }
            foreach (AreaElement a in areas)
            {
                aList.Add(nArea = new AreaElement(a, jSelection[a.J1.Id], jSelection[a.J2.Id], jSelection[a.J3.Id], (a.J4 != null) ? jSelection[a.J4.Id] : null));
                newAreas.Add(nArea);
            }
            JoinCmd.Join(services.Model, newJoints, newLines, newAreas);
        }