public AnalysisOptionsDialog(Canguro.Controller.CommandServices services)
 {
     this.services = services;
     InitializeComponent();
     Init();
     UpdateDialog();
 }
예제 #2
0
 /// <summary>
 /// Executes the command. 
 /// Opens the Open File Dialog and Loads the selected tsm file.
 /// Asks to save changes if needed.
 /// </summary>
 /// <param name="services">CommandServices object to interact with the system</param>
 public override void Run(Canguro.Controller.CommandServices services)
 {
     if (services.Model.Modified)
     {
         DialogResult dr = MessageBox.Show(Culture.Get("askSaveChangesAndExit"), Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
         if (dr == DialogResult.Cancel)
             return;
         else if (dr == DialogResult.Yes)
             services.Run(new SaveModelCmd());
     }
     string path = "";
     System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
     dlg.Filter = "Treu Structure Model (*.tsm)|*.tsm";
     dlg.DefaultExt = "tsm";
     dlg.AddExtension = true;
     dlg.Title = Culture.Get("OpenFileTitle");
     if (services.Model.CurrentPath.Length > 0)
         dlg.FileName = services.Model.CurrentPath;
     dlg.CheckPathExists = true;
     if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         path = dlg.FileName;
     try
     {
         if (path.Length > 0)
         {
             services.Model.Load(path);
         }
     }
     catch
     {
         MessageBox.Show(Culture.Get("errorLoadingFile") + " " + path, Culture.Get("error"),
             MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
0
        /// <summary>
        /// Executes the command. 
        /// Moves the joint according to a given scale factor and pivot point.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            List<Canguro.Model.Joint> selection = new List<Canguro.Model.Joint>();
            List<Item> selectedItems = services.GetSelection();
            if (selectedItems.Count == 0)
                return;

            foreach (Item item in selectedItems)
            {
                if (item is Joint)
                    selection.Add((Joint)item);
                else if (item is LineElement)
                {
                    LineElement l = (LineElement)item;
                    if (!selection.Contains(l.I))
                        selection.Add(l.I);
                    if (!selection.Contains(l.J))
                        selection.Add(l.J);
                }
            }

            Microsoft.DirectX.Vector3 piv;
            float scale = services.GetSingle(Culture.Get("getScale"));

            Controller.Snap.Magnet m = services.GetPoint(Culture.Get("pivotScalePoint"));
            if (m == null) return;
            piv = m.SnapPosition;

            foreach (Canguro.Model.Joint j in selection)
            {
                j.X = (j.X - piv.X) * scale + piv.X;
                j.Y = (j.Y - piv.Y) * scale + piv.Y;
                j.Z = (j.Z - piv.Z) * scale + piv.Z;
            }
        }
예제 #4
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);
        }
예제 #5
0
 /// <summary>
 /// Executes the command. 
 /// Sets the IsSelected property of all the Items in the Active Layer to true.
 /// </summary>
 /// <param name="services">CommandServices object to interact with the system</param>
 public override void Run(Canguro.Controller.CommandServices services)
 {
     Layer layer = services.Model.ActiveLayer;
     foreach (Item item in layer.Items)
         item.IsSelected = true;
     services.Model.ChangeSelection(null);
 }
예제 #6
0
        /// <summary>
        /// Executes the command. 
        /// Deletes the selected Items. 
        /// If none is selected, it requests a selection.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Canguro.Model.Model model = services.Model;
            if (model.LoadCases.Count > 1)
            {
                Canguro.Model.Load.LoadCase oldCase = model.ActiveLoadCase;

                // Remove associated AnalysisCase
                // Find the corresponding AbstractCase
                Canguro.Model.Load.AnalysisCase aCase = null;
                foreach (Canguro.Model.Load.AbstractCase ac in services.Model.AbstractCases)
                    if (ac is Canguro.Model.Load.AnalysisCase && ac.Name.Equals(oldCase.Name))
                    {
                        aCase = (Canguro.Model.Load.AnalysisCase)ac;
                        break;
                    }

                bool deleteLCase = true;
                // Now remove the AnalysisCase
                if (aCase != null)
                    deleteLCase = services.Model.AbstractCases.Remove(aCase);

                if (deleteLCase)
                {
                    services.Model.LoadCases.Remove(oldCase.Name);
                    services.Model.ChangeModel();
                }
            }
        }
예제 #7
0
 /// <summary>
 /// Executes the Non-Interactive Command.
 /// Sets the RotationMatrix for the View with a Default 3D View and Executes ZoomAll.
 /// </summary>
 /// <param name="activeView">The Current Active View object</param>
 public override void Run(Canguro.View.GraphicView activeView)
 {
     activeView.ArcBallCtrl.ResetRotation();
     activeView.ArcBallCtrl.RotationMatrix = Matrix.RotationX(-(float)Math.PI / 2.0f) * Matrix.RotationY(-3.0f * (float)Math.PI / 4.0f) * Matrix.RotationX((float)Math.PI / 6.0f);
     activeView.ViewMatrix = activeView.ArcBallCtrl.ViewMatrix;
     ZoomAll.Instance.Run(activeView);
 }
예제 #8
0
 public LineMagnet(Canguro.Model.LineElement line)
     : base(line.I.Position)
 {
     this.direction = line.J.Position - line.I.Position;
     this.type = LineMagnetType.FollowProjection;
     this.line = line;
 }
 public void Reset(Canguro.View.GraphicView activeView)
 {
     if (trackingService != null)
         trackingService.Reset(activeView);
     snapController.Reset(activeView);
     hoverController.Reset(activeView);
 }
예제 #10
0
        /// <summary>
        /// Executes the command. 
        /// Gets the Load Case properties from the User, adds it to the Model and sets it as Active.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            string name = Culture.Get("defaultLoadCase");
            LoadCase lCase = new LoadCase(name, LoadCase.LoadCaseType.Dead);
            lCase.Name = name;
            //            services.GetProperties(lCase.Name, lCase, false);

            EditLoadCaseDialog dlg = new EditLoadCaseDialog(lCase);
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (!services.Model.LoadCases.ContainsKey(lCase.Name))
                    services.Model.LoadCases.Add(lCase.Name, lCase);
                services.Model.ActiveLoadCase = lCase;

                AnalysisCase aCase = new AnalysisCase(lCase.Name);
                StaticCaseProps props = aCase.Properties as StaticCaseProps;
                if (props != null)
                {
                    List<StaticCaseFactor> list = props.Loads;
                    list.Add(new StaticCaseFactor(lCase));
                    props.Loads = list;
                    services.Model.AbstractCases.Add(aCase);
                }
            }
            else
                services.Model.Undo.Rollback();
        }
예제 #11
0
        public override void Run(Canguro.Controller.CommandServices services)
        {
            services.StoreSelection();
            LineElement line = services.GetLine();
            List<LinkedList<LineElement>> graph = GetLineGraph(services.Model);
            ItemList<Joint> joints = services.Model.JointList;
            int numJoints = joints.Count;
            bool[] colors = new bool[numJoints];

            Stack<LineElement> stack = new Stack<LineElement>();
            stack.Push(line);
            while (stack.Count > 0)
            {
                line = stack.Pop();
                line.IsSelected = true;
                if (!colors[line.I.Id])
                {
                    line.I.IsSelected = true;
                    visit(graph, (int)line.I.Id, stack, line);
                    colors[line.I.Id] = true;
                }
                if (!colors[line.J.Id])
                {
                    line.J.IsSelected = true;
                    visit(graph, (int)line.J.Id, stack, line);
                    colors[line.J.Id] = true;
                }
            }

            services.RestoreSelection();

            services.Model.ChangeSelection(null);
        }
예제 #12
0
        /// <summary>
        /// Executes the command. 
        /// Deletes all Items in a Layer
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            int count = 0;
            foreach (Layer layer in services.Model.Layers)
                if (layer != null)
                    count++;

            services.Model.UnSelectAll();
            if (services.Model.ActiveLayer.Items.Count > 0)
                System.Windows.Forms.MessageBox.Show(Culture.Get("layerHasObjectsError"), Culture.Get("error"), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
            else if (count <= 1)
                System.Windows.Forms.MessageBox.Show(Culture.Get("lastLayerError"), Culture.Get("error"), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
            else
            {
                Layer deletedLayer = services.Model.ActiveLayer;
                foreach (Layer active in services.Model.Layers)
                    if (active != null && active != deletedLayer)
                    {
                        services.Model.ActiveLayer = active;
                        break;
                    }
                Layer activeLayer = services.Model.ActiveLayer;

                foreach (Item item in services.Model.LineList)
                    if (item != null && item.IsSelected)
                        item.Layer = activeLayer;

                foreach (Item item in services.Model.JointList)
                    if (item != null && item.IsSelected)
                        item.Layer = activeLayer;

                services.Model.Layers.Remove(deletedLayer);
            }
        }
예제 #13
0
        public void RecalcPrimaryDependant(Canguro.View.GraphicView activeView, PointMagnet primaryPoint, LineMagnet[] globalAxes)
        {
            if (primaryPoint != null)
            {
                // Move area to lay on the primaryPoint and to set its direction any canonic
                // plane (X=x, Y=y or Z=z) which is the most paralell to the screen plane
                position = primaryPoint.Position;

                // Get screen plane normal
                Vector3 s0 = screenNormal[0], s1 = screenNormal[1], sNormal;
                activeView.Unproject(ref s0);
                activeView.Unproject(ref s1);
                sNormal = s0 - s1;

                // Assign the area normal to the most paralell canonical plane
                // (giving priority to the Z plane)
                int maxCosIndex = 2;
                float cosX, cosY, cosZ;
                cosX = Vector3.Dot(sNormal, globalAxes[0].Direction);
                cosY = Vector3.Dot(sNormal, globalAxes[1].Direction);
                cosZ = Vector3.Dot(sNormal, globalAxes[2].Direction);

                if (Math.Abs(cosZ) < minZPlaneAngle)
                    maxCosIndex = (cosX >= cosY) ? ((cosX > cosZ) ? 0 : 2) : ((cosY > cosZ) ? 1 : 2);

                normal = globalAxes[maxCosIndex].Direction;
            }
            else
            {
                position = Vector3.Empty;
                normal = globalAxes[2].Direction;
            }
        }
예제 #14
0
        /// <summary>
        /// Executes the command. 
        /// Opens the Sections Dialog
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            SectionsGUI gui = new SectionsGUI();
            if (services.ShowDialog(gui) == System.Windows.Forms.DialogResult.Cancel)
                throw new Canguro.Controller.CancelCommandException();

            services.Model.ChangeModel(true);
        }
예제 #15
0
        public override void ButtonDown(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            gv = activeView;
            oldM = gv.ViewMatrix;
            firstY = e.Y;

            gv.ArcBallCtrl.OnBeginZoom(e);
        }
예제 #16
0
        public void Reset(Canguro.Model.Model model)
        {
            maxStress = 0f;
            minStress = 0f;
            largest = 0f;

            if (recalculateMinMaxStressesOfSelection(model))
                largest = Math.Max(Math.Abs(maxStress), Math.Abs(minStress));
        }
예제 #17
0
        /// <summary>
        /// Create a temporary MDB file that will be send to SAP application 
        /// </summary>
        /// <param name="m"></param>
        /// <param name="filePath"></param>
        internal void Export(Canguro.Model.Model m, string filePath)
        {
            OleDbConnection cn = null;
            Canguro.Model.UnitSystem.UnitSystem uSystem = m.UnitSystem;

            try
            {
                File.Copy(System.Windows.Forms.Application.StartupPath + "\\RuntimeData\\modelTransfer", filePath /*"tmp"*/, true);

                //Use a string variable to hold the ConnectionString.
                string connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath;

                //Create an OleDbConnection object,
                //and then pass in the ConnectionString to the constructor.
                cn = new OleDbConnection(connectString);
                cn.Open();

                m.UnitSystem = Canguro.Model.UnitSystem.InternationalSystem.Instance;
                // Create store procedures for joint items
                store(cn, m.JointList);
                // Create store procedures for line itemes
                store(cn, m.LineList);
                // Create store procedures for materials
                foreach (Material mat in MaterialManager.Instance.Materials.AsReadOnly())
                    if (mat != null)
                        store(cn, mat);
                // Create store procedures for abstract case
                foreach (AbstractCase aCase in m.AbstractCases)
                    if (aCase != null)
                        store(cn, aCase, m);
                // Create store procedures for load cases
                foreach (LoadCase lCase in m.LoadCases.Values)
                    if (lCase != null)
                        store(cn, lCase);
                // Create store procedures for concrete material
                store(cn, m.ConcreteDesignOptions);
                // Create store procedures for steel materia
                store(cn, m.SteelDesignOptions);
                // Create store procedures for frame design
                storeFrameDesignProcedures(cn, m);
                // Create store procedures for spectrum analysis
                store(cn, m.ResponseSpectra, m.AbstractCases);
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show(Culture.Get("ErrorExporting"), Culture.Get("error"),
                    System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                throw;
            }
            finally
            {
                if (cn != null)
                    cn.Close();
                m.UnitSystem = uSystem;
            }
        }
예제 #18
0
 /// <summary>
 /// Executes the command. 
 /// Sets the Layer property of all the selected Items to point to the Active Layer
 /// </summary>
 /// <param name="services">CommandServices object to interact with the system</param>
 public override void Run(Canguro.Controller.CommandServices services)
 {
     Layer layer = services.Model.ActiveLayer;
     foreach (Item item in services.Model.JointList)
         if (item != null && item.IsSelected)
             item.Layer = layer;
     foreach (Item item in services.Model.LineList)
         if (item != null && item.IsSelected)
             item.Layer = layer;
 }
예제 #19
0
 /// <summary>
 /// Executes the Non-Interactive Command.
 /// Sets the InternalForcesShown property of RenderOptions to Mz
 /// </summary>
 /// <param name="activeView">The Current Active View object</param>
 public override void Run(Canguro.View.GraphicView activeView)
 {
     Canguro.View.Renderer.ModelRenderer mr = activeView.ModelRenderer;
     if (mr != null && mr.ForcesRenderer != null)
     {
         if (mr.RenderOptions.InternalForcesShown == Canguro.View.Renderer.RenderOptions.InternalForces.Mz)
             mr.RenderOptions.InternalForcesShown = Canguro.View.Renderer.RenderOptions.InternalForces.None;
         else
             mr.RenderOptions.InternalForcesShown = Canguro.View.Renderer.RenderOptions.InternalForces.Mz;
     }
 }
예제 #20
0
 /// <summary>
 /// Executes the command. 
 /// Execute CopyCmd and PasteCmd until cancelled.
 /// </summary>
 /// <param name="services">CommandServices object to interact with the system</param>
 public override void Run(Canguro.Controller.CommandServices services)
 {
     services.Run(new CopyCmd());
     PasteCmd cmd;
     do
     {
         services.Run(cmd = new PasteCmd());
         services.Model.ChangeModel();
     }
     while (cmd.ObjectCount > 0);
 }
예제 #21
0
        /// <summary>
        /// Executes the command. 
        /// Sets the IsSelected property of all the Items in the Active Layer to false.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Layer layer = services.Model.ActiveLayer;
            foreach (Item item in layer.Items)
                item.IsVisible = item.IsSelected = false;

            if (services.Model.HasResults)
                services.Model.Results.StressHelper.IsDirty = true;

            services.Model.ChangeModel();
        }
예제 #22
0
        /// <summary>
        /// Executes the command. 
        /// Selects all unselected items and deselect the rest.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            foreach (Item item in services.Model.JointList)
                if (item != null)
                    item.IsSelected = !item.IsSelected;

            foreach (Item item in services.Model.LineList)
                if (item != null)
                    item.IsSelected = !item.IsSelected;

            services.Model.ChangeSelection(null);
        }
예제 #23
0
        public override void ButtonDown(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
        {
            // Store initial state
            gv = activeView;
            oldM = gv.ViewMatrix;

            // Get Screen Coordinates and prepare ArcBall
            //gv.InitArcBall(System.Windows.Forms.MouseEventArgs e)

            //gv.ArcBallCtrl.OnBeginRotate(e, new Vector3(8,8,8));
            gv.ArcBallCtrl.OnBeginRotate(e, Controller.Controller.Instance.SelectionCommand.GetViewableObjectsCentroid(activeView));
        }
예제 #24
0
        /// <summary>
        /// Executes the command. 
        /// Deletes all the selected items except joints connected to undeleted elements.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            List<Item> selection = services.GetSelection();
            ItemList<Joint> jList = Canguro.Model.Model.Instance.JointList;
            ItemList<LineElement> lList = Canguro.Model.Model.Instance.LineList;
            ItemList<AreaElement> aList = Canguro.Model.Model.Instance.AreaList;
            bool[] hasElement = new bool[jList.Count];
            int size;

            size = lList.Count;
            for (int i=1; i<size; i++)
            {
                LineElement obj = lList[i];
                if (obj != null)
                {
                    if (obj.IsSelected)
                        lList.Remove(obj);
                    else
                    {
                        hasElement[obj.I.Id] = true;
                        hasElement[obj.J.Id] = true;
                    }
                }
            }

            size = aList.Count;
            for (int i = 1; i < size; i++)
            {
                AreaElement obj = aList[i];
                if (obj != null)
                {
                    if (obj.IsSelected)
                        aList.Remove(obj);
                    else
                    {
                        hasElement[obj.J1.Id] = true;
                        hasElement[obj.J2.Id] = true;
                        hasElement[obj.J3.Id] = true;
                        hasElement[obj.J4.Id] = true;
                    }
                }
            }

            size = jList.Count;
            for (int i = 1; i < size; i++)
            {
                Joint obj = jList[i];
                if (i == 500)
                    i = 500;
                if (obj != null && obj.IsSelected && !hasElement[obj.Id])
                    jList.Remove(obj);
            }
        }
예제 #25
0
        public override void Run(Canguro.View.GraphicView activeView)
        {
            if (activeView.ArcBallsInStack > 1)
            {
                activeView.PopArcBall();
                // Update activeView view matrix
                activeView.ViewMatrix = activeView.ArcBallCtrl.ViewMatrix;
            }
            else
                System.Windows.Forms.MessageBox.Show(Culture.Get(Canguro.Properties.Resources.noZoomPreviousToDo));

            //System.Windows.Forms.MessageBox.Show("Javier... Implementa!!!!");
        }
예제 #26
0
        public static Joint Intersect(Canguro.Model.Model model, LineElement l1, LineElement l2)
        {
            if (l1 != null && l2 != null && l1 != l2 && l1.I != l2.I && l1.J != l2.J && l1.I != l2.J && l1.J != l2.I)
            {
                float numer, denom;
                float d1, d2, d3, d4, d5;
                Vector3 p13 = l1.I.Position - l2.I.Position;
                Vector3 p21 = l1.J.Position - l1.I.Position;
                Vector3 p43 = l2.J.Position - l2.I.Position;

                d1 = p13.X * p43.X + p13.Y * p43.Y + p13.Z * p43.Z;
                d2 = p43.X * p21.X + p43.Y * p21.Y + p43.Z * p21.Z;
                d3 = p13.X * p21.X + p13.Y * p21.Y + p13.Z * p21.Z;
                d4 = p43.X * p43.X + p43.Y * p43.Y + p43.Z * p43.Z;
                d5 = p21.X * p21.X + p21.Y * p21.Y + p21.Z * p21.Z;

                denom = d5 * d4 - d2 * d2;
                if (Math.Abs(denom) < 0.0001)
                    return null;
                numer = d1 * d2 - d3 * d4;

                float r = numer / denom;
                float s = (d1 + d2 * r) / d4;

                float scale = model.UnitSystem.FromInternational(1, Canguro.Model.UnitSystem.Units.Distance);
                Vector3 pa = Vector3.Scale(l1.I.Position, scale) + Vector3.Scale(p21, r * scale);
                Vector3 pb = Vector3.Scale(l2.I.Position, scale) + Vector3.Scale(p43, s * scale);

                if (r > (-0.001) && r < 1.001 && s > (-0.001) && s < 1.001 && (pa - pb).Length() < 0.001 &&
                    ((pa - l1.I.Position).LengthSq() > 0.000001f) && ((pa - l1.J.Position).LengthSq() > 0.000001f) &&
                    ((pa - l2.I.Position).LengthSq() > 0.000001f) && ((pa - l2.J.Position).LengthSq() > 0.000001f))
                {
                    Joint joint = new Joint(pa.X, pa.Y, pa.Z);
                    model.JointList.Add(joint);
                    return joint;
                    //SplitCmd.Split(l1, joint, model);
                    //SplitCmd.Split(l2, joint, model);
                }
                //// Create magnet
                //PointMagnet intPtMagnet = new PointMagnet(l1.Position + Vector3.Scale(l1.Direction, r),
                //    PointMagnetType.Intersection);
                //if (intPtMagnet.Snap(activeView, e.Location) < SnapViewDistance)
                //{
                //    intPtMagnet.RelatedMagnets.Add(l1);
                //    intPtMagnet.RelatedMagnets.Add(l2);
                //    return intPtMagnet;
                //}
            }

            return null;
        }
예제 #27
0
        /// <summary>
        /// Executes the command. 
        /// Flips the joints in all selected AreaElements
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Canguro.Model.AreaElement area;
            List<Canguro.Model.Item> selection = services.GetSelection();

            foreach (Canguro.Model.Item item in selection)
            {
                if ((area = item as Canguro.Model.AreaElement) != null)
                    area.FlipJoints++;
            }

            //// Para que se refleje el cambio
            services.Model.ChangeModel();
        }
예제 #28
0
 /// <summary>
 /// Executes the command. 
 /// Runs a test.
 /// </summary>
 /// <param name="services">CommandServices object to interact with the system</param>
 public override void Run(Canguro.Controller.CommandServices services)
 {
     foreach (Type t in Assembly.GetEntryAssembly().GetTypes())
     {
         if ("Canguro.View.Reports".Equals(t.Namespace))
         {
             Console.WriteLine("{0}{1}", t.Namespace.Replace(".",""), t.Name);
             //foreach (PropertyInfo prop in t.GetProperties())
             //{
             //    Console.WriteLine("{0}\t{1}", prop.ToString().Replace(".", ""), prop.Name);
             //}
         }
     }
 }
예제 #29
0
        /// <summary>
        /// Create a temporary XML file that will be send to SAP application
        /// </summary>
        /// <param name="m"></param>
        /// <param name="filePath"></param>
        internal void Export(Canguro.Model.Model m, string filePath)
        {
            String xmlfile = filePath.Substring(0, filePath.Length - 3) + "xml";
            tmpxml = new XmlTextWriter(xmlfile, null);
            Canguro.Model.UnitSystem.UnitSystem uSystem = m.UnitSystem;
            m.UnitSystem = Canguro.Model.UnitSystem.InternationalSystem.Instance;

            try {
                tmpxml.Formatting = Formatting.Indented;
                tmpxml.Indentation = 4;
                tmpxml.Namespaces = false;
                tmpxml.WriteStartDocument();
                tmpxml.WriteComment("XML file generated by CanguroTeam");
                tmpxml.WriteComment(DateTime.Now.ToString());
                // node added for validation
                tmpxml.WriteStartElement("XmlExportedFile");
                // writing fix values for nodes
                writeFixedNode(tmpxml);
                //writing nodes for Joints
                writeNode(tmpxml, m.JointList);
                //writing nodes for Lines
                writeNode(tmpxml, m.LineList);
                //writing xml nodes for Materials
                writeNode(tmpxml);
                //writing xml nodes for Abstract cases
                writeNode(tmpxml, m);
                //writing xml nodes for Load cases
                writeNode(tmpxml, m.LoadCases);
                //writing xml nodes for concrete material
                writeConcreteNode(tmpxml, m.ConcreteDesignOptions);
                //writing xml nodes for steel material
                writeSteelNode(tmpxml, m.SteelDesignOptions);
                //writing xml nodes for frame design
                writeFrameDesignNode(tmpxml, m);
                //writing nodes for spectrum analysis
                writeNode(tmpxml, m.ResponseSpectra, m.AbstractCases);
                tmpxml.WriteEndElement();
                tmpxml.Flush();
            } catch(Exception e) {
                System.Windows.Forms.MessageBox.Show(Culture.Get("XmlError"), Culture.Get("error"),
                System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                throw;
            } finally {
                if (tmpxml != null) {
                    tmpxml.Close();
                    m.UnitSystem = uSystem;
                }
            }
        }
예제 #30
0
        /// <summary>
        /// Executes the command. 
        /// Sets all the Items IsVisible property to true.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            foreach (Joint j in services.Model.JointList)
                if (j != null)
                    j.IsVisible = true;

            foreach (LineElement l in services.Model.LineList)
                if (l != null)
                    l.IsVisible = true;

            if (services.Model.HasResults)
                services.Model.Results.StressHelper.IsDirty = true;

            services.Model.ChangeModel();
        }