Ejemplo n.º 1
0
 def test_importing_a_subcontext(self):
     ifc = ifcopenshell.file()
     tool.Ifc.set(ifc)
     subcontext = ifc.createIfcGeometricRepresentationSubcontext()
     subcontext.TargetScale = 0.5
     subcontext.TargetView = "NOTDEFINED"
     subcontext.UserDefinedTargetView = "UserDefinedTargetView"
     subject.set_context(subcontext)
     subject.import_attributes()
     props = bpy.context.scene.BIMContextProperties
     assert props.context_attributes.get("TargetScale").float_value == 0.5
     assert props.context_attributes.get(
         "TargetView").enum_value == "NOTDEFINED"
     assert props.context_attributes.get(
         "UserDefinedTargetView").string_value == "UserDefinedTargetView"
     assert not props.context_attributes.get("Precision")
Ejemplo n.º 2
0
 def test_exporting_a_context(self):
     TestImportAttributes().test_importing_a_context()
     assert subject.export_attributes() == {
         "ContextIdentifier": "ContextIdentifier",
         "ContextType": "ContextType",
         "CoordinateSpaceDimension": 1,
         "Precision": 1,
     }
Ejemplo n.º 3
0
 def test_importing_a_context(self):
     ifc = ifcopenshell.file()
     tool.Ifc.set(ifc)
     context = ifc.createIfcGeometricRepresentationContext()
     context.ContextIdentifier = "ContextIdentifier"
     context.ContextType = "ContextType"
     context.CoordinateSpaceDimension = 1
     context.Precision = 1
     subject.set_context(context)
     subject.import_attributes()
     props = bpy.context.scene.BIMContextProperties
     assert props.context_attributes.get(
         "ContextIdentifier").string_value == "ContextIdentifier"
     assert props.context_attributes.get(
         "ContextType").string_value == "ContextType"
     assert props.context_attributes.get(
         "CoordinateSpaceDimension").int_value == 1
     assert props.context_attributes.get("Precision").float_value == 1
Ejemplo n.º 4
0
 def test_exporting_a_subcontext(self):
     TestImportAttributes().test_importing_a_subcontext()
     assert subject.export_attributes() == {
         "TargetScale": 0.5,
         "TargetView": "NOTDEFINED",
         "UserDefinedTargetView": "UserDefinedTargetView",
         "ContextIdentifier": None,
         "ContextType": None,
     }
Ejemplo n.º 5
0
 def test_importing_twice(self):
     ifc = ifcopenshell.file()
     tool.Ifc.set(ifc)
     context = ifc.createIfcGeometricRepresentationContext()
     context.ContextIdentifier = "ContextIdentifier"
     subject.set_context(context)
     subject.import_attributes()
     context.ContextIdentifier = "ContextIdentifier2"
     subject.import_attributes()
     props = bpy.context.scene.BIMContextProperties
     assert props.context_attributes.get(
         "ContextIdentifier").string_value == "ContextIdentifier2"
Ejemplo n.º 6
0
 def test_run(self):
     ifc = ifcopenshell.file()
     tool.Ifc.set(ifc)
     context = ifc.createIfcGeometricRepresentationContext()
     subject.set_context(context)
     assert subject.get_context() == context
Ejemplo n.º 7
0
 def test_run(self):
     TestSetContext().test_run()
     subject.clear_context()
     assert bpy.context.scene.BIMContextProperties.active_context_id == 0
Ejemplo n.º 8
0
 def test_run(self):
     ifc = ifcopenshell.file()
     context = ifc.createIfcGeometricRepresentationContext()
     subject.set_context(context)
     assert bpy.context.scene.BIMContextProperties.active_context_id == context.id(
     )