示例#1
0
        public static bool _Delete(this ObjectTable objects, RhinoObject obj)
        {
            if (obj == null || objects == null)
            {
                return(false);
            }

            // for successful removal object must be visible
            if (obj.Attributes.Visible == false)
            {
                obj.Attributes.Visible = true;
                obj.CommitChanges();
            }
            var deleted = objects.Delete(obj, true);

            // if we can't delete - at least hide it
            if (!deleted)
            {
                obj.Attributes.Visible = false;
                obj.CommitChanges();
                log.wrong("Failed to delete object SN={0}", obj.RuntimeSerialNumber);
            }
            return(deleted);
        }