Exemplo n.º 1
0
        //--------------------------------------------------------------------------------------------------

        void _AddFaceProperties(TopoDS_Face face)
        {
            const string facecat = "Face";
            const string surfcat = "Surface";

            if (Shape != null)
            {
                var subshapeRef = Shape.GetSubshapeReference(_TopLevelShape, face);
                _AddProperty(facecat, "SubshapeRef", subshapeRef?.ToString() ?? "null");
            }

            _AddProperty(facecat, "Tolerance", $"{BRep_Tool.Tolerance(face)}");
            _AddProperty(facecat, "Nat.Restrict.", $"{(BRep_Tool.NaturalRestriction(face) ? "Yes" : "No")}");

            var props = new GProp_GProps();

            BRepGProp.SurfaceProperties(BrepShape, props);
            _AddProperty(facecat, "Area", $"{props.Mass()}");

            var surface = BRep_Tool.Surface(face);

            if (surface != null)
            {
                _AddProperty(surfcat, "Class", surface.GetType().Name.Replace("Geom_", ""));
                double u1 = 0, u2 = 0, v1 = 0, v2 = 0;
                surface.Bounds(ref u1, ref u2, ref v1, ref v2);
                _AddProperty(surfcat, "Bounds U", $"({u1}, {u2})");
                _AddProperty(surfcat, "Bounds V", $"({v1}, {v2})");
                _AddProperty(surfcat, "Is Closed", $"U={(surface.IsUClosed() ? "Yes" : "No")}  V={(surface.IsUClosed() ? "Yes" : "No")}");
                if (surface.IsUPeriodic() || surface.IsVPeriodic())
                {
                    var s = "";
                    if (surface.IsUPeriodic())
                    {
                        s += $"U={surface.UPeriod()}  ";
                    }
                    if (surface.IsVPeriodic())
                    {
                        s += $"V={surface.VPeriod()}  ";
                    }
                    _AddProperty(surfcat, "Period", s);
                }
                _AddProperty(surfcat, "Continuity", surface.Continuity().ToString().Replace("GeomAbs_", ""));
            }
        }