private void volumeButton_Click(object sender, EventArgs e) { VolumeProperties vp = new VolumeProperties(); int count = 0; var blockReferenceNotScaled = true; for (int i = 0; i < model1.Entities.Count && blockReferenceNotScaled; i++) { Entity ent = model1.Entities[i]; count += AddVolumeProperty(vp, ent, out blockReferenceNotScaled); } StringBuilder text = new StringBuilder(); if (blockReferenceNotScaled) { text.AppendLine(count + " entity(ies) selected"); text.AppendLine("---------------------"); if (vp.Centroid != null) { double x, y, z; double xx, yy, zz, xy, zx, yz; MomentOfInertia world, centroid; vp.GetResults(vp.Volume, vp.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 volume: " + vp.Volume + " cubic " + model1.Units.ToString().ToLower()); text.AppendLine("Cumulative centroid: " + vp.Centroid); text.AppendLine("Cumulative volume 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(" Volume 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(" Volume 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(" Volume 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(" Volume 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")); } } else { text.AppendLine("Error: scaled BlockReference not supported."); text.AppendLine("---------------------"); } DetailsForm rf = new DetailsForm(); rf.Text = "Volume Properties"; rf.textBox1.Text = text.ToString(); rf.Show(); }