mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
Run black on IfcOpenShell-python.
This commit is contained in:
@@ -32,7 +32,7 @@ class Usecase:
|
|||||||
# IfcTextLiteral
|
# IfcTextLiteral
|
||||||
"ifc_representation_class": None, # Whether to cast a mesh into a particular class
|
"ifc_representation_class": None, # Whether to cast a mesh into a particular class
|
||||||
"profile_set_usage": None, # The material profile set if the extrusion requires it
|
"profile_set_usage": None, # The material profile set if the extrusion requires it
|
||||||
"text_literal": None, # The text literal if the representation requires it
|
"text_literal": None, # The text literal if the representation requires it
|
||||||
}
|
}
|
||||||
self.ifc_vertices = []
|
self.ifc_vertices = []
|
||||||
for key, value in settings.items():
|
for key, value in settings.items():
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ class Usecase:
|
|||||||
|
|
||||||
if conversion_offset:
|
if conversion_offset:
|
||||||
return self.file.createIfcConversionBasedUnitWithOffset(
|
return self.file.createIfcConversionBasedUnitWithOffset(
|
||||||
exponents, unit_type, self.settings["name"], conversion_factor, conversion_offset,
|
exponents,
|
||||||
|
unit_type,
|
||||||
|
self.settings["name"],
|
||||||
|
conversion_factor,
|
||||||
|
conversion_offset,
|
||||||
)
|
)
|
||||||
return self.file.createIfcConversionBasedUnit(
|
return self.file.createIfcConversionBasedUnit(exponents, unit_type, self.settings["name"], conversion_factor)
|
||||||
exponents, unit_type, self.settings["name"], conversion_factor
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ def main(settings, files, iterators=None, merge_projection=True, progress_functi
|
|||||||
|
|
||||||
geom_settings = ifcopenshell.geom.settings(
|
geom_settings = ifcopenshell.geom.settings(
|
||||||
# this is required for serialization
|
# this is required for serialization
|
||||||
APPLY_DEFAULT_MATERIALS = True,
|
APPLY_DEFAULT_MATERIALS=True,
|
||||||
DISABLE_TRIANGULATION = True,
|
DISABLE_TRIANGULATION=True,
|
||||||
# when not doing booleans, proper solids from shells isn't a requirement
|
# when not doing booleans, proper solids from shells isn't a requirement
|
||||||
SEW_SHELLS = settings.subtract_before_hlr
|
SEW_SHELLS=settings.subtract_before_hlr,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not iterators:
|
if not iterators:
|
||||||
@@ -108,7 +108,7 @@ def main(settings, files, iterators=None, merge_projection=True, progress_functi
|
|||||||
sr.setElevationRefGuid(settings.drawing_guid)
|
sr.setElevationRefGuid(settings.drawing_guid)
|
||||||
sr.setWithoutStoreys(True)
|
sr.setWithoutStoreys(True)
|
||||||
# If you want to filter by IfcAnnotation ObjectType named "DRAWING"
|
# If you want to filter by IfcAnnotation ObjectType named "DRAWING"
|
||||||
#sr.setElevationRef("DRAWING")
|
# sr.setElevationRef("DRAWING")
|
||||||
|
|
||||||
# required for svgfill
|
# required for svgfill
|
||||||
sr.setPolygonal(True)
|
sr.setPolygonal(True)
|
||||||
@@ -130,7 +130,7 @@ def main(settings, files, iterators=None, merge_projection=True, progress_functi
|
|||||||
sr.setSubtractionSettings(W.ALWAYS)
|
sr.setSubtractionSettings(W.ALWAYS)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sh = ['none', 'full', 'left'].index(settings.storey_heights)
|
sh = ["none", "full", "left"].index(settings.storey_heights)
|
||||||
sr.setDrawStoreyHeights(sh)
|
sr.setDrawStoreyHeights(sh)
|
||||||
except:
|
except:
|
||||||
raise ValueError("storey_heights should be one of {'none', 'full', 'left'}")
|
raise ValueError("storey_heights should be one of {'none', 'full', 'left'}")
|
||||||
@@ -275,9 +275,7 @@ def main(settings, files, iterators=None, merge_projection=True, progress_functi
|
|||||||
# the factor determines how much white will be interpolated
|
# the factor determines how much white will be interpolated
|
||||||
# into the style diffuse color.
|
# into the style diffuse color.
|
||||||
clr = numpy.array(style.diffuse)
|
clr = numpy.array(style.diffuse)
|
||||||
factor = (math.log(elements[0].distance + 2.0) / 7.0) * (
|
factor = (math.log(elements[0].distance + 2.0) / 7.0) * (1.0 - 0.5 * abs(elements[0].dot_product))
|
||||||
1.0 - 0.5 * abs(elements[0].dot_product)
|
|
||||||
)
|
|
||||||
if style.has_transparency:
|
if style.has_transparency:
|
||||||
factor *= 1.0 - style.transparency
|
factor *= 1.0 - style.transparency
|
||||||
clr = WHITE * (1.0 - factor) + clr * factor
|
clr = WHITE * (1.0 - factor) + clr * factor
|
||||||
@@ -325,7 +323,7 @@ if __name__ == "__main__":
|
|||||||
return r
|
return r
|
||||||
|
|
||||||
def print_progress(*args):
|
def print_progress(*args):
|
||||||
print("\r", *args, " "*10, end="", flush=True)
|
print("\r", *args, " " * 10, end="", flush=True)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
@@ -333,12 +331,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
for field in fields(draw_settings):
|
for field in fields(draw_settings):
|
||||||
if field.type == bool:
|
if field.type == bool:
|
||||||
parser.add_argument(
|
parser.add_argument("--" + field.name.replace("_", "-"), dest=field.name, action="store_true")
|
||||||
"--" + field.name.replace("_", "-"), dest=field.name, action="store_true"
|
parser.add_argument("--no-" + field.name.replace("_", "-"), dest=field.name, action="store_false")
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"--no-" + field.name.replace("_", "-"), dest=field.name, action="store_false"
|
|
||||||
)
|
|
||||||
parser.set_defaults(**{field.name: field.default})
|
parser.set_defaults(**{field.name: field.default})
|
||||||
else:
|
else:
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@@ -360,4 +354,3 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
for t, dt in times:
|
for t, dt in times:
|
||||||
print(f"{t}: {dt}")
|
print(f"{t}: {dt}")
|
||||||
|
|
||||||
|
|||||||
@@ -72,8 +72,11 @@ for nm in ifcopenshell_wrapper.schema_names():
|
|||||||
|
|
||||||
# resolve to actual functions in wrapper
|
# resolve to actual functions in wrapper
|
||||||
functions = [
|
functions = [
|
||||||
set_derived_atribute if mname == "setArgumentAsDerived" else getattr(ifcopenshell_wrapper.entity_instance, mname) \
|
set_derived_atribute
|
||||||
for mname in fn_names]
|
if mname == "setArgumentAsDerived"
|
||||||
|
else getattr(ifcopenshell_wrapper.entity_instance, mname)
|
||||||
|
for mname in fn_names
|
||||||
|
]
|
||||||
|
|
||||||
_method_dict[fq_name] = functions
|
_method_dict[fq_name] = functions
|
||||||
|
|
||||||
|
|||||||
@@ -26,13 +26,16 @@ import documentation
|
|||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
|
||||||
class Header(codegen.Base):
|
class Header(codegen.Base):
|
||||||
def __init__(self, mapping):
|
def __init__(self, mapping):
|
||||||
declarations = []
|
declarations = []
|
||||||
|
|
||||||
case_lookup = lambda nm: [k for k in mapping.schema.keys if k.lower() == nm.lower()][0]
|
case_lookup = lambda nm: [k for k in mapping.schema.keys if k.lower() == nm.lower()][0]
|
||||||
case_normalize = lambda nm: nm if nm.startswith("IfcUtil::") else case_lookup(nm)
|
case_normalize = lambda nm: nm if nm.startswith("IfcUtil::") else case_lookup(nm)
|
||||||
create_supertype_statement = lambda nms: ", ".join("public %s %s" % ("" if c.startswith("IfcUtil::") else "",c) for c in nms)
|
create_supertype_statement = lambda nms: ", ".join(
|
||||||
|
"public %s %s" % ("" if c.startswith("IfcUtil::") else "", c) for c in nms
|
||||||
|
)
|
||||||
|
|
||||||
write = lambda str, **kwargs: declarations.append(
|
write = lambda str, **kwargs: declarations.append(
|
||||||
str
|
str
|
||||||
@@ -81,7 +84,11 @@ class Header(codegen.Base):
|
|||||||
superclasses.append("IfcUtil::IfcBaseType")
|
superclasses.append("IfcUtil::IfcBaseType")
|
||||||
superclasses.extend(get_select_super_types(name, bases=all_superclasses))
|
superclasses.extend(get_select_super_types(name, bases=all_superclasses))
|
||||||
|
|
||||||
is_emitted = lambda nm: nm == "IfcUtil::IfcBaseType" or nm in mapping.schema.selects or nm.lower() in emitted_simpletypes
|
is_emitted = (
|
||||||
|
lambda nm: nm == "IfcUtil::IfcBaseType"
|
||||||
|
or nm in mapping.schema.selects
|
||||||
|
or nm.lower() in emitted_simpletypes
|
||||||
|
)
|
||||||
if not all(map(is_emitted, superclasses)):
|
if not all(map(is_emitted, superclasses)):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -91,7 +98,9 @@ class Header(codegen.Base):
|
|||||||
|
|
||||||
superclass_statement = create_supertype_statement(superclasses)
|
superclass_statement = create_supertype_statement(superclasses)
|
||||||
|
|
||||||
write(templates.simpletype, name=name, type=type_str, attr_type=attr_type, superclass=superclass_statement)
|
write(
|
||||||
|
templates.simpletype, name=name, type=type_str, attr_type=attr_type, superclass=superclass_statement
|
||||||
|
)
|
||||||
|
|
||||||
class_definitions = []
|
class_definitions = []
|
||||||
|
|
||||||
|
|||||||
@@ -92,15 +92,17 @@ class Implementation(codegen.Base):
|
|||||||
else:
|
else:
|
||||||
return templates.get_attr_stmt
|
return templates.get_attr_stmt
|
||||||
|
|
||||||
null_check = ''
|
null_check = ""
|
||||||
if arg["is_optional"]:
|
if arg["is_optional"]:
|
||||||
attr_check = "if(!data_->getArgument(%d) || data_->getArgument(%d)->isNull()) { return %%s; }" % (arg["index"] - 1, arg["index"] - 1)
|
attr_check = (
|
||||||
|
"if(!data_->getArgument(%d) || data_->getArgument(%d)->isNull()) { return %%s; }"
|
||||||
|
% (arg["index"] - 1, arg["index"] - 1)
|
||||||
|
)
|
||||||
if "boost::optional" in arg["full_type"]:
|
if "boost::optional" in arg["full_type"]:
|
||||||
null_check = attr_check % "boost::none"
|
null_check = attr_check % "boost::none"
|
||||||
else:
|
else:
|
||||||
null_check = attr_check % "nullptr"
|
null_check = attr_check % "nullptr"
|
||||||
|
|
||||||
|
|
||||||
tmpl = find_template(arg)
|
tmpl = find_template(arg)
|
||||||
write_attr(
|
write_attr(
|
||||||
templates.const_function,
|
templates.const_function,
|
||||||
@@ -115,9 +117,11 @@ class Implementation(codegen.Base):
|
|||||||
"index": arg["index"] - 1,
|
"index": arg["index"] - 1,
|
||||||
"type": arg["full_type"].replace("::Value", ""),
|
"type": arg["full_type"].replace("::Value", ""),
|
||||||
"non_optional_type": arg["non_optional_type"].replace("::Value", ""),
|
"non_optional_type": arg["non_optional_type"].replace("::Value", ""),
|
||||||
"non_optional_type_no_pointer": arg["non_optional_type"].replace("::Value", "").replace("*", ""),
|
"non_optional_type_no_pointer": arg["non_optional_type"]
|
||||||
|
.replace("::Value", "")
|
||||||
|
.replace("*", ""),
|
||||||
"list_instance_type": arg["list_instance_type"],
|
"list_instance_type": arg["list_instance_type"],
|
||||||
"null_check": null_check
|
"null_check": null_check,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -146,7 +150,7 @@ class Implementation(codegen.Base):
|
|||||||
"index": arg["index"] - 1,
|
"index": arg["index"] - 1,
|
||||||
"type": arg["full_type"].replace("::Value", ""),
|
"type": arg["full_type"].replace("::Value", ""),
|
||||||
"non_optional_type": arg["non_optional_type"].replace("::Value", ""),
|
"non_optional_type": arg["non_optional_type"].replace("::Value", ""),
|
||||||
"star_if_optional": "*" if "boost::optional" in arg["full_type"] else ""
|
"star_if_optional": "*" if "boost::optional" in arg["full_type"] else "",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -142,10 +142,13 @@ class Mapping:
|
|||||||
raise ValueError("Unable to map type %r for attribute %r" % (type, attr))
|
raise ValueError("Unable to map type %r for attribute %r" % (type, attr))
|
||||||
|
|
||||||
ty = _make_argument_type(attr.type if hasattr(attr, "type") else attr)
|
ty = _make_argument_type(attr.type if hasattr(attr, "type") else attr)
|
||||||
if ty == "TRIBOOL": ty = "LOGICAL"
|
if ty == "TRIBOOL":
|
||||||
|
ty = "LOGICAL"
|
||||||
|
|
||||||
if ty not in self.supported_argument_types:
|
if ty not in self.supported_argument_types:
|
||||||
import pdb; pdb.set_trace()
|
import pdb
|
||||||
|
|
||||||
|
pdb.set_trace()
|
||||||
print("Attribute %r mapped as 'unknown'" % (attr), file=sys.stderr)
|
print("Attribute %r mapped as 'unknown'" % (attr), file=sys.stderr)
|
||||||
ty = "UNKNOWN"
|
ty = "UNKNOWN"
|
||||||
return "IfcUtil::Argument_%s" % ty
|
return "IfcUtil::Argument_%s" % ty
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ if has_occ:
|
|||||||
# nb: we just subclass serializer settings, so in python
|
# nb: we just subclass serializer settings, so in python
|
||||||
# we do not differentiate between the two setting types
|
# we do not differentiate between the two setting types
|
||||||
|
|
||||||
|
|
||||||
class settings(ifcopenshell_wrapper.SerializerSettings):
|
class settings(ifcopenshell_wrapper.SerializerSettings):
|
||||||
if has_occ:
|
if has_occ:
|
||||||
USE_PYTHON_OPENCASCADE = -1
|
USE_PYTHON_OPENCASCADE = -1
|
||||||
@@ -245,6 +246,7 @@ def make_shape_function(fn):
|
|||||||
serialise = make_shape_function(ifcopenshell_wrapper.serialise)
|
serialise = make_shape_function(ifcopenshell_wrapper.serialise)
|
||||||
tesselate = make_shape_function(ifcopenshell_wrapper.tesselate)
|
tesselate = make_shape_function(ifcopenshell_wrapper.tesselate)
|
||||||
|
|
||||||
|
|
||||||
def wrap_buffer_creation(fn):
|
def wrap_buffer_creation(fn):
|
||||||
"""
|
"""
|
||||||
Python does not have automatic casts. The C++ serializers accept a stream_or_filename
|
Python does not have automatic casts. The C++ serializers accept a stream_or_filename
|
||||||
@@ -257,20 +259,22 @@ def wrap_buffer_creation(fn):
|
|||||||
return ifcopenshell_wrapper.buffer(v)
|
return ifcopenshell_wrapper.buffer(v)
|
||||||
else:
|
else:
|
||||||
return v
|
return v
|
||||||
|
|
||||||
def inner(*args):
|
def inner(*args):
|
||||||
return fn(*map(transform_string, args))
|
return fn(*map(transform_string, args))
|
||||||
|
|
||||||
return inner
|
return inner
|
||||||
|
|
||||||
|
|
||||||
serializer_dict = {}
|
serializer_dict = {}
|
||||||
serializer_dict['obj'] = wrap_buffer_creation(ifcopenshell_wrapper.WaveFrontOBJSerializer)
|
serializer_dict["obj"] = wrap_buffer_creation(ifcopenshell_wrapper.WaveFrontOBJSerializer)
|
||||||
serializer_dict['svg'] = wrap_buffer_creation(ifcopenshell_wrapper.SvgSerializer)
|
serializer_dict["svg"] = wrap_buffer_creation(ifcopenshell_wrapper.SvgSerializer)
|
||||||
serializer_dict['buffer'] = ifcopenshell_wrapper.buffer
|
serializer_dict["buffer"] = ifcopenshell_wrapper.buffer
|
||||||
try:
|
try:
|
||||||
# HdfSerializer doesn't support writing to a buffer (obviously) only to filename
|
# HdfSerializer doesn't support writing to a buffer (obviously) only to filename
|
||||||
# so no wrap_buffer_creation()
|
# so no wrap_buffer_creation()
|
||||||
serializer_dict['hdf5'] = ifcopenshell_wrapper.HdfSerializer
|
serializer_dict["hdf5"] = ifcopenshell_wrapper.HdfSerializer
|
||||||
except: pass
|
except:
|
||||||
|
pass
|
||||||
serializers = type('serializers', (), serializer_dict)
|
|
||||||
|
|
||||||
|
serializers = type("serializers", (), serializer_dict)
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class Migrator:
|
|||||||
"TransverseBarSpacing": 1,
|
"TransverseBarSpacing": 1,
|
||||||
# Manual additions from experience
|
# Manual additions from experience
|
||||||
"InteriorOrExteriorSpace": "NOTDEFINED",
|
"InteriorOrExteriorSpace": "NOTDEFINED",
|
||||||
"AssemblyPlace": "NOTDEFINED", # See bug https://github.com/Autodesk/revit-ifc/issues/395
|
"AssemblyPlace": "NOTDEFINED", # See bug https://github.com/Autodesk/revit-ifc/issues/395
|
||||||
}
|
}
|
||||||
self.default_entities = {
|
self.default_entities = {
|
||||||
"CurrentValue": None,
|
"CurrentValue": None,
|
||||||
|
|||||||
@@ -5,12 +5,17 @@ import ifcopenshell.api
|
|||||||
class TestEditContext(test.bootstrap.IFC4):
|
class TestEditContext(test.bootstrap.IFC4):
|
||||||
def test_editing_a_context(self):
|
def test_editing_a_context(self):
|
||||||
context = self.file.createIfcGeometricRepresentationContext()
|
context = self.file.createIfcGeometricRepresentationContext()
|
||||||
ifcopenshell.api.run("context.edit_context", self.file, context=context, attributes={
|
ifcopenshell.api.run(
|
||||||
"ContextIdentifier": "ContextIdentifier",
|
"context.edit_context",
|
||||||
"ContextType": "ContextType",
|
self.file,
|
||||||
"CoordinateSpaceDimension": 1,
|
context=context,
|
||||||
"Precision": 1,
|
attributes={
|
||||||
})
|
"ContextIdentifier": "ContextIdentifier",
|
||||||
|
"ContextType": "ContextType",
|
||||||
|
"CoordinateSpaceDimension": 1,
|
||||||
|
"Precision": 1,
|
||||||
|
},
|
||||||
|
)
|
||||||
assert context.ContextIdentifier == "ContextIdentifier"
|
assert context.ContextIdentifier == "ContextIdentifier"
|
||||||
assert context.ContextType == "ContextType"
|
assert context.ContextType == "ContextType"
|
||||||
assert context.CoordinateSpaceDimension == 1
|
assert context.CoordinateSpaceDimension == 1
|
||||||
@@ -18,13 +23,18 @@ class TestEditContext(test.bootstrap.IFC4):
|
|||||||
|
|
||||||
def test_editing_a_subcontext(self):
|
def test_editing_a_subcontext(self):
|
||||||
subcontext = self.file.createIfcGeometricRepresentationSubcontext()
|
subcontext = self.file.createIfcGeometricRepresentationSubcontext()
|
||||||
ifcopenshell.api.run("context.edit_context", self.file, context=subcontext, attributes={
|
ifcopenshell.api.run(
|
||||||
"ContextIdentifier": "ContextIdentifier",
|
"context.edit_context",
|
||||||
"ContextType": "ContextType",
|
self.file,
|
||||||
"TargetScale": 0.5,
|
context=subcontext,
|
||||||
"TargetView": "MODEL_VIEW",
|
attributes={
|
||||||
"UserDefinedTargetView": "UserDefinedTargetView",
|
"ContextIdentifier": "ContextIdentifier",
|
||||||
})
|
"ContextType": "ContextType",
|
||||||
|
"TargetScale": 0.5,
|
||||||
|
"TargetView": "MODEL_VIEW",
|
||||||
|
"UserDefinedTargetView": "UserDefinedTargetView",
|
||||||
|
},
|
||||||
|
)
|
||||||
assert subcontext.ContextIdentifier == "ContextIdentifier"
|
assert subcontext.ContextIdentifier == "ContextIdentifier"
|
||||||
assert subcontext.ContextType == "ContextType"
|
assert subcontext.ContextType == "ContextType"
|
||||||
assert subcontext.TargetScale == 0.5
|
assert subcontext.TargetScale == 0.5
|
||||||
|
|||||||
@@ -5,11 +5,16 @@ import ifcopenshell.api
|
|||||||
class TestEditTextLiteral(test.bootstrap.IFC4):
|
class TestEditTextLiteral(test.bootstrap.IFC4):
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
text = self.file.createIfcTextLiteralWithExtent()
|
text = self.file.createIfcTextLiteralWithExtent()
|
||||||
ifcopenshell.api.run("drawing.edit_text_literal", self.file, text_literal=text, attributes={
|
ifcopenshell.api.run(
|
||||||
"Literal": "Literal",
|
"drawing.edit_text_literal",
|
||||||
"Path": "RIGHT",
|
self.file,
|
||||||
"BoxAlignment": "middle",
|
text_literal=text,
|
||||||
})
|
attributes={
|
||||||
|
"Literal": "Literal",
|
||||||
|
"Path": "RIGHT",
|
||||||
|
"BoxAlignment": "middle",
|
||||||
|
},
|
||||||
|
)
|
||||||
assert text.Literal == "Literal"
|
assert text.Literal == "Literal"
|
||||||
assert text.Path == "RIGHT"
|
assert text.Path == "RIGHT"
|
||||||
assert text.BoxAlignment == "middle"
|
assert text.BoxAlignment == "middle"
|
||||||
|
|||||||
@@ -36,11 +36,7 @@ class TestRemoveRepresentation(test.bootstrap.IFC4):
|
|||||||
self.file.createIfcWallType(RepresentationMaps=[representation_map])
|
self.file.createIfcWallType(RepresentationMaps=[representation_map])
|
||||||
representation = self.file.createIfcShapeRepresentation(
|
representation = self.file.createIfcShapeRepresentation(
|
||||||
RepresentationType="MappedRepresentation",
|
RepresentationType="MappedRepresentation",
|
||||||
Items=[
|
Items=[self.file.createIfcMappedItem(MappingTarget=representation_map)],
|
||||||
self.file.createIfcMappedItem(
|
|
||||||
MappingTarget=representation_map
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
assert len(self.file.by_type("IfcShapeRepresentation")) == 2
|
assert len(self.file.by_type("IfcShapeRepresentation")) == 2
|
||||||
ifcopenshell.api.run("geometry.remove_representation", self.file, representation=representation)
|
ifcopenshell.api.run("geometry.remove_representation", self.file, representation=representation)
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ class TestCreateGridAxis(test.bootstrap.IFC4):
|
|||||||
axis2 = ifcopenshell.api.run(
|
axis2 = ifcopenshell.api.run(
|
||||||
"grid.create_grid_axis", self.file, axis_tag="axis_tag", same_sense=True, uvw_axes="UAxes", grid=grid
|
"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):
|
class TestEditLibrary(test.bootstrap.IFC4):
|
||||||
def test_editing_a_library(self):
|
def test_editing_a_library(self):
|
||||||
library = self.file.createIfcLibraryInformation()
|
library = self.file.createIfcLibraryInformation()
|
||||||
ifcopenshell.api.run("library.edit_library", self.file, library=library, attributes={
|
ifcopenshell.api.run(
|
||||||
"Name": "Name",
|
"library.edit_library",
|
||||||
"Version": "Version",
|
self.file,
|
||||||
"VersionDate": "VersionDate",
|
library=library,
|
||||||
"Location": "Location",
|
attributes={
|
||||||
"Description": "Description",
|
"Name": "Name",
|
||||||
})
|
"Version": "Version",
|
||||||
|
"VersionDate": "VersionDate",
|
||||||
|
"Location": "Location",
|
||||||
|
"Description": "Description",
|
||||||
|
},
|
||||||
|
)
|
||||||
assert library.Name == "Name"
|
assert library.Name == "Name"
|
||||||
assert library.Version == "Version"
|
assert library.Version == "Version"
|
||||||
assert library.VersionDate == "VersionDate"
|
assert library.VersionDate == "VersionDate"
|
||||||
|
|||||||
@@ -5,13 +5,18 @@ import ifcopenshell.api
|
|||||||
class TestEditReference(test.bootstrap.IFC4):
|
class TestEditReference(test.bootstrap.IFC4):
|
||||||
def test_editing_a_reference(self):
|
def test_editing_a_reference(self):
|
||||||
reference = self.file.createIfcLibraryReference()
|
reference = self.file.createIfcLibraryReference()
|
||||||
ifcopenshell.api.run("library.edit_reference", self.file, reference=reference, attributes={
|
ifcopenshell.api.run(
|
||||||
"Location": "Location",
|
"library.edit_reference",
|
||||||
"Identification": "Identification",
|
self.file,
|
||||||
"Name": "Name",
|
reference=reference,
|
||||||
"Description": "Description",
|
attributes={
|
||||||
"Language": "Language",
|
"Location": "Location",
|
||||||
})
|
"Identification": "Identification",
|
||||||
|
"Name": "Name",
|
||||||
|
"Description": "Description",
|
||||||
|
"Language": "Language",
|
||||||
|
},
|
||||||
|
)
|
||||||
assert reference.Location == "Location"
|
assert reference.Location == "Location"
|
||||||
assert reference.Identification == "Identification"
|
assert reference.Identification == "Identification"
|
||||||
assert reference.Name == "Name"
|
assert reference.Name == "Name"
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ class TestRemoveLibrary(test.bootstrap.IFC4):
|
|||||||
library = self.file.createIfcLibraryInformation()
|
library = self.file.createIfcLibraryInformation()
|
||||||
reference1 = self.file.createIfcLibraryReference(ReferencedLibrary=library)
|
reference1 = self.file.createIfcLibraryReference(ReferencedLibrary=library)
|
||||||
reference2 = self.file.createIfcLibraryReference(ReferencedLibrary=library)
|
reference2 = self.file.createIfcLibraryReference(ReferencedLibrary=library)
|
||||||
self.file.createIfcRelAssociatesLibrary(GlobalId='foo', RelatingLibrary=library)
|
self.file.createIfcRelAssociatesLibrary(GlobalId="foo", RelatingLibrary=library)
|
||||||
self.file.createIfcRelAssociatesLibrary(GlobalId='bar', RelatingLibrary=reference1)
|
self.file.createIfcRelAssociatesLibrary(GlobalId="bar", RelatingLibrary=reference1)
|
||||||
ifcopenshell.api.run("library.remove_library", self.file, library=library)
|
ifcopenshell.api.run("library.remove_library", self.file, library=library)
|
||||||
assert len(self.file.by_type("IfcLibraryReference")) == 0
|
assert len(self.file.by_type("IfcLibraryReference")) == 0
|
||||||
assert len(self.file.by_type("IfcRelAssociatesLibrary")) == 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.is_a("IfcOrganization")
|
||||||
assert developer.Identification == "IfcOpenShell"
|
assert developer.Identification == "IfcOpenShell"
|
||||||
assert developer.Name == "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].Role == "USERDEFINED"
|
||||||
assert developer.Roles[0].UserDefinedRole == "CONTRIBUTOR"
|
assert developer.Roles[0].UserDefinedRole == "CONTRIBUTOR"
|
||||||
assert developer.Addresses[0].is_a("IfcTelecomAddress")
|
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
|
old_get_application = ifcopenshell.api.owner.settings.get_application
|
||||||
user = self.file.createIfcPersonAndOrganization()
|
user = self.file.createIfcPersonAndOrganization()
|
||||||
application = self.file.createIfcApplication()
|
application = self.file.createIfcApplication()
|
||||||
ifcopenshell.api.owner.settings.get_user = lambda x : user
|
ifcopenshell.api.owner.settings.get_user = lambda x: user
|
||||||
ifcopenshell.api.owner.settings.get_application = lambda x : application
|
ifcopenshell.api.owner.settings.get_application = lambda x: application
|
||||||
history = ifcopenshell.api.run("owner.create_owner_history", self.file)
|
history = ifcopenshell.api.run("owner.create_owner_history", self.file)
|
||||||
ifcopenshell.api.owner.settings.get_user = old_get_user
|
ifcopenshell.api.owner.settings.get_user = old_get_user
|
||||||
ifcopenshell.api.owner.settings.get_application = old_get_application
|
ifcopenshell.api.owner.settings.get_application = old_get_application
|
||||||
|
|||||||
@@ -5,18 +5,23 @@ import ifcopenshell.api
|
|||||||
class TestEditAddress(test.bootstrap.IFC4):
|
class TestEditAddress(test.bootstrap.IFC4):
|
||||||
def test_editing_a_postal_address(self):
|
def test_editing_a_postal_address(self):
|
||||||
address = self.file.createIfcPostalAddress()
|
address = self.file.createIfcPostalAddress()
|
||||||
ifcopenshell.api.run("owner.edit_address", self.file, address=address, attributes={
|
ifcopenshell.api.run(
|
||||||
"Purpose": "OFFICE",
|
"owner.edit_address",
|
||||||
"Description": "Description",
|
self.file,
|
||||||
"UserDefinedPurpose": "UserDefinedPurpose",
|
address=address,
|
||||||
"InternalLocation": "InternalLocation",
|
attributes={
|
||||||
"AddressLines": ["Address", "Lines"],
|
"Purpose": "OFFICE",
|
||||||
"PostalBox": "PostalBox",
|
"Description": "Description",
|
||||||
"Town": "Town",
|
"UserDefinedPurpose": "UserDefinedPurpose",
|
||||||
"Region": "Region",
|
"InternalLocation": "InternalLocation",
|
||||||
"PostalCode": "PostalCode",
|
"AddressLines": ["Address", "Lines"],
|
||||||
"Country": "Country",
|
"PostalBox": "PostalBox",
|
||||||
})
|
"Town": "Town",
|
||||||
|
"Region": "Region",
|
||||||
|
"PostalCode": "PostalCode",
|
||||||
|
"Country": "Country",
|
||||||
|
},
|
||||||
|
)
|
||||||
assert address.Purpose == "OFFICE"
|
assert address.Purpose == "OFFICE"
|
||||||
assert address.Description == "Description"
|
assert address.Description == "Description"
|
||||||
assert address.UserDefinedPurpose == "UserDefinedPurpose"
|
assert address.UserDefinedPurpose == "UserDefinedPurpose"
|
||||||
@@ -30,17 +35,22 @@ class TestEditAddress(test.bootstrap.IFC4):
|
|||||||
|
|
||||||
def test_editing_a_telecom_address(self):
|
def test_editing_a_telecom_address(self):
|
||||||
address = self.file.createIfcTelecomAddress()
|
address = self.file.createIfcTelecomAddress()
|
||||||
ifcopenshell.api.run("owner.edit_address", self.file, address=address, attributes={
|
ifcopenshell.api.run(
|
||||||
"Purpose": "OFFICE",
|
"owner.edit_address",
|
||||||
"Description": "Description",
|
self.file,
|
||||||
"UserDefinedPurpose": "UserDefinedPurpose",
|
address=address,
|
||||||
"TelephoneNumbers": ["Telephone", "Numbers"],
|
attributes={
|
||||||
"FacsimileNumbers": ["Facsimile", "Numbers"],
|
"Purpose": "OFFICE",
|
||||||
"PagerNumber": "PagerNumber",
|
"Description": "Description",
|
||||||
"ElectronicMailAddresses": ["Electronic", "Mail", "Addresses"],
|
"UserDefinedPurpose": "UserDefinedPurpose",
|
||||||
"WWWHomePageURL": "WWWHomePageURL",
|
"TelephoneNumbers": ["Telephone", "Numbers"],
|
||||||
"MessagingIDs": ["Messaging", "IDs"],
|
"FacsimileNumbers": ["Facsimile", "Numbers"],
|
||||||
})
|
"PagerNumber": "PagerNumber",
|
||||||
|
"ElectronicMailAddresses": ["Electronic", "Mail", "Addresses"],
|
||||||
|
"WWWHomePageURL": "WWWHomePageURL",
|
||||||
|
"MessagingIDs": ["Messaging", "IDs"],
|
||||||
|
},
|
||||||
|
)
|
||||||
assert address.Purpose == "OFFICE"
|
assert address.Purpose == "OFFICE"
|
||||||
assert address.Description == "Description"
|
assert address.Description == "Description"
|
||||||
assert address.UserDefinedPurpose == "UserDefinedPurpose"
|
assert address.UserDefinedPurpose == "UserDefinedPurpose"
|
||||||
|
|||||||
@@ -5,11 +5,16 @@ import ifcopenshell.api
|
|||||||
class TestEditOrganisation(test.bootstrap.IFC4):
|
class TestEditOrganisation(test.bootstrap.IFC4):
|
||||||
def test_editing_a_organisation(self):
|
def test_editing_a_organisation(self):
|
||||||
organisation = self.file.createIfcOrganization()
|
organisation = self.file.createIfcOrganization()
|
||||||
ifcopenshell.api.run("owner.edit_organisation", self.file, organisation=organisation, attributes={
|
ifcopenshell.api.run(
|
||||||
"Identification": "Identification",
|
"owner.edit_organisation",
|
||||||
"Name": "Name",
|
self.file,
|
||||||
"Description": "Description",
|
organisation=organisation,
|
||||||
})
|
attributes={
|
||||||
|
"Identification": "Identification",
|
||||||
|
"Name": "Name",
|
||||||
|
"Description": "Description",
|
||||||
|
},
|
||||||
|
)
|
||||||
assert organisation.Identification == "Identification"
|
assert organisation.Identification == "Identification"
|
||||||
assert organisation.Name == "Name"
|
assert organisation.Name == "Name"
|
||||||
assert organisation.Description == "Description"
|
assert organisation.Description == "Description"
|
||||||
|
|||||||
@@ -5,14 +5,19 @@ import ifcopenshell.api
|
|||||||
class TestEditPerson(test.bootstrap.IFC4):
|
class TestEditPerson(test.bootstrap.IFC4):
|
||||||
def test_editing_a_person(self):
|
def test_editing_a_person(self):
|
||||||
person = self.file.createIfcPerson()
|
person = self.file.createIfcPerson()
|
||||||
ifcopenshell.api.run("owner.edit_person", self.file, person=person, attributes={
|
ifcopenshell.api.run(
|
||||||
"Identification": "Identification",
|
"owner.edit_person",
|
||||||
"FamilyName": "FamilyName",
|
self.file,
|
||||||
"GivenName": "GivenName",
|
person=person,
|
||||||
"MiddleNames": ["Middle", "Names"],
|
attributes={
|
||||||
"PrefixTitles": ["Prefix", "Titles"],
|
"Identification": "Identification",
|
||||||
"SuffixTitles": ["Suffix", "Titles"],
|
"FamilyName": "FamilyName",
|
||||||
})
|
"GivenName": "GivenName",
|
||||||
|
"MiddleNames": ["Middle", "Names"],
|
||||||
|
"PrefixTitles": ["Prefix", "Titles"],
|
||||||
|
"SuffixTitles": ["Suffix", "Titles"],
|
||||||
|
},
|
||||||
|
)
|
||||||
assert person.Identification == "Identification"
|
assert person.Identification == "Identification"
|
||||||
assert person.FamilyName == "FamilyName"
|
assert person.FamilyName == "FamilyName"
|
||||||
assert person.GivenName == "GivenName"
|
assert person.GivenName == "GivenName"
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ import ifcopenshell.api
|
|||||||
class TestEditRole(test.bootstrap.IFC4):
|
class TestEditRole(test.bootstrap.IFC4):
|
||||||
def test_editing_a_role(self):
|
def test_editing_a_role(self):
|
||||||
role = self.file.createIfcActorRole()
|
role = self.file.createIfcActorRole()
|
||||||
ifcopenshell.api.run("owner.edit_role", self.file, role=role, attributes={
|
ifcopenshell.api.run(
|
||||||
"Role": "ARCHITECT",
|
"owner.edit_role",
|
||||||
"UserDefinedRole": "UserDefinedRole",
|
self.file,
|
||||||
"Description": "Description"
|
role=role,
|
||||||
})
|
attributes={"Role": "ARCHITECT", "UserDefinedRole": "UserDefinedRole", "Description": "Description"},
|
||||||
|
)
|
||||||
assert role.Role == "ARCHITECT"
|
assert role.Role == "ARCHITECT"
|
||||||
assert role.UserDefinedRole == "UserDefinedRole"
|
assert role.UserDefinedRole == "UserDefinedRole"
|
||||||
assert role.Description == "Description"
|
assert role.Description == "Description"
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ class TestUpdateOwnerHistory(test.bootstrap.IFC4):
|
|||||||
|
|
||||||
user = self.file.createIfcPersonAndOrganization()
|
user = self.file.createIfcPersonAndOrganization()
|
||||||
application = self.file.createIfcApplication()
|
application = self.file.createIfcApplication()
|
||||||
ifcopenshell.api.owner.settings.get_user = lambda x : user
|
ifcopenshell.api.owner.settings.get_user = lambda x: user
|
||||||
ifcopenshell.api.owner.settings.get_application = lambda x : application
|
ifcopenshell.api.owner.settings.get_application = lambda x: application
|
||||||
|
|
||||||
element = self.file.createIfcWall()
|
element = self.file.createIfcWall()
|
||||||
history = ifcopenshell.api.run("owner.update_owner_history", self.file, element=element)
|
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()
|
user = self.file.createIfcPersonAndOrganization()
|
||||||
application = self.file.createIfcApplication()
|
application = self.file.createIfcApplication()
|
||||||
ifcopenshell.api.owner.settings.get_user = lambda x : user
|
ifcopenshell.api.owner.settings.get_user = lambda x: user
|
||||||
ifcopenshell.api.owner.settings.get_application = lambda x : application
|
ifcopenshell.api.owner.settings.get_application = lambda x: application
|
||||||
|
|
||||||
element = self.file.createIfcWall()
|
element = self.file.createIfcWall()
|
||||||
old_history = ifcopenshell.api.run("owner.create_owner_history", self.file)
|
old_history = ifcopenshell.api.run("owner.create_owner_history", self.file)
|
||||||
@@ -55,8 +55,8 @@ class TestUpdateOwnerHistory(test.bootstrap.IFC4):
|
|||||||
|
|
||||||
user = self.file.createIfcPersonAndOrganization()
|
user = self.file.createIfcPersonAndOrganization()
|
||||||
application = self.file.createIfcApplication()
|
application = self.file.createIfcApplication()
|
||||||
ifcopenshell.api.owner.settings.get_user = lambda x : user
|
ifcopenshell.api.owner.settings.get_user = lambda x: user
|
||||||
ifcopenshell.api.owner.settings.get_application = lambda x : application
|
ifcopenshell.api.owner.settings.get_application = lambda x: application
|
||||||
|
|
||||||
element = self.file.createIfcWall()
|
element = self.file.createIfcWall()
|
||||||
element2 = 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")
|
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")
|
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={
|
ifcopenshell.api.run(
|
||||||
"BaseQuantityConsumed": "P0.5D",
|
"pset.edit_pset",
|
||||||
"BaseQuantityProducedName": "GrossVolume",
|
self.file,
|
||||||
"BaseQuantityProducedValue": 5,
|
pset=pset,
|
||||||
})
|
properties={
|
||||||
|
"BaseQuantityConsumed": "P0.5D",
|
||||||
|
"BaseQuantityProducedName": "GrossVolume",
|
||||||
|
"BaseQuantityProducedValue": 5,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
slab = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSlab")
|
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")
|
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)
|
ifcopenshell.api.run("resource.calculate_resource_work", self.file, resource=resource)
|
||||||
assert resource.Usage.ScheduleWork == "P2.0D"
|
assert resource.Usage.ScheduleWork == "P2.0D"
|
||||||
|
|
||||||
|
|
||||||
def test_calculating_resource_work_based_on_an_hourly_productivity_rate(self):
|
def test_calculating_resource_work_based_on_an_hourly_productivity_rate(self):
|
||||||
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
||||||
|
|
||||||
resource = ifcopenshell.api.run("resource.add_resource", self.file, ifc_class="IfcLaborResource")
|
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")
|
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={
|
ifcopenshell.api.run(
|
||||||
"BaseQuantityConsumed": "PT1H",
|
"pset.edit_pset",
|
||||||
"BaseQuantityProducedName": "GrossVolume",
|
self.file,
|
||||||
"BaseQuantityProducedValue": 5,
|
pset=pset,
|
||||||
})
|
properties={
|
||||||
|
"BaseQuantityConsumed": "PT1H",
|
||||||
|
"BaseQuantityProducedName": "GrossVolume",
|
||||||
|
"BaseQuantityProducedValue": 5,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
slab = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSlab")
|
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")
|
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")
|
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")
|
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={
|
ifcopenshell.api.run(
|
||||||
"BaseQuantityConsumed": "PT1H",
|
"pset.edit_pset",
|
||||||
"BaseQuantityProducedName": "Count",
|
self.file,
|
||||||
"BaseQuantityProducedValue": 2,
|
pset=pset,
|
||||||
})
|
properties={
|
||||||
|
"BaseQuantityConsumed": "PT1H",
|
||||||
|
"BaseQuantityProducedName": "Count",
|
||||||
|
"BaseQuantityProducedValue": 2,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
slab = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcSlab")
|
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")
|
qto = ifcopenshell.api.run("pset.add_qto", self.file, product=slab, name="Qto_SlabBaseQuantities")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import pytest
|
|||||||
import test.bootstrap
|
import test.bootstrap
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
|
|
||||||
|
|
||||||
class TestAddStructuralAnalysisModel(test.bootstrap.IFC4):
|
class TestAddStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||||
def test_adding_a_structural_analysis_model(self):
|
def test_adding_a_structural_analysis_model(self):
|
||||||
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
||||||
|
|||||||
+2
-5
@@ -3,15 +3,12 @@ import pytest
|
|||||||
import test.bootstrap
|
import test.bootstrap
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
|
|
||||||
|
|
||||||
class TestAssignStructuralAnalysisModel(test.bootstrap.IFC4):
|
class TestAssignStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||||
def test_assigning_a_structural_analysis_model(self):
|
def test_assigning_a_structural_analysis_model(self):
|
||||||
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
||||||
product = ifcopenshell.api.run(
|
product = ifcopenshell.api.run(
|
||||||
"root.create_entity",
|
"root.create_entity", self.file, ifc_class="IfcStructuralMember", predefined_type=None, name=None
|
||||||
self.file,
|
|
||||||
ifc_class="IfcStructuralMember",
|
|
||||||
predefined_type=None,
|
|
||||||
name=None
|
|
||||||
)
|
)
|
||||||
rel = ifcopenshell.api.run(
|
rel = ifcopenshell.api.run(
|
||||||
"structural.assign_structural_analysis_model",
|
"structural.assign_structural_analysis_model",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import pytest
|
|||||||
import test.bootstrap
|
import test.bootstrap
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
|
|
||||||
|
|
||||||
class TestEditStructuralAnalysisModel(test.bootstrap.IFC4):
|
class TestEditStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||||
def test_editing_a_structural_analysis_model(self):
|
def test_editing_a_structural_analysis_model(self):
|
||||||
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
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",
|
"structural.edit_structural_analysis_model",
|
||||||
self.file,
|
self.file,
|
||||||
structural_analysis_model=subject,
|
structural_analysis_model=subject,
|
||||||
attributes={
|
attributes={"Name": "My edited model", "Description": "Description of my model"},
|
||||||
"Name": "My edited model",
|
|
||||||
"Description": "Description of my model"
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
models = self.file.by_type("IfcStructuralAnalysisModel")
|
models = self.file.by_type("IfcStructuralAnalysisModel")
|
||||||
assert subject == models[0]
|
assert subject == models[0]
|
||||||
|
|||||||
+1
-1
@@ -3,6 +3,7 @@ import pytest
|
|||||||
import test.bootstrap
|
import test.bootstrap
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
|
|
||||||
|
|
||||||
class TestRemoveStructuralAnalysisModel(test.bootstrap.IFC4):
|
class TestRemoveStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||||
def test_removing_a_structural_analysis_model(self):
|
def test_removing_a_structural_analysis_model(self):
|
||||||
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
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",
|
"structural.remove_structural_analysis_model",
|
||||||
self.file,
|
self.file,
|
||||||
structural_analysis_model=subject,
|
structural_analysis_model=subject,
|
||||||
|
|
||||||
)
|
)
|
||||||
models = self.file.by_type("IfcStructuralAnalysisModel")
|
models = self.file.by_type("IfcStructuralAnalysisModel")
|
||||||
assert len(models) == 0
|
assert len(models) == 0
|
||||||
|
|||||||
+2
-5
@@ -3,15 +3,12 @@ import pytest
|
|||||||
import test.bootstrap
|
import test.bootstrap
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
|
|
||||||
|
|
||||||
class TestUnassignStructuralAnalysisModel(test.bootstrap.IFC4):
|
class TestUnassignStructuralAnalysisModel(test.bootstrap.IFC4):
|
||||||
def test_unassigning_a_structural_analysis_model(self):
|
def test_unassigning_a_structural_analysis_model(self):
|
||||||
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
subject = ifcopenshell.api.run("structural.add_structural_analysis_model", self.file)
|
||||||
product = ifcopenshell.api.run(
|
product = ifcopenshell.api.run(
|
||||||
"root.create_entity",
|
"root.create_entity", self.file, ifc_class="IfcStructuralMember", predefined_type=None, name=None
|
||||||
self.file,
|
|
||||||
ifc_class="IfcStructuralMember",
|
|
||||||
predefined_type=None,
|
|
||||||
name=None
|
|
||||||
)
|
)
|
||||||
rel = ifcopenshell.api.run(
|
rel = ifcopenshell.api.run(
|
||||||
"structural.assign_structural_analysis_model",
|
"structural.assign_structural_analysis_model",
|
||||||
|
|||||||
@@ -5,8 +5,11 @@ import ifcopenshell.api
|
|||||||
class TestEditDerivedUnit(test.bootstrap.IFC4):
|
class TestEditDerivedUnit(test.bootstrap.IFC4):
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
unit = self.file.createIfcDerivedUnit()
|
unit = self.file.createIfcDerivedUnit()
|
||||||
ifcopenshell.api.run("unit.edit_derived_unit", self.file, unit=unit, attributes={
|
ifcopenshell.api.run(
|
||||||
"UnitType": "USERDEFINED", "UserDefinedType": "UserDefinedType"
|
"unit.edit_derived_unit",
|
||||||
})
|
self.file,
|
||||||
|
unit=unit,
|
||||||
|
attributes={"UnitType": "USERDEFINED", "UserDefinedType": "UserDefinedType"},
|
||||||
|
)
|
||||||
assert unit.UnitType == "USERDEFINED"
|
assert unit.UnitType == "USERDEFINED"
|
||||||
assert unit.UserDefinedType == "UserDefinedType"
|
assert unit.UserDefinedType == "UserDefinedType"
|
||||||
|
|||||||
@@ -5,7 +5,5 @@ import ifcopenshell.api
|
|||||||
class TestEditMonetaryUnit(test.bootstrap.IFC4):
|
class TestEditMonetaryUnit(test.bootstrap.IFC4):
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
unit = self.file.createIfcMonetaryUnit()
|
unit = self.file.createIfcMonetaryUnit()
|
||||||
ifcopenshell.api.run("unit.edit_monetary_unit", self.file, unit=unit, attributes={
|
ifcopenshell.api.run("unit.edit_monetary_unit", self.file, unit=unit, attributes={"Currency": "FOO"})
|
||||||
"Currency": "FOO"
|
|
||||||
})
|
|
||||||
assert unit.Currency == "FOO"
|
assert unit.Currency == "FOO"
|
||||||
|
|||||||
@@ -14,33 +14,37 @@ import ifcopenshell.template
|
|||||||
|
|
||||||
PERF = False
|
PERF = False
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class rect:
|
class rect:
|
||||||
width : float
|
width: float
|
||||||
height : float
|
height: float
|
||||||
|
|
||||||
def build(self, f):
|
def build(self, f):
|
||||||
return f.createIfcRectangleProfileDef("AREA", None, None, self.width, self.height)
|
return f.createIfcRectangleProfileDef("AREA", None, None, self.width, self.height)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class circle:
|
class circle:
|
||||||
radius : float
|
radius: float
|
||||||
|
|
||||||
def build(self, f):
|
def build(self, f):
|
||||||
return f.createIfcCircleProfileDef("AREA", None, None, self.radius)
|
return f.createIfcCircleProfileDef("AREA", None, None, self.radius)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class opening:
|
class opening:
|
||||||
x : float
|
x: float
|
||||||
z : float
|
z: float
|
||||||
shape : typing.Any
|
shape: typing.Any
|
||||||
depth : float
|
depth: float
|
||||||
direc : tuple = field(default_factory=lambda: (0.0, 0.0, -1.0))
|
direc: tuple = field(default_factory=lambda: (0.0, 0.0, -1.0))
|
||||||
|
|
||||||
O = 0., 0., 0.
|
|
||||||
X = 1., 0., 0.
|
O = 0.0, 0.0, 0.0
|
||||||
Y = 0., 1., 0.
|
X = 1.0, 0.0, 0.0
|
||||||
Z = 0., 0., 1.
|
Y = 0.0, 1.0, 0.0
|
||||||
|
Z = 0.0, 0.0, 1.0
|
||||||
|
|
||||||
# Creates an IfcAxis2Placement3D from Location, Axis and RefDirection specified as Python tuples
|
# Creates an IfcAxis2Placement3D from Location, Axis and RefDirection specified as Python tuples
|
||||||
def create_ifcaxis2placement(f, point=O, dir1=Z, dir2=X):
|
def create_ifcaxis2placement(f, point=O, dir1=Z, dir2=X):
|
||||||
@@ -50,12 +54,14 @@ def create_ifcaxis2placement(f, point=O, dir1=Z, dir2=X):
|
|||||||
axis2placement = f.createIfcAxis2Placement3D(point, dir1, dir2)
|
axis2placement = f.createIfcAxis2Placement3D(point, dir1, dir2)
|
||||||
return axis2placement
|
return axis2placement
|
||||||
|
|
||||||
|
|
||||||
# Creates an IfcLocalPlacement from Location, Axis and RefDirection, specified as Python tuples, and relative placement
|
# Creates an IfcLocalPlacement from Location, Axis and RefDirection, specified as Python tuples, and relative placement
|
||||||
def create_ifclocalplacement(f, point=O, dir1=Z, dir2=X, relative_to=None):
|
def create_ifclocalplacement(f, point=O, dir1=Z, dir2=X, relative_to=None):
|
||||||
axis2placement = create_ifcaxis2placement(f,point,dir1,dir2)
|
axis2placement = create_ifcaxis2placement(f, point, dir1, dir2)
|
||||||
ifclocalplacement2 = f.createIfcLocalPlacement(relative_to,axis2placement)
|
ifclocalplacement2 = f.createIfcLocalPlacement(relative_to, axis2placement)
|
||||||
return ifclocalplacement2
|
return ifclocalplacement2
|
||||||
|
|
||||||
|
|
||||||
# Creates an IfcPolyLine from a list of points, specified as Python tuples
|
# Creates an IfcPolyLine from a list of points, specified as Python tuples
|
||||||
def create_ifcpolyline(f, point_list):
|
def create_ifcpolyline(f, point_list):
|
||||||
ifcpts = []
|
ifcpts = []
|
||||||
@@ -65,6 +71,7 @@ def create_ifcpolyline(f, point_list):
|
|||||||
polyline = f.createIfcPolyLine(ifcpts)
|
polyline = f.createIfcPolyLine(ifcpts)
|
||||||
return polyline
|
return polyline
|
||||||
|
|
||||||
|
|
||||||
# Creates an IfcExtrudedAreaSolid from a list of points, specified as Python tuples
|
# Creates an IfcExtrudedAreaSolid from a list of points, specified as Python tuples
|
||||||
def create_ifcextrudedareasolid(f, point_list, ifcaxis2placement, extrude_dir, extrusion):
|
def create_ifcextrudedareasolid(f, point_list, ifcaxis2placement, extrude_dir, extrusion):
|
||||||
polyline = create_ifcpolyline(f, point_list)
|
polyline = create_ifcpolyline(f, point_list)
|
||||||
@@ -73,6 +80,7 @@ def create_ifcextrudedareasolid(f, point_list, ifcaxis2placement, extrude_dir, e
|
|||||||
ifcextrudedareasolid = f.createIfcExtrudedAreaSolid(ifcclosedprofile, ifcaxis2placement, ifcdir, extrusion)
|
ifcextrudedareasolid = f.createIfcExtrudedAreaSolid(ifcclosedprofile, ifcaxis2placement, ifcdir, extrusion)
|
||||||
return ifcextrudedareasolid
|
return ifcextrudedareasolid
|
||||||
|
|
||||||
|
|
||||||
def create_case(fn, openings):
|
def create_case(fn, openings):
|
||||||
|
|
||||||
f = ifcopenshell.template.create()
|
f = ifcopenshell.template.create()
|
||||||
@@ -84,55 +92,92 @@ def create_case(fn, openings):
|
|||||||
wall_placement = create_ifclocalplacement(f, relative_to=None)
|
wall_placement = create_ifclocalplacement(f, relative_to=None)
|
||||||
|
|
||||||
extrusion_placement = create_ifcaxis2placement(f, (0.0, 0.0, 0.0), (0.0, 0.0, 1.0), (1.0, 0.0, 0.0))
|
extrusion_placement = create_ifcaxis2placement(f, (0.0, 0.0, 0.0), (0.0, 0.0, 1.0), (1.0, 0.0, 0.0))
|
||||||
point_list_extrusion_area = [(0.0, -0.2, 0.0), (15.0, -0.2, 0.0), (15.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, -0.2, 0.0)]
|
point_list_extrusion_area = [
|
||||||
|
(0.0, -0.2, 0.0),
|
||||||
|
(15.0, -0.2, 0.0),
|
||||||
|
(15.0, 0.0, 0.0),
|
||||||
|
(0.0, 0.0, 0.0),
|
||||||
|
(0.0, -0.2, 0.0),
|
||||||
|
]
|
||||||
solid = create_ifcextrudedareasolid(f, point_list_extrusion_area, extrusion_placement, (0.0, 0.0, 1.0), 4.0)
|
solid = create_ifcextrudedareasolid(f, point_list_extrusion_area, extrusion_placement, (0.0, 0.0, 1.0), 4.0)
|
||||||
body_representation = f.createIfcShapeRepresentation(context, "Body", "SweptSolid", [solid])
|
body_representation = f.createIfcShapeRepresentation(context, "Body", "SweptSolid", [solid])
|
||||||
|
|
||||||
product_shape = f.createIfcProductDefinitionShape(None, None, [body_representation])
|
product_shape = f.createIfcProductDefinitionShape(None, None, [body_representation])
|
||||||
|
|
||||||
wall = f.createIfcWallStandardCase(ifcopenshell.guid.new(), owner_history, "Wall", None, None, wall_placement, product_shape, None)
|
wall = f.createIfcWallStandardCase(
|
||||||
|
ifcopenshell.guid.new(), owner_history, "Wall", None, None, wall_placement, product_shape, None
|
||||||
|
)
|
||||||
|
|
||||||
for opening in openings:
|
for opening in openings:
|
||||||
|
|
||||||
opening_placement = create_ifclocalplacement(f, (opening.x, 0.0, opening.z), (0.0, 1.0, 0.0), (1.0, 0.0, 0.0), wall_placement)
|
opening_placement = create_ifclocalplacement(
|
||||||
opening_solid = f.createIfcExtrudedAreaSolid(opening.shape.build(f), None, f.createIfcDirection(opening.direc), opening.depth)
|
f, (opening.x, 0.0, opening.z), (0.0, 1.0, 0.0), (1.0, 0.0, 0.0), wall_placement
|
||||||
|
)
|
||||||
|
opening_solid = f.createIfcExtrudedAreaSolid(
|
||||||
|
opening.shape.build(f), None, f.createIfcDirection(opening.direc), opening.depth
|
||||||
|
)
|
||||||
opening_representation = f.createIfcShapeRepresentation(context, "Body", "SweptSolid", [opening_solid])
|
opening_representation = f.createIfcShapeRepresentation(context, "Body", "SweptSolid", [opening_solid])
|
||||||
opening_shape = f.createIfcProductDefinitionShape(None, None, [opening_representation])
|
opening_shape = f.createIfcProductDefinitionShape(None, None, [opening_representation])
|
||||||
opening_element = f.createIfcOpeningElement(ifcopenshell.guid.new(), owner_history, "Opening", None, None, opening_placement, opening_shape, None)
|
opening_element = f.createIfcOpeningElement(
|
||||||
|
ifcopenshell.guid.new(), owner_history, "Opening", None, None, opening_placement, opening_shape, None
|
||||||
|
)
|
||||||
f.createIfcRelVoidsElement(ifcopenshell.guid.new(), owner_history, None, None, wall, opening_element)
|
f.createIfcRelVoidsElement(ifcopenshell.guid.new(), owner_history, None, None, wall, opening_element)
|
||||||
|
|
||||||
f.write(fn)
|
f.write(fn)
|
||||||
|
|
||||||
|
|
||||||
class TestWallOpenings:
|
class TestWallOpenings:
|
||||||
def test_all(self):
|
def test_all(self):
|
||||||
|
|
||||||
cases = [
|
cases = [
|
||||||
("wall-openings-non-intersecting-rect-circle.ifc", [opening(i * 4.0 + 2.0,2.0,rect(1.0,1.0),0.2) for i in range(3)] + [opening(i * 4.0 + 4.0,2.0,circle(0.5),0.2) for i in range(3)]),
|
(
|
||||||
("wall-openings-intersecting-inner-bounds.ifc", [opening(i * 0.8 + 2.0, i * 0.1 + 1.0,rect(1.0,1.0),0.2) for i in range(15)]),
|
"wall-openings-non-intersecting-rect-circle.ifc",
|
||||||
("wall-openings-intersecting-with-outer.ifc", [opening(i * 2.0, 4.0,rect(1.0,1.0),0.2) for i in range(15)]),
|
[opening(i * 4.0 + 2.0, 2.0, rect(1.0, 1.0), 0.2) for i in range(3)]
|
||||||
("wall-openings-recesses.ifc", [opening(i * 4.0 + 2.0,2.0,rect(1.0,1.0),0.1) for i in range(3)] + [opening(i * 4.0 + 4.0,2.0,circle(0.5),0.1) for i in range(3)]),
|
+ [opening(i * 4.0 + 4.0, 2.0, circle(0.5), 0.2) for i in range(3)],
|
||||||
("wall-openings-non-orthogonal.ifc", [opening(i * 4.0 + 2.0,2.0,rect(1.0,1.0),0.3,direc=(1.0, 0.0, -1.0)) for i in range(6)]),
|
),
|
||||||
("wall-openings-contained-in-other.ifc", [opening(2.0,2.0,rect(1.0,1.0),0.2), opening(2.0,2.0,rect(0.5, 0.5),0.2)]),
|
(
|
||||||
("wall-openings-outside-of-outer.ifc", [opening(2.0,2.0,rect(1.0,1.0),0.2), opening(2.0,6.0,rect(1.0,1.0),0.2)]),
|
"wall-openings-intersecting-inner-bounds.ifc",
|
||||||
("wall-openings-touching-outer.ifc", [opening(2.0,3.0,rect(2.0,2.0),0.2)])
|
[opening(i * 0.8 + 2.0, i * 0.1 + 1.0, rect(1.0, 1.0), 0.2) for i in range(15)],
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"wall-openings-intersecting-with-outer.ifc",
|
||||||
|
[opening(i * 2.0, 4.0, rect(1.0, 1.0), 0.2) for i in range(15)],
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"wall-openings-recesses.ifc",
|
||||||
|
[opening(i * 4.0 + 2.0, 2.0, rect(1.0, 1.0), 0.1) for i in range(3)]
|
||||||
|
+ [opening(i * 4.0 + 4.0, 2.0, circle(0.5), 0.1) for i in range(3)],
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"wall-openings-non-orthogonal.ifc",
|
||||||
|
[opening(i * 4.0 + 2.0, 2.0, rect(1.0, 1.0), 0.3, direc=(1.0, 0.0, -1.0)) for i in range(6)],
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"wall-openings-contained-in-other.ifc",
|
||||||
|
[opening(2.0, 2.0, rect(1.0, 1.0), 0.2), opening(2.0, 2.0, rect(0.5, 0.5), 0.2)],
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"wall-openings-outside-of-outer.ifc",
|
||||||
|
[opening(2.0, 2.0, rect(1.0, 1.0), 0.2), opening(2.0, 6.0, rect(1.0, 1.0), 0.2)],
|
||||||
|
),
|
||||||
|
("wall-openings-touching-outer.ifc", [opening(2.0, 3.0, rect(2.0, 2.0), 0.2)]),
|
||||||
]
|
]
|
||||||
|
|
||||||
checks = [
|
checks = [
|
||||||
[(1, "Processed fully in 2D")],
|
[(1, "Processed fully in 2D")],
|
||||||
[(1, "Intersecting boundaries")],
|
[(1, "Intersecting boundaries")],
|
||||||
[(1, "Intersecting boundaries")],
|
[(1, "Intersecting boundaries")],
|
||||||
[(1, "No second operands can be processed as 2D inner bounds"),(0, "Operand B creates a through hole")],
|
[(1, "No second operands can be processed as 2D inner bounds"), (0, "Operand B creates a through hole")],
|
||||||
[(0, "Operand B 1/6 is an extrusion")],
|
[(0, "Operand B 1/6 is an extrusion")],
|
||||||
[(1, "Subtraction operand contained in other"), (0, "Subtraction operand outside of outer bound")],
|
[(1, "Subtraction operand contained in other"), (0, "Subtraction operand outside of outer bound")],
|
||||||
[], #[(1, "Subtraction operand outside of outer bound")],
|
[], # [(1, "Subtraction operand outside of outer bound")],
|
||||||
[(1, "Intersecting boundaries")]
|
[(1, "Intersecting boundaries")],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
for fn in glob.glob("*.log.json"):
|
for fn in glob.glob("*.log.json"):
|
||||||
os.unlink(fn)
|
os.unlink(fn)
|
||||||
|
|
||||||
pat = re.compile(r'^([\w :]+?)\s*: (\d+\.\d+)')
|
pat = re.compile(r"^([\w :]+?)\s*: (\d+\.\d+)")
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
@@ -142,7 +187,16 @@ class TestWallOpenings:
|
|||||||
result.append([fn])
|
result.append([fn])
|
||||||
for i in range(2 if PERF else 1):
|
for i in range(2 if PERF else 1):
|
||||||
|
|
||||||
args = [shutil.which("IfcConvert") or "IfcConvert", "-qyvvv", fn, fn+".obj", "--log-format", "json", "--log-file", fn+".log.json"]
|
args = [
|
||||||
|
shutil.which("IfcConvert") or "IfcConvert",
|
||||||
|
"-qyvvv",
|
||||||
|
fn,
|
||||||
|
fn + ".obj",
|
||||||
|
"--log-format",
|
||||||
|
"json",
|
||||||
|
"--log-file",
|
||||||
|
fn + ".log.json",
|
||||||
|
]
|
||||||
if i:
|
if i:
|
||||||
args.append("--no-2d-boolean")
|
args.append("--no-2d-boolean")
|
||||||
|
|
||||||
@@ -150,7 +204,7 @@ class TestWallOpenings:
|
|||||||
for j in range(10 if PERF else 1):
|
for j in range(10 if PERF else 1):
|
||||||
subprocess.call(args, stdout=subprocess.PIPE)
|
subprocess.call(args, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
log = [json.loads(ln)['message'] for ln in open(fn+".log.json") if ln]
|
log = [json.loads(ln)["message"] for ln in open(fn + ".log.json") if ln]
|
||||||
perf = dict(x.groups() for x in [re.match(pat, l) for l in log] if x)
|
perf = dict(x.groups() for x in [re.match(pat, l) for l in log] if x)
|
||||||
|
|
||||||
ts.append(float(perf["file geometry conversion"]))
|
ts.append(float(perf["file geometry conversion"]))
|
||||||
@@ -170,5 +224,6 @@ class TestWallOpenings:
|
|||||||
|
|
||||||
print(tabulate.tabulate(result, headers=["file", "", "--no-2d-boolean"], tablefmt="github"))
|
print(tabulate.tabulate(result, headers=["file", "", "--no-2d-boolean"], tablefmt="github"))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
TestWallOpenings().test_all()
|
TestWallOpenings().test_all()
|
||||||
|
|||||||
Reference in New Issue
Block a user