//累加模型体积 private int AddVolumeProperty(VolumeProperties vp, Entity ent, out bool blockReferenceNotScaled, bool all = false, bool isParentSelected = false) { int count = 0; blockReferenceNotScaled = true; if (all || ent.Selected || isParentSelected) { if (ent is IFace) { IFace itfFace = (IFace)ent; Mesh[] meshes = itfFace.GetPolygonMeshes(); foreach (Mesh mesh in meshes) { vp.Add(mesh.Vertices, mesh.Triangles); } count++; } else if (ent is BlockReference) { var br = (BlockReference)ent; if (br.GetScaleFactorX() != 1 && br.GetScaleFactorY() != 1 && br.GetScaleFactorZ() != 1) { blockReferenceNotScaled = false; return(count); } foreach (var e in br.GetEntities(model.Blocks)) { count += AddVolumeProperty(vp, e, out blockReferenceNotScaled, true); if (!blockReferenceNotScaled) { return(count); } } } } return(count); }