Exemple #1
0
        private void statsButton_Click(object sender, EventArgs e)
        {
            DetailsWindow rf = new DetailsWindow();

            rf.Title = "Statistics";
            rf.contentTextBox.Text = model1.Entities.GetStats(true, true, true);
            rf.Show();
        }
Exemple #2
0
        private void ShowLog(string title, string log)
        {
            if (!String.IsNullOrEmpty(log))
            {
                var df = new DetailsWindow();

                df.contentTextBox.Text = String.Format("{0}{1}----------------------{1}{2}", title, System.Environment.NewLine, log);

                df.Show();
            }
        }
Exemple #3
0
        private void dumpButton_OnClick(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < model1.Entities.Count; i++)
            {
                if (model1.Entities[i].Selected)
                {
                    string details = "Entity ID = " + i + System.Environment.NewLine + "----------------------" + System.Environment.NewLine + model1.Entities[i].Dump();

                    DetailsWindow rf = new DetailsWindow();

                    rf.Title = "Dump";

                    rf.contentTextBox.Text = details;

                    rf.Show();

                    break;
                }
            }
        }
Exemple #4
0
        private void dumpButton_Click(object sender, EventArgs e)
        {
            Entity[] entList = model1.Entities.ToArray();

            for (int i = 0; i < entList.Length; i++)
            {
                Entity ent = entList[i];

                DetailsWindow df;

                StringBuilder sb = new StringBuilder();
#if NURBS
                if (ent is Brep)
                {
                    Brep solid3D = (Brep)ent;

                    switch (model1.SelectionFilterMode)
                    {
                    case selectionFilterType.Vertex:
                        for (int j = 0; j < solid3D.Vertices.Length; j++)
                        {
                            Brep.Vertex sv = (Brep.Vertex)solid3D.Vertices[j];

                            if (solid3D.GetVertexSelection(j))
                            {
                                sb.AppendLine("Vertex ID: " + j);
                                sb.AppendLine(sv.ToString());
                                sb.AppendLine("----------------------");
                                sb.Append(sv.Dump());
                                break;
                            }
                        }
                        break;

                    case selectionFilterType.Edge:
                        for (int j = 0; j < solid3D.Edges.Length; j++)
                        {
                            Brep.Edge se = solid3D.Edges[j];

                            if (solid3D.GetEdgeSelection(j))
                            {
                                sb.AppendLine("Edge ID: " + j);
                                sb.AppendLine(se.ToString());
                                sb.AppendLine("----------------------");
                                sb.Append(se.Dump());
                                break;
                            }
                        }
                        break;

                    case selectionFilterType.Face:

                        for (int j = 0; j < solid3D.Faces.Length; j++)
                        {
                            Brep.Face sf = solid3D.Faces[j];

                            if (solid3D.GetFaceSelection(j))
                            {
                                sb.AppendLine("Face ID: " + j);
                                sb.AppendLine(sf.Surface.ToString());
                                sb.AppendLine("----------------------");
                                sb.Append(sf.Dump());
                                break;
                            }
                        }
                        break;
                    }

                    if (sb.Length > 0)
                    {
                        df = new DetailsWindow();

                        df.contentTextBox.Text = sb.ToString();

                        df.Show();
                        return;
                    }
                }
#endif
                if (ent.Selected)
                {
                    sb.AppendLine("Entity ID: " + i);

                    sb.Append(ent.Dump());

                    df = new DetailsWindow();

                    df.contentTextBox.Text = sb.ToString();

                    df.Show();

                    break;
                }
            }
        }
Exemple #5
0
        private void areaButton_OnClick(object sender, RoutedEventArgs e)
        {
            AreaProperties ap = new AreaProperties();

            int count = 0;

            for (int i = 0; i < model1.Entities.Count; i++)
            {
                Entity ent = model1.Entities[i];

                if (ent.Selected)
                {
                    ICurve itfCurve = (ICurve)ent;

                    if (itfCurve.IsClosed)
                    {
                        ap.Add(ent.Vertices);
                    }

                    count++;
                }
            }

            StringBuilder text = new StringBuilder();

            text.AppendLine(count + " entity(ies) selected");
            text.AppendLine("---------------------");

            if (ap.Centroid != null)
            {
                double          x, y, z;
                double          xx, yy, zz, xy, zx, yz;
                MomentOfInertia world, centroid;

                ap.GetResults(ap.Area, ap.Centroid, out x, out y, out z, out xx, out yy, out zz, out xy, out zx, out yz, out world, out centroid);

                text.AppendLine("Cumulative area: " + ap.Area + " square " + model1.Units.ToString().ToLower());
                text.AppendLine("Cumulative centroid: " + ap.Centroid);
                text.AppendLine("Cumulative area moments:");
                text.AppendLine(" First moments");
                text.AppendLine("  x: " + x.ToString("g6"));
                text.AppendLine("  y: " + y.ToString("g6"));
                text.AppendLine("  z: " + z.ToString("g6"));
                text.AppendLine(" Second moments");
                text.AppendLine("  xx: " + xx.ToString("g6"));
                text.AppendLine("  yy: " + yy.ToString("g6"));
                text.AppendLine("  zz: " + zz.ToString("g6"));
                text.AppendLine(" Product moments");
                text.AppendLine("  xy: " + xx.ToString("g6"));
                text.AppendLine("  yz: " + yy.ToString("g6"));
                text.AppendLine("  zx: " + zz.ToString("g6"));
                text.AppendLine(" Area Moments of Inertia about World Coordinate Axes");
                text.AppendLine("  Ix: " + world.Ix.ToString("g6"));
                text.AppendLine("  Iy: " + world.Iy.ToString("g6"));
                text.AppendLine("  Iz: " + world.Iz.ToString("g6"));
                text.AppendLine(" Area Radii of Gyration about World Coordinate Axes");
                text.AppendLine("  Rx: " + world.Rx.ToString("g6"));
                text.AppendLine("  Ry: " + world.Ry.ToString("g6"));
                text.AppendLine("  Rz: " + world.Rz.ToString("g6"));
                text.AppendLine(" Area Moments of Inertia about Centroid Coordinate Axes:");
                text.AppendLine("  Ix: " + centroid.Ix.ToString("g6"));
                text.AppendLine("  Iy: " + centroid.Iy.ToString("g6"));
                text.AppendLine("  Iz: " + centroid.Iz.ToString("g6"));
                text.AppendLine(" Area Radii of Gyration about Centroid Coordinate Axes");
                text.AppendLine("  Rx: " + centroid.Rx.ToString("g6"));
                text.AppendLine("  Ry: " + centroid.Ry.ToString("g6"));
                text.AppendLine("  Rz: " + centroid.Rz.ToString("g6"));
            }

            DetailsWindow rf = new DetailsWindow();

            rf.Title = "Area Properties";

            rf.contentTextBox.Text = text.ToString();

            rf.Show();
        }