mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Fix #6640. Fix invalid association of annotations to grids.
There was already some half written code with this intent it seems, so I just finished it up.
This commit is contained in:
@@ -38,6 +38,17 @@ class TestAssignProduct(test.bootstrap.IFC4):
|
||||
assert len(wall.ReferencedBy) == 1
|
||||
assert wall.ReferencedBy[0].RelatedObjects == (label,)
|
||||
|
||||
def test_assigning_a_grid_axis(self):
|
||||
axis = self.file.createIfcGridAxis(AxisTag="A")
|
||||
grid = self.file.createIfcGrid(UAxes=[axis])
|
||||
line = self.file.createIfcAnnotation()
|
||||
ifcopenshell.api.drawing.assign_product(self.file, relating_product=axis, related_object=line)
|
||||
assert grid.ReferencedBy[0].RelatedObjects == (line,)
|
||||
assert grid.ReferencedBy[0].Name == "A"
|
||||
assert len(self.file.by_type("IfcRelAssignsToProduct")) == 1
|
||||
ifcopenshell.api.drawing.assign_product(self.file, relating_product=axis, related_object=line)
|
||||
assert len(self.file.by_type("IfcRelAssignsToProduct")) == 1
|
||||
|
||||
|
||||
class TestAssignProductIFC2X3(test.bootstrap.IFC2X3, TestAssignProduct):
|
||||
pass
|
||||
|
||||
@@ -28,6 +28,14 @@ class TestUnassignProduct(test.bootstrap.IFC4):
|
||||
ifcopenshell.api.drawing.unassign_product(self.file, relating_product=wall, related_object=label)
|
||||
assert len(self.file.by_type("IfcRelAssignsToProduct")) == 0
|
||||
|
||||
def test_unassigning_a_grid_axis(self):
|
||||
axis = self.file.createIfcGridAxis(AxisTag="A")
|
||||
grid = self.file.createIfcGrid(UAxes=[axis])
|
||||
line = self.file.createIfcAnnotation()
|
||||
ifcopenshell.api.drawing.assign_product(self.file, relating_product=axis, related_object=line)
|
||||
ifcopenshell.api.drawing.unassign_product(self.file, relating_product=axis, related_object=line)
|
||||
assert len(self.file.by_type("IfcRelAssignsToProduct")) == 0
|
||||
|
||||
|
||||
class TestUnassignProductIFC2X3(test.bootstrap.IFC2X3, TestUnassignProduct):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user