Fix #3974. Bug where orphaned histories would be left in API remove operations.

This commit is contained in:
Dion Moult
2023-11-28 10:45:49 +11:00
parent 58414777be
commit 6e932ec2fb
50 changed files with 314 additions and 86 deletions
@@ -16,7 +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.api
import ifcopenshell.util.element
class Usecase:
@@ -38,6 +40,9 @@ class Usecase:
ifcopenshell.api.run(
"structural.remove_structural_boundary_condition",
self.file,
**{"connection": self.settings["relation"].RelatedStructuralConnection}
connection=self.settings["relation"].RelatedStructuralConnection
)
history = self.settings["relation"].OwnerHistory
self.file.remove(self.settings["relation"])
if history:
ifcopenshell.util.element.remove_deep2(self.file, history)