See #3974. WIP review to ensure history removal in API.

This commit is contained in:
Dion Moult
2023-11-27 18:31:42 +11:00
parent f215670381
commit 14f1acadb7
22 changed files with 174 additions and 5 deletions
@@ -16,6 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell
import ifcopenshell.util.element
class Usecase:
def __init__(self, file, product=None, pset=None):
@@ -72,6 +75,12 @@ class Usecase:
if enumeration and self.file.get_total_inverses(enumeration) == 1:
self.file.remove(enumeration)
self.file.remove(prop)
history = self.settings["pset"].OwnerHistory
self.file.remove(self.settings["pset"])
if history:
ifcopenshell.util.element.remove_deep2(self.file, history)
for element in to_purge:
history = getattr(element, "OwnerHistory", None)
self.file.remove(element)
if history:
ifcopenshell.util.element.remove_deep2(self.file, history)