mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Run black on IfcOpenShell-python.
This commit is contained in:
@@ -5,12 +5,17 @@ import ifcopenshell.api
|
||||
class TestEditContext(test.bootstrap.IFC4):
|
||||
def test_editing_a_context(self):
|
||||
context = self.file.createIfcGeometricRepresentationContext()
|
||||
ifcopenshell.api.run("context.edit_context", self.file, context=context, attributes={
|
||||
"ContextIdentifier": "ContextIdentifier",
|
||||
"ContextType": "ContextType",
|
||||
"CoordinateSpaceDimension": 1,
|
||||
"Precision": 1,
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"context.edit_context",
|
||||
self.file,
|
||||
context=context,
|
||||
attributes={
|
||||
"ContextIdentifier": "ContextIdentifier",
|
||||
"ContextType": "ContextType",
|
||||
"CoordinateSpaceDimension": 1,
|
||||
"Precision": 1,
|
||||
},
|
||||
)
|
||||
assert context.ContextIdentifier == "ContextIdentifier"
|
||||
assert context.ContextType == "ContextType"
|
||||
assert context.CoordinateSpaceDimension == 1
|
||||
@@ -18,13 +23,18 @@ class TestEditContext(test.bootstrap.IFC4):
|
||||
|
||||
def test_editing_a_subcontext(self):
|
||||
subcontext = self.file.createIfcGeometricRepresentationSubcontext()
|
||||
ifcopenshell.api.run("context.edit_context", self.file, context=subcontext, attributes={
|
||||
"ContextIdentifier": "ContextIdentifier",
|
||||
"ContextType": "ContextType",
|
||||
"TargetScale": 0.5,
|
||||
"TargetView": "MODEL_VIEW",
|
||||
"UserDefinedTargetView": "UserDefinedTargetView",
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"context.edit_context",
|
||||
self.file,
|
||||
context=subcontext,
|
||||
attributes={
|
||||
"ContextIdentifier": "ContextIdentifier",
|
||||
"ContextType": "ContextType",
|
||||
"TargetScale": 0.5,
|
||||
"TargetView": "MODEL_VIEW",
|
||||
"UserDefinedTargetView": "UserDefinedTargetView",
|
||||
},
|
||||
)
|
||||
assert subcontext.ContextIdentifier == "ContextIdentifier"
|
||||
assert subcontext.ContextType == "ContextType"
|
||||
assert subcontext.TargetScale == 0.5
|
||||
|
||||
@@ -5,11 +5,16 @@ import ifcopenshell.api
|
||||
class TestEditTextLiteral(test.bootstrap.IFC4):
|
||||
def test_run(self):
|
||||
text = self.file.createIfcTextLiteralWithExtent()
|
||||
ifcopenshell.api.run("drawing.edit_text_literal", self.file, text_literal=text, attributes={
|
||||
"Literal": "Literal",
|
||||
"Path": "RIGHT",
|
||||
"BoxAlignment": "middle",
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"drawing.edit_text_literal",
|
||||
self.file,
|
||||
text_literal=text,
|
||||
attributes={
|
||||
"Literal": "Literal",
|
||||
"Path": "RIGHT",
|
||||
"BoxAlignment": "middle",
|
||||
},
|
||||
)
|
||||
assert text.Literal == "Literal"
|
||||
assert text.Path == "RIGHT"
|
||||
assert text.BoxAlignment == "middle"
|
||||
|
||||
@@ -36,11 +36,7 @@ class TestRemoveRepresentation(test.bootstrap.IFC4):
|
||||
self.file.createIfcWallType(RepresentationMaps=[representation_map])
|
||||
representation = self.file.createIfcShapeRepresentation(
|
||||
RepresentationType="MappedRepresentation",
|
||||
Items=[
|
||||
self.file.createIfcMappedItem(
|
||||
MappingTarget=representation_map
|
||||
)
|
||||
],
|
||||
Items=[self.file.createIfcMappedItem(MappingTarget=representation_map)],
|
||||
)
|
||||
assert len(self.file.by_type("IfcShapeRepresentation")) == 2
|
||||
ifcopenshell.api.run("geometry.remove_representation", self.file, representation=representation)
|
||||
|
||||
@@ -14,4 +14,4 @@ class TestCreateGridAxis(test.bootstrap.IFC4):
|
||||
axis2 = ifcopenshell.api.run(
|
||||
"grid.create_grid_axis", self.file, axis_tag="axis_tag", same_sense=True, uvw_axes="UAxes", grid=grid
|
||||
)
|
||||
assert grid.UAxes == (axis,axis2)
|
||||
assert grid.UAxes == (axis, axis2)
|
||||
|
||||
@@ -5,13 +5,18 @@ import ifcopenshell.api
|
||||
class TestEditLibrary(test.bootstrap.IFC4):
|
||||
def test_editing_a_library(self):
|
||||
library = self.file.createIfcLibraryInformation()
|
||||
ifcopenshell.api.run("library.edit_library", self.file, library=library, attributes={
|
||||
"Name": "Name",
|
||||
"Version": "Version",
|
||||
"VersionDate": "VersionDate",
|
||||
"Location": "Location",
|
||||
"Description": "Description",
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"library.edit_library",
|
||||
self.file,
|
||||
library=library,
|
||||
attributes={
|
||||
"Name": "Name",
|
||||
"Version": "Version",
|
||||
"VersionDate": "VersionDate",
|
||||
"Location": "Location",
|
||||
"Description": "Description",
|
||||
},
|
||||
)
|
||||
assert library.Name == "Name"
|
||||
assert library.Version == "Version"
|
||||
assert library.VersionDate == "VersionDate"
|
||||
|
||||
@@ -5,13 +5,18 @@ import ifcopenshell.api
|
||||
class TestEditReference(test.bootstrap.IFC4):
|
||||
def test_editing_a_reference(self):
|
||||
reference = self.file.createIfcLibraryReference()
|
||||
ifcopenshell.api.run("library.edit_reference", self.file, reference=reference, attributes={
|
||||
"Location": "Location",
|
||||
"Identification": "Identification",
|
||||
"Name": "Name",
|
||||
"Description": "Description",
|
||||
"Language": "Language",
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"library.edit_reference",
|
||||
self.file,
|
||||
reference=reference,
|
||||
attributes={
|
||||
"Location": "Location",
|
||||
"Identification": "Identification",
|
||||
"Name": "Name",
|
||||
"Description": "Description",
|
||||
"Language": "Language",
|
||||
},
|
||||
)
|
||||
assert reference.Location == "Location"
|
||||
assert reference.Identification == "Identification"
|
||||
assert reference.Name == "Name"
|
||||
|
||||
@@ -12,8 +12,8 @@ class TestRemoveLibrary(test.bootstrap.IFC4):
|
||||
library = self.file.createIfcLibraryInformation()
|
||||
reference1 = self.file.createIfcLibraryReference(ReferencedLibrary=library)
|
||||
reference2 = self.file.createIfcLibraryReference(ReferencedLibrary=library)
|
||||
self.file.createIfcRelAssociatesLibrary(GlobalId='foo', RelatingLibrary=library)
|
||||
self.file.createIfcRelAssociatesLibrary(GlobalId='bar', RelatingLibrary=reference1)
|
||||
self.file.createIfcRelAssociatesLibrary(GlobalId="foo", RelatingLibrary=library)
|
||||
self.file.createIfcRelAssociatesLibrary(GlobalId="bar", RelatingLibrary=reference1)
|
||||
ifcopenshell.api.run("library.remove_library", self.file, library=library)
|
||||
assert len(self.file.by_type("IfcLibraryReference")) == 0
|
||||
assert len(self.file.by_type("IfcRelAssociatesLibrary")) == 0
|
||||
|
||||
@@ -12,7 +12,10 @@ class TestAddApplication(test.bootstrap.IFC4):
|
||||
assert developer.is_a("IfcOrganization")
|
||||
assert developer.Identification == "IfcOpenShell"
|
||||
assert developer.Name == "IfcOpenShell"
|
||||
assert developer.Description == "IfcOpenShell is an open source software library that helps users and software developers to work with IFC data."
|
||||
assert (
|
||||
developer.Description
|
||||
== "IfcOpenShell is an open source software library that helps users and software developers to work with IFC data."
|
||||
)
|
||||
assert developer.Roles[0].Role == "USERDEFINED"
|
||||
assert developer.Roles[0].UserDefinedRole == "CONTRIBUTOR"
|
||||
assert developer.Addresses[0].is_a("IfcTelecomAddress")
|
||||
|
||||
@@ -13,8 +13,8 @@ class TestCreateOwnerHistory(test.bootstrap.IFC4):
|
||||
old_get_application = ifcopenshell.api.owner.settings.get_application
|
||||
user = self.file.createIfcPersonAndOrganization()
|
||||
application = self.file.createIfcApplication()
|
||||
ifcopenshell.api.owner.settings.get_user = lambda x : user
|
||||
ifcopenshell.api.owner.settings.get_application = lambda x : application
|
||||
ifcopenshell.api.owner.settings.get_user = lambda x: user
|
||||
ifcopenshell.api.owner.settings.get_application = lambda x: application
|
||||
history = ifcopenshell.api.run("owner.create_owner_history", self.file)
|
||||
ifcopenshell.api.owner.settings.get_user = old_get_user
|
||||
ifcopenshell.api.owner.settings.get_application = old_get_application
|
||||
|
||||
@@ -5,18 +5,23 @@ import ifcopenshell.api
|
||||
class TestEditAddress(test.bootstrap.IFC4):
|
||||
def test_editing_a_postal_address(self):
|
||||
address = self.file.createIfcPostalAddress()
|
||||
ifcopenshell.api.run("owner.edit_address", self.file, address=address, attributes={
|
||||
"Purpose": "OFFICE",
|
||||
"Description": "Description",
|
||||
"UserDefinedPurpose": "UserDefinedPurpose",
|
||||
"InternalLocation": "InternalLocation",
|
||||
"AddressLines": ["Address", "Lines"],
|
||||
"PostalBox": "PostalBox",
|
||||
"Town": "Town",
|
||||
"Region": "Region",
|
||||
"PostalCode": "PostalCode",
|
||||
"Country": "Country",
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"owner.edit_address",
|
||||
self.file,
|
||||
address=address,
|
||||
attributes={
|
||||
"Purpose": "OFFICE",
|
||||
"Description": "Description",
|
||||
"UserDefinedPurpose": "UserDefinedPurpose",
|
||||
"InternalLocation": "InternalLocation",
|
||||
"AddressLines": ["Address", "Lines"],
|
||||
"PostalBox": "PostalBox",
|
||||
"Town": "Town",
|
||||
"Region": "Region",
|
||||
"PostalCode": "PostalCode",
|
||||
"Country": "Country",
|
||||
},
|
||||
)
|
||||
assert address.Purpose == "OFFICE"
|
||||
assert address.Description == "Description"
|
||||
assert address.UserDefinedPurpose == "UserDefinedPurpose"
|
||||
@@ -30,17 +35,22 @@ class TestEditAddress(test.bootstrap.IFC4):
|
||||
|
||||
def test_editing_a_telecom_address(self):
|
||||
address = self.file.createIfcTelecomAddress()
|
||||
ifcopenshell.api.run("owner.edit_address", self.file, address=address, attributes={
|
||||
"Purpose": "OFFICE",
|
||||
"Description": "Description",
|
||||
"UserDefinedPurpose": "UserDefinedPurpose",
|
||||
"TelephoneNumbers": ["Telephone", "Numbers"],
|
||||
"FacsimileNumbers": ["Facsimile", "Numbers"],
|
||||
"PagerNumber": "PagerNumber",
|
||||
"ElectronicMailAddresses": ["Electronic", "Mail", "Addresses"],
|
||||
"WWWHomePageURL": "WWWHomePageURL",
|
||||
"MessagingIDs": ["Messaging", "IDs"],
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"owner.edit_address",
|
||||
self.file,
|
||||
address=address,
|
||||
attributes={
|
||||
"Purpose": "OFFICE",
|
||||
"Description": "Description",
|
||||
"UserDefinedPurpose": "UserDefinedPurpose",
|
||||
"TelephoneNumbers": ["Telephone", "Numbers"],
|
||||
"FacsimileNumbers": ["Facsimile", "Numbers"],
|
||||
"PagerNumber": "PagerNumber",
|
||||
"ElectronicMailAddresses": ["Electronic", "Mail", "Addresses"],
|
||||
"WWWHomePageURL": "WWWHomePageURL",
|
||||
"MessagingIDs": ["Messaging", "IDs"],
|
||||
},
|
||||
)
|
||||
assert address.Purpose == "OFFICE"
|
||||
assert address.Description == "Description"
|
||||
assert address.UserDefinedPurpose == "UserDefinedPurpose"
|
||||
|
||||
@@ -5,11 +5,16 @@ import ifcopenshell.api
|
||||
class TestEditOrganisation(test.bootstrap.IFC4):
|
||||
def test_editing_a_organisation(self):
|
||||
organisation = self.file.createIfcOrganization()
|
||||
ifcopenshell.api.run("owner.edit_organisation", self.file, organisation=organisation, attributes={
|
||||
"Identification": "Identification",
|
||||
"Name": "Name",
|
||||
"Description": "Description",
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"owner.edit_organisation",
|
||||
self.file,
|
||||
organisation=organisation,
|
||||
attributes={
|
||||
"Identification": "Identification",
|
||||
"Name": "Name",
|
||||
"Description": "Description",
|
||||
},
|
||||
)
|
||||
assert organisation.Identification == "Identification"
|
||||
assert organisation.Name == "Name"
|
||||
assert organisation.Description == "Description"
|
||||
|
||||
@@ -5,14 +5,19 @@ import ifcopenshell.api
|
||||
class TestEditPerson(test.bootstrap.IFC4):
|
||||
def test_editing_a_person(self):
|
||||
person = self.file.createIfcPerson()
|
||||
ifcopenshell.api.run("owner.edit_person", self.file, person=person, attributes={
|
||||
"Identification": "Identification",
|
||||
"FamilyName": "FamilyName",
|
||||
"GivenName": "GivenName",
|
||||
"MiddleNames": ["Middle", "Names"],
|
||||
"PrefixTitles": ["Prefix", "Titles"],
|
||||
"SuffixTitles": ["Suffix", "Titles"],
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"owner.edit_person",
|
||||
self.file,
|
||||
person=person,
|
||||
attributes={
|
||||
"Identification": "Identification",
|
||||
"FamilyName": "FamilyName",
|
||||
"GivenName": "GivenName",
|
||||
"MiddleNames": ["Middle", "Names"],
|
||||
"PrefixTitles": ["Prefix", "Titles"],
|
||||
"SuffixTitles": ["Suffix", "Titles"],
|
||||
},
|
||||
)
|
||||
assert person.Identification == "Identification"
|
||||
assert person.FamilyName == "FamilyName"
|
||||
assert person.GivenName == "GivenName"
|
||||
|
||||
@@ -5,11 +5,12 @@ import ifcopenshell.api
|
||||
class TestEditRole(test.bootstrap.IFC4):
|
||||
def test_editing_a_role(self):
|
||||
role = self.file.createIfcActorRole()
|
||||
ifcopenshell.api.run("owner.edit_role", self.file, role=role, attributes={
|
||||
"Role": "ARCHITECT",
|
||||
"UserDefinedRole": "UserDefinedRole",
|
||||
"Description": "Description"
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"owner.edit_role",
|
||||
self.file,
|
||||
role=role,
|
||||
attributes={"Role": "ARCHITECT", "UserDefinedRole": "UserDefinedRole", "Description": "Description"},
|
||||
)
|
||||
assert role.Role == "ARCHITECT"
|
||||
assert role.UserDefinedRole == "UserDefinedRole"
|
||||
assert role.Description == "Description"
|
||||
|
||||
@@ -10,8 +10,8 @@ class TestUpdateOwnerHistory(test.bootstrap.IFC4):
|
||||
|
||||
user = self.file.createIfcPersonAndOrganization()
|
||||
application = self.file.createIfcApplication()
|
||||
ifcopenshell.api.owner.settings.get_user = lambda x : user
|
||||
ifcopenshell.api.owner.settings.get_application = lambda x : application
|
||||
ifcopenshell.api.owner.settings.get_user = lambda x: user
|
||||
ifcopenshell.api.owner.settings.get_application = lambda x: application
|
||||
|
||||
element = self.file.createIfcWall()
|
||||
history = ifcopenshell.api.run("owner.update_owner_history", self.file, element=element)
|
||||
@@ -31,8 +31,8 @@ class TestUpdateOwnerHistory(test.bootstrap.IFC4):
|
||||
|
||||
user = self.file.createIfcPersonAndOrganization()
|
||||
application = self.file.createIfcApplication()
|
||||
ifcopenshell.api.owner.settings.get_user = lambda x : user
|
||||
ifcopenshell.api.owner.settings.get_application = lambda x : application
|
||||
ifcopenshell.api.owner.settings.get_user = lambda x: user
|
||||
ifcopenshell.api.owner.settings.get_application = lambda x: application
|
||||
|
||||
element = self.file.createIfcWall()
|
||||
old_history = ifcopenshell.api.run("owner.create_owner_history", self.file)
|
||||
@@ -55,8 +55,8 @@ class TestUpdateOwnerHistory(test.bootstrap.IFC4):
|
||||
|
||||
user = self.file.createIfcPersonAndOrganization()
|
||||
application = self.file.createIfcApplication()
|
||||
ifcopenshell.api.owner.settings.get_user = lambda x : user
|
||||
ifcopenshell.api.owner.settings.get_application = lambda x : application
|
||||
ifcopenshell.api.owner.settings.get_user = lambda x: user
|
||||
ifcopenshell.api.owner.settings.get_application = lambda x: application
|
||||
|
||||
element = self.file.createIfcWall()
|
||||
element2 = self.file.createIfcWall()
|
||||
|
||||
@@ -8,11 +8,16 @@ class TestCalculateResourceWork(test.bootstrap.IFC4):
|
||||
|
||||
resource = ifcopenshell.api.run("resource.add_resource", self.file, ifc_class="IfcLaborResource")
|
||||
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=resource, name="EPset_Productivity")
|
||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={
|
||||
"BaseQuantityConsumed": "P0.5D",
|
||||
"BaseQuantityProducedName": "GrossVolume",
|
||||
"BaseQuantityProducedValue": 5,
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"pset.edit_pset",
|
||||
self.file,
|
||||
pset=pset,
|
||||
properties={
|
||||
"BaseQuantityConsumed": "P0.5D",
|
||||
"BaseQuantityProducedName": "GrossVolume",
|
||||
"BaseQuantityProducedValue": 5,
|
||||
},
|
||||
)
|
||||
|
||||
slab = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSlab")
|
||||
qto = ifcopenshell.api.run("pset.add_qto", self.file, product=slab, name="Qto_SlabBaseQuantities")
|
||||
@@ -24,17 +29,21 @@ class TestCalculateResourceWork(test.bootstrap.IFC4):
|
||||
ifcopenshell.api.run("resource.calculate_resource_work", self.file, resource=resource)
|
||||
assert resource.Usage.ScheduleWork == "P2.0D"
|
||||
|
||||
|
||||
def test_calculating_resource_work_based_on_an_hourly_productivity_rate(self):
|
||||
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
||||
|
||||
resource = ifcopenshell.api.run("resource.add_resource", self.file, ifc_class="IfcLaborResource")
|
||||
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=resource, name="EPset_Productivity")
|
||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={
|
||||
"BaseQuantityConsumed": "PT1H",
|
||||
"BaseQuantityProducedName": "GrossVolume",
|
||||
"BaseQuantityProducedValue": 5,
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"pset.edit_pset",
|
||||
self.file,
|
||||
pset=pset,
|
||||
properties={
|
||||
"BaseQuantityConsumed": "PT1H",
|
||||
"BaseQuantityProducedName": "GrossVolume",
|
||||
"BaseQuantityProducedValue": 5,
|
||||
},
|
||||
)
|
||||
|
||||
slab = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSlab")
|
||||
qto = ifcopenshell.api.run("pset.add_qto", self.file, product=slab, name="Qto_SlabBaseQuantities")
|
||||
@@ -74,11 +83,16 @@ class TestCalculateResourceWork(test.bootstrap.IFC4):
|
||||
|
||||
resource = ifcopenshell.api.run("resource.add_resource", self.file, ifc_class="IfcLaborResource")
|
||||
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=resource, name="EPset_Productivity")
|
||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={
|
||||
"BaseQuantityConsumed": "PT1H",
|
||||
"BaseQuantityProducedName": "Count",
|
||||
"BaseQuantityProducedValue": 2,
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"pset.edit_pset",
|
||||
self.file,
|
||||
pset=pset,
|
||||
properties={
|
||||
"BaseQuantityConsumed": "PT1H",
|
||||
"BaseQuantityProducedName": "Count",
|
||||
"BaseQuantityProducedValue": 2,
|
||||
},
|
||||
)
|
||||
|
||||
slab = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSlab")
|
||||
qto = ifcopenshell.api.run("pset.add_qto", self.file, product=slab, name="Qto_SlabBaseQuantities")
|
||||
|
||||
@@ -3,6 +3,7 @@ import pytest
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
|
||||
class TestAddStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||
def test_adding_a_structural_analysis_model(self):
|
||||
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
||||
|
||||
+2
-5
@@ -3,15 +3,12 @@ import pytest
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
|
||||
class TestAssignStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||
def test_assigning_a_structural_analysis_model(self):
|
||||
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
||||
product = ifcopenshell.api.run(
|
||||
"root.create_entity",
|
||||
self.file,
|
||||
ifc_class="IfcStructuralMember",
|
||||
predefined_type=None,
|
||||
name=None
|
||||
"root.create_entity", self.file, ifc_class="IfcStructuralMember", predefined_type=None, name=None
|
||||
)
|
||||
rel = ifcopenshell.api.run(
|
||||
"structural.assign_structural_analysis_model",
|
||||
|
||||
@@ -3,6 +3,7 @@ import pytest
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
|
||||
class TestEditStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||
def test_editing_a_structural_analysis_model(self):
|
||||
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
||||
@@ -10,10 +11,7 @@ class TestEditStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||
"structural.edit_structural_analysis_model",
|
||||
self.file,
|
||||
structural_analysis_model=subject,
|
||||
attributes={
|
||||
"Name": "My edited model",
|
||||
"Description": "Description of my model"
|
||||
}
|
||||
attributes={"Name": "My edited model", "Description": "Description of my model"},
|
||||
)
|
||||
models = self.file.by_type("IfcStructuralAnalysisModel")
|
||||
assert subject == models[0]
|
||||
|
||||
+1
-1
@@ -3,6 +3,7 @@ import pytest
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
|
||||
class TestRemoveStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||
def test_removing_a_structural_analysis_model(self):
|
||||
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
||||
@@ -10,7 +11,6 @@ class TestRemoveStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||
"structural.remove_structural_analysis_model",
|
||||
self.file,
|
||||
structural_analysis_model=subject,
|
||||
|
||||
)
|
||||
models = self.file.by_type("IfcStructuralAnalysisModel")
|
||||
assert len(models) == 0
|
||||
|
||||
+2
-5
@@ -3,15 +3,12 @@ import pytest
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
|
||||
class TestUnassignStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||
def test_unassigning_a_structural_analysis_model(self):
|
||||
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
||||
product = ifcopenshell.api.run(
|
||||
"root.create_entity",
|
||||
self.file,
|
||||
ifc_class="IfcStructuralMember",
|
||||
predefined_type=None,
|
||||
name=None
|
||||
"root.create_entity", self.file, ifc_class="IfcStructuralMember", predefined_type=None, name=None
|
||||
)
|
||||
rel = ifcopenshell.api.run(
|
||||
"structural.assign_structural_analysis_model",
|
||||
|
||||
@@ -5,8 +5,11 @@ import ifcopenshell.api
|
||||
class TestEditDerivedUnit(test.bootstrap.IFC4):
|
||||
def test_run(self):
|
||||
unit = self.file.createIfcDerivedUnit()
|
||||
ifcopenshell.api.run("unit.edit_derived_unit", self.file, unit=unit, attributes={
|
||||
"UnitType": "USERDEFINED", "UserDefinedType": "UserDefinedType"
|
||||
})
|
||||
ifcopenshell.api.run(
|
||||
"unit.edit_derived_unit",
|
||||
self.file,
|
||||
unit=unit,
|
||||
attributes={"UnitType": "USERDEFINED", "UserDefinedType": "UserDefinedType"},
|
||||
)
|
||||
assert unit.UnitType == "USERDEFINED"
|
||||
assert unit.UserDefinedType == "UserDefinedType"
|
||||
|
||||
@@ -5,7 +5,5 @@ import ifcopenshell.api
|
||||
class TestEditMonetaryUnit(test.bootstrap.IFC4):
|
||||
def test_run(self):
|
||||
unit = self.file.createIfcMonetaryUnit()
|
||||
ifcopenshell.api.run("unit.edit_monetary_unit", self.file, unit=unit, attributes={
|
||||
"Currency": "FOO"
|
||||
})
|
||||
ifcopenshell.api.run("unit.edit_monetary_unit", self.file, unit=unit, attributes={"Currency": "FOO"})
|
||||
assert unit.Currency == "FOO"
|
||||
|
||||
Reference in New Issue
Block a user