Esempio n. 1
0
        /// <summary>
        /// Executes the command. 
        /// Creates a series of connected Line Elements given at least 2 points. Each subsequent point given adds a new Line Element.
        /// </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);

            joint1 = services.GetJoint(newLines);
            services.TrackingService = LineTrackingService.Instance;
            services.TrackingService.SetPoint(joint1.Position);

            try
            {
                while ((joint2 = services.GetJoint(newLines)) != null)
                {
                    if (joint2 != joint1)
                    {
                        services.Model.LineList.Add(line = new LineElement(props, joint1, joint2));
                        newLines.Add(line);
                        joint1 = joint2;
                        services.TrackingService.SetPoint(joint1.Position);
                        // Para que se refleje el cambio inmediatamente
                        services.Model.ChangeModel();
                    }
                }
            }
            catch (Canguro.Controller.CancelCommandException) { }
            if (newLines.Count == 0)
                services.Model.Undo.Rollback();
            else
                JoinCmd.Join(services.Model, new List<Joint>(), newLines, newAreas);
        }
Esempio n. 2
0
        /// <summary>
        /// Executes the command. 
        /// Creates one AreaElement.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            AreaElement area;
            List<Joint> joints = new List<Joint>();
            Joint joint1, joint2, joint3, joint4;
            AreaProps props = new AreaProps();
            List<LineElement> newLines = new List<LineElement>();

            try
            {
            services.GetProperties(Culture.Get("addAreaProps"), props);

            joint1 = services.GetJoint(newLines);
            services.TrackingService = PolygonTrackingService.Instance;
            services.TrackingService.SetPoint(joint1.Position);
            services.Model.ChangeModel();

            joint2 = services.GetJoint(newLines);
            services.TrackingService.SetPoint(joint2.Position);
            services.Model.ChangeModel();

            joint3 = services.GetJoint(newLines);
            services.TrackingService.SetPoint(joint3.Position);
            services.Model.ChangeModel();

            joint4 = services.GetJoint(newLines);
            if (joint4 != null)
                services.TrackingService.SetPoint(joint4.Position);

            services.Model.AreaList.Add(area = new AreaElement(props, joint1, joint2, joint3, joint4));
            services.Model.ChangeModel();

            }
            catch (Canguro.Controller.CancelCommandException) { }
            //if (newLines.Count == 0)
            //    services.Model.Undo.Rollback();
            //else
            //    JoinCmd.Join(services.Model, new List<Joint>(), newLines);
        }
Esempio n. 3
0
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Canguro.Model.UnitSystem.UnitSystemsManager.Instance.Enabled = false;
            try {
                Microsoft.DirectX.Vector3[] pivots = new Microsoft.DirectX.Vector3[3];

                // Get 3 Points

                Joint j1 = services.GetJoint((IList<LineElement>)null);
                services.TrackingService = Canguro.Controller.Tracking.LineTrackingService.Instance;
                services.TrackingService.SetPoint(j1.Position);
                services.Model.ChangeModel();

                Joint j2 = services.GetJoint((IList<LineElement>)null);
                services.TrackingService.SetPoint(j2.Position);
                services.Model.ChangeModel();
                Joint j3 = services.GetJoint((IList<LineElement>)null);
                services.TrackingService = null;
                services.Model.ChangeModel();

                pivots[0] = j1.Position;
                pivots[1] = j2.Position;
                pivots[2] = j3.Position;

                Vector3 v1 = pivots[0] - pivots[1];
                Vector3 v2 = pivots[1] - pivots[2];
                Vector3 N = Vector3.Cross(v1, v2);

                if (N.LengthSq() < 0.0001) // If Colinear, take perpendicular to the active view.
                    System.Windows.Forms.MessageBox.Show(Culture.Get("ColinearPoints"), Culture.Get("error"), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
                else {
                    int segments = (int)services.GetSingle(Culture.Get("getSplitParts") + " [2-100]");
                    Vector3 C = calcCenter(pivots[0], pivots[1], pivots[2]);
                    MakeArc(services.Model, C, N, j1, j3, j2, segments);
                }
            } finally {
                Canguro.Model.UnitSystem.UnitSystemsManager.Instance.Enabled = true;
            }
        }
        /// <summary>
        /// Executes the command. 
        /// Asks the User for parameters and adds the Load to all selected Joints.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            GroundDisplacementLoad load = new GroundDisplacementLoad();

            services.GetProperties(Title, load);

            Joint joint;
            while ((joint = services.GetJoint()) != null)
            {
                // TODO: Checar validez
                joint.Loads.Add(load);
                // Para que se refleje el cambio inmediatamente
                services.Model.ChangeModel();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Executes the command. 
        /// Adds Joints in selected points until canceled.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Joint joint;
            Microsoft.DirectX.Vector3 pt;
            Controller.Snap.Magnet m;
            bool showJoints = false;

            while ((joint = services.GetJoint((IList<LineElement>)null)) != null)
            {
                if (!showJoints)
                    Canguro.View.GraphicViewManager.Instance.ActiveView.ModelRenderer.RenderOptions.OptionsShown |= Canguro.View.Renderer.RenderOptions.ShowOptions.ShowJoints;

                showJoints = true;

                //pt = m.SnapPosition;
                //services.Model.JointList.Add(joint = new Joint(pt.X, pt.Y, pt.Z));
                //services.SnapPrimaryPoint = new Canguro.Controller.Snap.PointMagnet(joint);
                //// Para que se refleje el cambio inmediatamente
                services.Model.ChangeModel();
            }
        }