Merge pull request #7058 from Krande/feat/IfcFixedReferenceSweptAreaSolid

feat: improved support for IfcFixedReferenceSweptAreaSolid
This commit is contained in:
Thomas Krijnen
2025-08-31 10:57:49 +02:00
committed by GitHub
12 changed files with 9299 additions and 86 deletions
+2
View File
@@ -107,4 +107,6 @@ src/ifcopenshell-python/ifcopenshell/ifcopenshell_wrapper.py
src/bonsai/bonsai/bim/schema/Brick.ttl
bonsaiDecoratorForLoads.code-workspace
dev_environment.bat
.pixi/
+114
View File
@@ -0,0 +1,114 @@
{
"version": 6,
"configurePresets": [
{
"name": "shared",
"generator": "Ninja",
"hidden": true,
"cacheVariables": {
"BUILD_IFCPYTHON": "ON",
"BUILD_IFCGEOM": "ON",
"COLLADA_SUPPORT": "OFF",
"BUILD_EXAMPLES": "OFF",
"BUILD_GEOMSERVER": "OFF",
"GLTF_SUPPORT": "ON",
"BUILD_CONVERT": "ON",
"BUILD_IFCMAX": "OFF",
"IFCXML_SUPPORT": "ON",
"HDF5_SUPPORT": "ON",
"SCHEMA_VERSIONS": "4x3_add2",
"CITYJSON_SUPPORT": "OFF",
"CMAKE_GENERATOR_PLATFORM": "",
"CMAKE_GENERATOR_TOOLSET": ""
}
},
{
"name": "win-shared",
"inherits": [
"shared"
],
"hidden": true,
"environment": {
"CONDA_BUILD": "ON",
"CONDA_PY": "312"
},
"cacheVariables": {
"Boost_USE_STATIC_LIBS": "OFF",
"CMAKE_INSTALL_PREFIX": "$env{LIBRARY_PREFIX}",
"PYTHON_EXECUTABLE": "$env{PREFIX}/python.exe",
"PYTHON_INCLUDE_DIR": "$env{PREFIX}/include",
"PYTHON_LIBRARY": "$env{PREFIX}/libs/python$env{CONDA_PY}.lib",
"CMAKE_FIND_ROOT_PATH": "$env{LIBRARY_PREFIX}",
"CMAKE_PREFIX_PATH": "$env{LIBRARY_PREFIX}",
"LIBXML2_LIBRARIES": "$env{LIBRARY_PREFIX}/lib/libxml2.lib",
"OCC_INCLUDE_DIR": "$env{LIBRARY_PREFIX}/include/opencascade",
"OCC_LIBRARY_DIR": "$env{LIBRARY_PREFIX}/lib",
"CGAL_INCLUDE_DIR": "$env{LIBRARY_PREFIX}/include",
"EIGEN_DIR": "$env{LIBRARY_PREFIX}/include/eigen3",
"JSON_INCLUDE_DIR": "$env{LIBRARY_PREFIX}/include",
"GMP_INCLUDE_DIR": "$env{LIBRARY_PREFIX}/include",
"GMP_LIBRARY_DIR": "$env{LIBRARY_PREFIX}/lib",
"MPFR_LIBRARY_DIR": "$env{LIBRARY_PREFIX}/lib",
"Boost_LIBRARY_DIR": "$env{LIBRARY_PREFIX}/lib",
"Boost_INCLUDE_DIR": "$env{LIBRARY_PREFIX}/include",
"HDF5_INCLUDE_DIR": "$env{LIBRARY_PREFIX}/include",
"HDF5_LIBRARY_DIR": "$env{LIBRARY_PREFIX}/lib",
"ZLIB_INCLUDE_DIR": "$env{LIBRARY_PREFIX}/include"
}
},
{
"name": "win-release",
"inherits": [
"win-shared"
],
"hidden": false,
"warnings": {
"dev": false
},
"environment": {
"PREFIX": "${sourceDir}/../.pixi/envs/prod",
"LIBRARY_PREFIX": "${sourceDir}/../.pixi/envs/prod/Library"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "win-debug",
"inherits": [
"win-shared"
],
"hidden": false,
"binaryDir": "${sourceDir}/../build/win-debug",
"warnings": {
"dev": false
},
"environment": {
"PREFIX": "${sourceDir}/../.pixi/envs/dev",
"LIBRARY_PREFIX": "${sourceDir}/../.pixi/envs/dev/Library"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "win-test",
"inherits": [
"win-shared"
],
"hidden": false,
"binaryDir": "${sourceDir}/../build/win-test",
"warnings": {
"dev": false
},
"environment": {
"PREFIX": "${sourceDir}/../.pixi/envs/tests",
"LIBRARY_PREFIX": "${sourceDir}/../.pixi/envs/tests/Library"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"SCHEMA_VERSIONS": "2x3;4;4x3_add2"
}
}
]
}
+8645
View File
File diff suppressed because it is too large Load Diff
+84
View File
@@ -0,0 +1,84 @@
[project]
name = "IfcOpenShell"
version = "0.8.4"
description = "IfcOpenShell is a library to support the IFC file format"
channels = ["conda-forge"]
platforms = ["win-64", "linux-64", "osx-64"]
[environments]
common = { features = ["common"], no-default-feature = true }
prod = { features = ["prod", "common"], no-default-feature = true }
dev = { features = ["dev", "common"], no-default-feature = true }
lint = { features = ["lint"], no-default-feature = true }
tests = { features = ["tests", "common"], no-default-feature = true }
[feature.lint.dependencies]
ruff = "*"
black = "*"
[feature.common.dependencies]
# Build deps
cmake = "==3.30.5"
ninja = "*"
swig = "*"
c-compiler = "*"
cxx-compiler = "*"
# Runtime deps
python = "3.12.*"
libboost-devel = "*"
occt = { version = "*", build = "*novtk*" }
cgal-cpp = "*"
numpy = "*"
lark = "*"
hdf5 = "*"
eigen = "*"
mpfr = "*"
gmp = "*"
nlohmann_json = "*"
zlib = "*"
# Not strictly necessary
pythonocc-core = "*"
[feature.tests.dependencies]
pytest = "*"
shapely = "*"
tabulate = "*"
isodate = "*"
python-dateutil = "*"
xmlschema = "*"
xsdata = "*"
lxml = "*"
networkx = "*"
[feature.common.target.win-64.dependencies]
vs2022_win-64 = "*"
#vs_win-64 = "*" # Visual Studio
#vswhere = "*" # Visual Studio
[feature.common.tasks]
init-submodules = { cmd = "git submodule update --init --recursive", outputs =["$PIXI_PROJECT_ROOT/src/svgfill/3rdparty/svgpp/*"]}
[feature.prod.target.win-64.tasks]
configure-release = { cmd = ["cmake", "--preset", "win-release", "-B", "build/win-release", "cmake"], description = "Configure the project", depends-on=[{ task="init-submodules", environment = "common" }] }
build-release = { cmd = ["cmake", "--build", "build/win-release", "--config", "Release"], description = "Build the project" }
[feature.dev.target.win-64.tasks]
configure-debug = { cmd = ["cmake", "--preset", "win-debug", "-B", "build/win-debug", "cmake"], description = "Configure the project", depends-on=[{ task="init-submodules", environment = "common" }], outputs=["build/win-debug/CMakeCache.txt"] }
build-debug = { cmd = ["cmake", "--build", "build/win-debug", "--config", "Debug"], description = "Build the project", depends-on = ["configure-debug"] }
install-debug = { cmd = ["cmake", "--install", "build/win-debug", "--config", "Debug"], description = "Install the project" } # Optionally Install files to your desired env using --prefix
vsdebug = { cmd = ["python"], description = "Run a python script with vs debugger attached" }
[feature.tests.tasks]
configure-test = { cmd = ["cmake", "--preset", "win-test", "-B", "build/win-test", "cmake"], description = "Configure the project", depends-on=[{ task="init-submodules", environment = "common" }], outputs=["build/win-test/CMakeCache.txt"] }
build-test = { cmd = ["cmake", "--build", "build/win-test", "--config", "Release"], description = "Build the project", depends-on = ["configure-test"], outputs=["build/win-test/IfcGeom.lib"] }
install-test = { cmd = ["cmake", "--install", "build/win-test", "--config", "Release"], description = "Install the project", depends-on = ["build-test"] } # Optionally Install files to your desired env using --prefix
test = { cmd = "pytest .", cwd="src/ifcopenshell-python/test", depends-on=["install-test"], env = {PYTHONPATH="$PIXI_PROJECT_ROOT/src/ifcpatch"}}
[feature.lint.tasks]
lint = { cmd = "ruff check && black --diff --check ."}
[feature.common.target.win-64.activation]
#scripts = ["cmake/activate.bat"]
@@ -17,107 +17,119 @@
* *
********************************************************************************/
#include "mapping.h"
#include "../function_item_evaluator.h"
#include "mapping.h"
#define mapping POSTFIX_SCHEMA(mapping)
using namespace ifcopenshell::geometry;
#ifdef SCHEMA_HAS_IfcFixedReferenceSweptAreaSolid
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcFixedReferenceSweptAreaSolid* inst) {
auto dir = map(inst->Directrix());
auto ref = taxonomy::cast<taxonomy::direction3>(map(inst->FixedReference()));
auto profile = taxonomy::cast<taxonomy::face>(map(inst->SweptArea()));
auto dir = map(inst->Directrix());
auto ref = taxonomy::cast<taxonomy::direction3>(map(inst->FixedReference()));
auto profile = taxonomy::cast<taxonomy::face>(map(inst->SweptArea()));
auto loft = taxonomy::make<taxonomy::loft>();
// @todo intialize as default
loft->axis = nullptr;
// @todo currently only the case is handled where directrix returns a piecewise_function
if (auto fn = taxonomy::dcast<taxonomy::function_item>(dir)) {
function_item_evaluator evaluator(settings_,fn);
double start = 0;
double end = fn->length();
// IfcPointByDistanceExpression is introduced in rc2, the code below doesn't work on rc1 because startparam is optional<double>
#if defined(SCHEMA_HAS_IfcDirectrixCurveSweptAreaSolid) && defined(SCHEMA_HAS_IfcPointByDistanceExpression)
// IfcDirectrixCurveSweptAreaSolid introduced in 4.3 changed attribute type
// from optional IfcParamValue to optional IfcCurveMeasureSelect.
// Invocation of mapping on pre-4.3 models can never result in a piecewise_function.
if (inst->StartParam() && inst->StartParam()->as<IfcSchema::IfcLengthMeasure>()) {
double s = *inst->StartParam()->as<IfcSchema::IfcLengthMeasure>();
if (s > start) {
start = s;
}
}
if (inst->EndParam() && inst->EndParam()->as<IfcSchema::IfcLengthMeasure>()) {
double e = *inst->EndParam()->as<IfcSchema::IfcLengthMeasure>();
if (e < end) {
end = e;
}
}
auto loft = taxonomy::make<taxonomy::loft>();
// @todo intialize as default
loft->axis = nullptr;
// Check if this instance has alignment elements
// @todo currently only the case is handled where directrix returns a piecewise_function
if (auto fn = std::dynamic_pointer_cast<taxonomy::function_item>(dir)) {
function_item_evaluator evaluator(settings_, fn);
double start = 0;
double end = fn->length();
#ifdef SCHEMA_HAS_IfcDirectrixCurveSweptAreaSolid
// IfcDirectrixCurveSweptAreaSolid introduced in 4.3 changed attribute type
// from optional IfcParamValue to optional IfcCurveMeasureSelect.
// Invocation of mapping on pre-4.3 models can never result in a piecewise_function.
if (inst->StartParam() && inst->StartParam()->as<IfcSchema::IfcLengthMeasure>()) {
double s = *inst->StartParam()->as<IfcSchema::IfcLengthMeasure>();
if (s > start) {
start = s;
}
}
if (inst->EndParam() && inst->EndParam()->as<IfcSchema::IfcLengthMeasure>()) {
double e = *inst->EndParam()->as<IfcSchema::IfcLengthMeasure>();
if (e < end) {
end = e;
}
}
#endif
auto evaluation_points = evaluator.evaluation_points();
for (const auto& dist_along : evaluation_points) {
auto m4 = evaluator.evaluate(dist_along);
/*
std::stringstream ss;
ss << m4;
auto s = ss.str();
std::wcout << s.c_str() << std::endl;
auto evaluation_points = evaluator.evaluation_points();
for (const auto& dist_along : evaluation_points) {
auto m4 = evaluator.evaluate(dist_along);
/*
std::stringstream ss;
ss << m4;
auto s = ss.str();
std::wcout << s.c_str() << std::endl;
std::wcout << "determinant: " << m4.determinant() << std::endl;
*/
*/
Eigen::Matrix4d m4b = Eigen::Matrix4d::Identity();
bool is_directrix_derived = false;
Eigen::Matrix4d m4b = Eigen::Matrix4d::Identity();
bool is_directrix_derived = false;
#ifdef SCHEMA_HAS_IfcDirectrixDerivedReferenceSweptAreaSolid
if (inst->as<IfcSchema::IfcDirectrixDerivedReferenceSweptAreaSolid>()) {
is_directrix_derived = true;
}
if (inst->as<IfcSchema::IfcDirectrixDerivedReferenceSweptAreaSolid>()) {
is_directrix_derived = true;
}
#endif
auto pos = m4.col(3).head<3>();
auto pos = m4.col(3).head<3>();
if (is_directrix_derived) {
m4b.col(0).head<3>() = m4.col(1).head<3>();
m4b.col(1).head<3>() = m4.col(0).head<3>().cross(m4.col(1).head<3>());
m4b.col(2).head<3>() = m4.col(0).head<3>();
m4b.col(3).head<3>() = pos;
} else {
Eigen::Vector3d tangent = m4.col(0).head<3>().normalized();
Eigen::Vector3d proj = (ref->components() - tangent * tangent.dot(ref->components()));
proj.normalize();
auto ref = proj.cross(tangent);
if (is_directrix_derived) {
m4b.col(0).head<3>() = m4.col(1).head<3>();
m4b.col(1).head<3>() = m4.col(0).head<3>().cross(m4.col(1).head<3>());
m4b.col(2).head<3>() = m4.col(0).head<3>();
m4b.col(3).head<3>() = pos;
} else {
Eigen::Vector3d tangent = m4.col(0).head<3>().normalized();
Eigen::Vector3d proj = (ref->components() - tangent * tangent.dot(ref->components()));
proj.normalize();
auto ref = proj.cross(tangent);
m4b.col(0).head<3>() = proj;
m4b.col(1).head<3>() = ref;
m4b.col(2).head<3>() = tangent;
m4b.col(3).head<3>() = pos;
m4b.col(0).head<3>() = proj;
m4b.col(1).head<3>() = ref;
m4b.col(2).head<3>() = tangent;
m4b.col(3).head<3>() = pos;
/*
Eigen::JacobiSVD<decltype(m4b)> svd(m4b);
auto condition_number = svd.singularValues()(0)
/ svd.singularValues()(svd.singularValues().size() - 1);
if (condition_number > 1.e10) {
Logger::Error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail.");
}
*/
}
/*
Eigen::JacobiSVD<decltype(m4b)> svd(m4b);
auto condition_number = svd.singularValues()(0)
/ svd.singularValues()(svd.singularValues().size() - 1);
if (condition_number > 1.e10) {
Logger::Error("Non-invertible matrix at " + std::to_string(distalong) + " conversion will likely fail.");
}
*/
}
// @todo taxonomy::clone() does not actually clone. That's really confusing.
// loft->children.push_back(taxonomy::clone(profile));
loft->children.push_back(taxonomy::face::ptr(profile->clone_()));
loft->children.back()->matrix = taxonomy::make<taxonomy::matrix4>();
if (profile->matrix) {
loft->children.back()->matrix->components() = (m4b * profile->matrix->ccomponents()).eval();
} else {
loft->children.back()->matrix->components() = m4b;
}
}
}
// @todo taxonomy::clone() does not actually clone. That's really confusing.
// loft->children.push_back(taxonomy::clone(profile));
loft->children.push_back(taxonomy::face::ptr(profile->clone_()));
loft->children.back()->matrix = taxonomy::make<taxonomy::matrix4>();
return loft;
if (profile->matrix) {
loft->children.back()->matrix->components() = (m4b * profile->matrix->ccomponents()).eval();
} else {
loft->children.back()->matrix->components() = m4b;
}
}
} else {
taxonomy::matrix4::ptr matrix;
if (inst->Position() != nullptr) {
matrix = taxonomy::cast<taxonomy::matrix4>(map(inst->Position()));
}
// TODO: Implement handling for non-alignment curves using sweep_along_curve
auto sweep = taxonomy::make<taxonomy::sweep_along_curve>(
matrix, // matrix4::ptr - no transformation needed
profile, // face::ptr - the profile to sweep
dir, // item::ptr curve - the directrix curve
ref);
return sweep;
}
return loft;
}
#endif
+5 -1
View File
@@ -1210,11 +1210,15 @@ typedef item const* ptr;
item::ptr surface;
item::ptr curve;
direction3::ptr direction = nullptr;
virtual sweep_along_curve* clone_() const { return new sweep_along_curve(*this); }
virtual kinds kind() const { return SWEEP_ALONG_CURVE; }
sweep_along_curve(matrix4::ptr m, face::ptr basis, item::ptr surf, item::ptr crv) : sweep(m, basis), surface(surf), curve(crv) {}
sweep_along_curve(matrix4::ptr m, face::ptr basis, item::ptr surf, item::ptr crv) : sweep(m, basis), surface(surf), curve(crv), direction(nullptr) {}
// New constructor for fixed reference swept area solid
sweep_along_curve(matrix4::ptr m, face::ptr profile, item::ptr directrix, direction3::ptr ref) : sweep(m, profile), surface(nullptr), curve(directrix), direction(ref) { }
virtual size_t calc_hash() const {
auto v = std::make_tuple(static_cast<size_t>(SWEEP_ALONG_CURVE), matrix->hash_components(), basis->calc_hash(), surface->calc_hash(), curve->calc_hash());
+119
View File
@@ -0,0 +1,119 @@
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
FILE_NAME('','2025-02-14T16:16:53',(''),(''),'IfcOpenShell 0.8.1-c49ca69','IfcOpenShell 0.8.1-c49ca69','');
FILE_SCHEMA(('IFC4X3_ADD2'));
ENDSEC;
DATA;
#1=IFCPERSON($,$,'Pravin.Muthukrishnan',$,$,$,$,$);
#2=IFCORGANIZATION($,'BG&E Pty Ltd','BG&E Pty Ltd',$,$);
#3=IFCPERSONANDORGANIZATION(#1,#2,$);
#4=IFCAPPLICATION(#2,'15.0C1n','12d Model','12d Model');
#5=IFCOWNERHISTORY(#3,#4,$,.NOCHANGE.,$,$,$,1739508662);
#6=IFCCARTESIANPOINT((0.,0.,0.));
#7=IFCDIRECTION((0.,0.,1.));
#8=IFCDIRECTION((1.,0.,0.));
#9=IFCAXIS2PLACEMENT3D(#6,#7,#8);
#10=IFCDIRECTION((0.,1.,0.));
#11=IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.E-06,#9,#10);
#12=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);
#13=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.);
#14=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.);
#15=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.);
#16=IFCUNITASSIGNMENT((#12,#13,#14,#15));
#17=IFCPROJECT('3f4tUCcZz5OBp_RAlF3Yjd',#5,'DRAINAGE DESIGN','No description set',$,$,$,(#11),#16);
#18=IFCPERSON($,$,'Pravin.Muthukrishnan',$,$,$,$,$);
#19=IFCORGANIZATION($,'BG&E Pty Ltd','BG&E Pty Ltd',$,$);
#20=IFCPERSONANDORGANIZATION(#18,#19,$);
#21=IFCAPPLICATION(#19,'15.0C1n','12d Model','12d Model');
#22=IFCOWNERHISTORY(#20,#21,$,.NOCHANGE.,$,$,$,1739508662);
#30=IFCCARTESIANPOINT((0.,0.));
#31=IFCAXIS2PLACEMENT2D(#30,$);
#32=IFCCIRCLEPROFILEDEF(.AREA.,$,#31,0.179);
#33=IFCCARTESIANPOINT((289.080,582.2,118.886));
#34=IFCCARTESIANPOINT((290.081,582.9,118.886));
#35=IFCPOLYLINE((#33,#34));
#36=IFCDIRECTION((1.,0.,0.));
#37=IFCFIXEDREFERENCESWEPTAREASOLID(#32,$,#35,$,$,#36);
#38=IFCSHAPEREPRESENTATION(#11,'Body','AdvancedSweptSolid',(#37));
#39=IFCPRODUCTDEFINITIONSHAPE($,$,(#38));
#40=IFCFLOWSEGMENT('1iJOpv7cX1SBoQLaHDDolV',#108,'5','5-1 to 1-1','EXISTING (RETAINED)',#103,#39,$);
#41=IFCRELDEFINESBYPROPERTIES('10rIwnj8r8RR3PKc1TXqSB',#22,'12d Model','Attributes',(#40),#94);
#42=IFCPROPERTYSINGLEVALUE('calculated critical cover chainage',$,IFCREAL(2.24873590275508),$);
#43=IFCPROPERTYSINGLEVALUE('nominal diameter',$,IFCREAL(0.3),$);
#44=IFCPROPERTYSINGLEVALUE('pipe id',$,IFCINTEGER(35),$);
#45=IFCPROPERTYSINGLEVALUE('colour',$,IFCLABEL('orange'),$);
#46=IFCPROPERTYSINGLEVALUE('group',$,IFCLABEL('EX'),$);
#47=IFCCOMPLEXPROPERTY('pipe sched','12d_attribute_group',$,(#46));
#48=IFCPROPERTYSINGLEVALUE('name',$,IFCLABEL('EX'),$);
#49=IFCCOMPLEXPROPERTY('lplot','12d_attribute_group',$,(#48));
#50=IFCPROPERTYSINGLEVALUE('pipe name',$,IFCLABEL('5-1 to 1-1'),$);
#51=IFCPROPERTYSINGLEVALUE('calculated direct pipe flow total minor',$,IFCREAL(0.),$);
#52=IFCPROPERTYSINGLEVALUE('calculated direct pipe flow total major',$,IFCREAL(0.),$);
#53=IFCPROPERTYSINGLEVALUE('calculated direct pit and pipe flow total minor',$,IFCREAL(0.),$);
#54=IFCPROPERTYSINGLEVALUE('calculated direct pit and pipe flow total major',$,IFCREAL(0.),$);
#55=IFCPROPERTYSINGLEVALUE('pipe type',$,IFCLABEL('EXISTING (RETAINED)'),$);
#56=IFCPROPERTYSINGLEVALUE('roughness text',$,IFCLABEL('n=0.013'),$);
#57=IFCPROPERTYSINGLEVALUE('calculated design grade minimum',$,IFCREAL(1.),$);
#58=IFCPROPERTYSINGLEVALUE('calculated pipe length',$,IFCREAL(7.19890895752825),$);
#59=IFCPROPERTYSINGLEVALUE('invert us',$,IFCREAL(118.736),$);
#60=IFCPROPERTYSINGLEVALUE('invert ds',$,IFCREAL(118.736),$);
#61=IFCPROPERTYSINGLEVALUE('calculated pipe grade',$,IFCREAL(-0.),$);
#62=IFCPROPERTYSINGLEVALUE('calculated pipe vert angle',$,IFCREAL(0.),$);
#63=IFCPROPERTYSINGLEVALUE('calculated pipe grade 1 in',$,IFCREAL(1000000.),$);
#64=IFCPROPERTYSINGLEVALUE('pipe size',$,IFCLABEL('300'),$);
#65=IFCPROPERTYSINGLEVALUE('diameter',$,IFCREAL(0.3),$);
#66=IFCPROPERTYSINGLEVALUE('nominal pipe size',$,IFCLABEL('300'),$);
#67=IFCPROPERTYSINGLEVALUE('calculated us deflection',$,IFCREAL(0.),$);
#68=IFCPROPERTYSINGLEVALUE('calculated ds deflection',$,IFCREAL(89.4496469263205),$);
#69=IFCPROPERTYSINGLEVALUE('calculated design drop',$,IFCREAL(0.02),$);
#70=IFCPROPERTYSINGLEVALUE('calculated drop',$,IFCREAL(0.),$);
#71=IFCPROPERTYSINGLEVALUE('calculated pipe vert ds deflection angle',$,IFCREAL(-4.09980829540645),$);
#72=IFCPROPERTYSINGLEVALUE('calculated design cover',$,IFCREAL(1.1),$);
#73=IFCPROPERTYSINGLEVALUE('minimum cover',$,IFCREAL(1.67561504823626),$);
#74=IFCPROPERTYSINGLEVALUE('pipe colour',$,IFCINTEGER(8),$);
#75=IFCPROPERTYSINGLEVALUE('conduit shape',$,IFCLABEL('Circular'),$);
#76=IFCPROPERTYSINGLEVALUE('calculated invert us',$,IFCREAL(118.736),$);
#77=IFCPROPERTYSINGLEVALUE('calculated invert ds',$,IFCREAL(118.736),$);
#78=IFCPROPERTYSINGLEVALUE('calculated hgl us',$,IFCREAL(118.736),$);
#79=IFCPROPERTYSINGLEVALUE('calculated hgl ds',$,IFCREAL(118.736),$);
#80=IFCPROPERTYSINGLEVALUE('lock us il',$,IFCINTEGER(1),$);
#81=IFCPROPERTYSINGLEVALUE('lock ds il',$,IFCINTEGER(1),$);
#82=IFCPROPERTYSINGLEVALUE('critical barrel',$,IFCINTEGER(0),$);
#83=IFCPROPERTYSINGLEVALUE('critical side',$,IFCINTEGER(0),$);
#84=IFCPROPERTYSINGLEVALUE('Pipe Name',$,IFCLABEL('5-1 to 1-1'),$);
#85=IFCPROPERTYSINGLEVALUE('Pipe Type',$,IFCLABEL('EXISTING (RETAINED)'),$);
#86=IFCPROPERTYSINGLEVALUE('Justification',$,IFCLABEL('Invert'),$);
#87=IFCPROPERTYSINGLEVALUE('Start x',$,IFCREAL(289080.818499209),$);
#88=IFCPROPERTYSINGLEVALUE('Start y',$,IFCREAL(5822851.36621952),$);
#89=IFCPROPERTYSINGLEVALUE('Start z',$,IFCREAL(118.736),$);
#90=IFCPROPERTYSINGLEVALUE('End x',$,IFCREAL(289081.570466963),$);
#91=IFCPROPERTYSINGLEVALUE('End y',$,IFCREAL(5822857.54453541),$);
#92=IFCPROPERTYSINGLEVALUE('End z',$,IFCREAL(118.736),$);
#93=IFCCOMPLEXPROPERTY('Geometry','12d_attribute_group',$,(#86,#87,#88,#89,#90,#91,#92));
#94=IFCPROPERTYSET('0pqqHlNsb54w9VRYcNog0C',#22,'12d Model',$,(#42,#43,#44,#45,#47,#49,#50,#51,#52,#53,#54,#55,#56,#57,#58,#59,#60,#61,#62,#63,#64,#65,#66,#67,#68,#69,#70,#71,#72,#73,#74,#75,#76,#77,#78,#79,#80,#81,#82,#83,#84,#85,#93));
#95=IFCSTYLEDITEM(#37,(#98),$);
#96=IFCCOLOURRGB('orange',1.,0.647058823529412,0.);
#97=IFCSURFACESTYLERENDERING(#96,$,$,$,$,$,IFCNORMALISEDRATIOMEASURE(0.00390625),IFCSPECULAREXPONENT(10.),.NOTDEFINED.);
#98=IFCSURFACESTYLE($,.POSITIVE.,(#97));
#99=IFCCARTESIANPOINT((0.,0.,0.));
#100=IFCDIRECTION((0.,0.,1.));
#101=IFCDIRECTION((1.,0.,0.));
#102=IFCAXIS2PLACEMENT3D(#99,#100,#101);
#103=IFCLOCALPLACEMENT($,#102);
#104=IFCACTORROLE(.USERDEFINED.,'CONTRIBUTOR',$);
#105=IFCTELECOMADDRESS(.USERDEFINED.,$,'WEBPAGE',$,$,$,$,'https://ifcopenshell.org',$);
#106=IFCORGANIZATION('IfcOpenShell','IfcOpenShell','IfcOpenShell is an open source software library that helps users and software developers to work with IFC data.',(#104),(#105));
#107=IFCAPPLICATION(#106,'0.8.1-alpha250208-3832077','Bonsai','Bonsai');
#108=IFCOWNERHISTORY(#20,#21,$,.MODIFIED.,1739510213,#3,#107,1739508662);
#114=IFCSITE('2CTfxIYCTCsRAvUEqFZoH3',#120,'Default Site','Description of Default Site',$,#119,$,$,.ELEMENT.,$,$,$,$,$);
#115=IFCCARTESIANPOINT((0.,0.,0.));
#116=IFCDIRECTION((0.,0.,1.));
#117=IFCDIRECTION((1.,0.,0.));
#118=IFCAXIS2PLACEMENT3D(#115,#116,#117);
#119=IFCLOCALPLACEMENT($,#118);
#120=IFCOWNERHISTORY(#20,#21,$,.MODIFIED.,1739510213,#3,#107,1739508662);
#121=IFCRELCONTAINEDINSPATIALSTRUCTURE('05AVd4pPf1jeS4OU20v7N9',#5,$,$,(#40),#114);
#122=IFCRELAGGREGATES('3PxVuUIG14dQdQEHf8wUca',#5,$,$,#17,(#114));
ENDSEC;
END-ISO-10303-21;
@@ -0,0 +1,74 @@
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('ViewDefinition[DesignTransferView]'),'2;1');
FILE_NAME('/dev/null','2025-08-27T14:53:55+02:00',('AdaUser'),('AdaOrg'),'IfcOpenShell 0.8.2','IfcOpenShell 0.8.2','Nobody');
FILE_SCHEMA(('IFC4X3_ADD2'));
ENDSEC;
DATA;
#1=IFCPROJECT('2MG118AczBnBRhfOi7rLGC',$,'AdaProject',$,$,$,$,(#11),#6);
#2=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);
#3=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.);
#4=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.);
#5=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.);
#6=IFCUNITASSIGNMENT((#5,#3,#4,#2));
#7=IFCCARTESIANPOINT((0.,0.,0.));
#8=IFCDIRECTION((0.,0.,1.));
#9=IFCDIRECTION((1.,0.,0.));
#10=IFCAXIS2PLACEMENT3D(#7,#8,#9);
#11=IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.E-05,#10,$);
#12=IFCGEOMETRICREPRESENTATIONSUBCONTEXT('Body','Model',*,*,*,*,#11,$,.MODEL_VIEW.,$);
#13=IFCGEOMETRICREPRESENTATIONSUBCONTEXT('Axis','Model',*,*,*,*,#11,$,.GRAPH_VIEW.,$);
#14=IFCGEOMETRICREPRESENTATIONSUBCONTEXT('Box','Model',*,*,*,*,#11,$,.MODEL_VIEW.,$);
#15=IFCACTORROLE(.ENGINEER.,$,$);
#16=IFCPERSON('AdaUser',$,$,$,$,$,(#15),$);
#17=IFCORGANIZATION('ADA','Assembly For Design and Analysis',$,$,$);
#18=IFCPERSONANDORGANIZATION(#16,#17,$);
#19=IFCAPPLICATION(#17,'XXX','ADA','ADA');
#20=IFCOWNERHISTORY(#18,#19,.READWRITE.,$,$,#18,#19,1756299235);
#21=IFCDIRECTION((0.,0.,1.));
#22=IFCDIRECTION((1.,0.,0.));
#23=IFCCARTESIANPOINT((0.,0.,0.));
#24=IFCAXIS2PLACEMENT3D(#23,#21,#22);
#25=IFCLOCALPLACEMENT($,#24);
#26=IFCSITE('2V9fV9zKnAP9J5CfXLkqps',#20,'Ada',$,$,#25,$,$,.ELEMENT.,$,$,$,$,$);
#27=IFCRELAGGREGATES('12FX4aagX3HQdiLOLDvGX_',#20,'Project Container',$,#1,(#26));
#28=IFCPROPERTYSINGLEVALUE('project',$,IFCTEXT('AdaProject'),$);
#29=IFCPROPERTYSINGLEVALUE('schema',$,IFCTEXT('IFC4X3_add2'),$);
#30=IFCPROPERTYSET('2yltt4JCTAOAyhAFFKmDBW',#20,'Properties',$,(#28,#29));
#31=IFCRELDEFINESBYPROPERTIES('3U0CyjG8XALx2oClwZMPg9',#20,'Properties',$,(#26),#30);
#32=IFCMATERIAL('S355',$,'Steel');
#33=IFCPROPERTYSINGLEVALUE('Grade',$,IFCTEXT('S355'),$);
#34=IFCPROPERTYSINGLEVALUE('YieldStress',$,IFCPRESSUREMEASURE(355000000.),$);
#35=IFCPROPERTYSINGLEVALUE('YoungModulus',$,IFCMODULUSOFELASTICITYMEASURE(210000000000.),$);
#36=IFCPROPERTYSINGLEVALUE('PoissonRatio',$,IFCPOSITIVERATIOMEASURE(0.3),$);
#37=IFCPROPERTYSINGLEVALUE('ThermalExpansionCoefficient',$,IFCTHERMALEXPANSIONCOEFFICIENTMEASURE(1.2E-05),$);
#38=IFCPROPERTYSINGLEVALUE('SpecificHeatCapacity',$,IFCSPECIFICHEATCAPACITYMEASURE(0.03),$);
#39=IFCPROPERTYSINGLEVALUE('MassDensity',$,IFCMASSDENSITYMEASURE(7850.),$);
#40=IFCMATERIALPROPERTIES('MaterialMechanical','A Material property description',(#33,#34,#35,#36,#37,#38,#39),#32);
#41=IFCRELASSOCIATESMATERIAL('3__DXGCfr15fk06ugmrrR4',#20,'S355','Objects related to S355',(#64),#32);
#42=IFCDIRECTION((0.,0.,1.));
#43=IFCDIRECTION((1.,0.,0.));
#44=IFCCARTESIANPOINT((0.,0.,0.));
#45=IFCAXIS2PLACEMENT3D(#44,#42,#43);
#46=IFCLOCALPLACEMENT(#25,#45);
#47=IFCCARTESIANPOINTLIST2D(((0.,0.),(0.,0.1),(0.1,0.),(0.1,0.1)),$);
#48=IFCINDEXEDPOLYCURVE(#47,(IFCLINEINDEX((3,1)),IFCLINEINDEX((1,2)),IFCLINEINDEX((2,4)),IFCLINEINDEX((4,3))),$);
#49=IFCARBITRARYCLOSEDPROFILEDEF(.AREA.,$,#48);
#50=IFCCARTESIANPOINTLIST3D(((-1.,0.,0.8),(-0.14253,0.,0.542759),(-0.039541321421393,0.,0.470579850861542),(0.,0.,0.),(0.,0.,0.351194)),$);
#51=IFCINDEXEDPOLYCURVE(#50,(IFCLINEINDEX((4,5)),IFCARCINDEX((5,3,2)),IFCLINEINDEX((2,1))),$);
#52=IFCDIRECTION((-0.,1.,0.));
#53=IFCCARTESIANPOINT((0.,0.,0.));
#54=IFCDIRECTION((1.,0.,0.));
#55=IFCDIRECTION((0.,0.,-1.));
#56=IFCAXIS2PLACEMENT3D(#53,#54,#55);
#57=IFCFIXEDREFERENCESWEPTAREASOLID(#49,#56,#51,$,$,#52);
#58=IFCSHAPEREPRESENTATION(#12,'Body','AdvancedSweptSolid',(#57));
#59=IFCPRODUCTDEFINITIONSHAPE($,$,(#58));
#60=IFCCOLOURRGB('Color1',0.8,0.8,0.8);
#61=IFCSURFACESTYLESHADING(#60,0.);
#62=IFCSURFACESTYLE('Color1',.BOTH.,(#61));
#63=IFCSTYLEDITEM(#57,(#62),'Color1');
#64=IFCBUILDINGELEMENTPROXY('07ngBzsO5BK8C3rDUqQfSD',#20,'sweep1',$,$,#46,#59,$,$);
#65=IFCRELCONTAINEDINSPATIALSTRUCTURE('1_r$SsBj1C3wgAjnhfmkqs',#20,'Physical model',$,(#64),#26);
ENDSEC;
END-ISO-10303-21;
@@ -0,0 +1,74 @@
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('ViewDefinition[DesignTransferView]'),'2;1');
FILE_NAME('/dev/null','2025-08-28T09:45:32+02:00',('AdaUser'),('AdaOrg'),'IfcOpenShell 0.8.2','IfcOpenShell 0.8.2','Nobody');
FILE_SCHEMA(('IFC4X3_ADD2'));
ENDSEC;
DATA;
#1=IFCPROJECT('3kk2KcD29DrxlrjJ23wiG2',$,'AdaProject',$,$,$,$,(#11),#6);
#2=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);
#3=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.);
#4=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.);
#5=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.);
#6=IFCUNITASSIGNMENT((#3,#5,#4,#2));
#7=IFCCARTESIANPOINT((0.,0.,0.));
#8=IFCDIRECTION((0.,0.,1.));
#9=IFCDIRECTION((1.,0.,0.));
#10=IFCAXIS2PLACEMENT3D(#7,#8,#9);
#11=IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.E-05,#10,$);
#12=IFCGEOMETRICREPRESENTATIONSUBCONTEXT('Body','Model',*,*,*,*,#11,$,.MODEL_VIEW.,$);
#13=IFCGEOMETRICREPRESENTATIONSUBCONTEXT('Axis','Model',*,*,*,*,#11,$,.GRAPH_VIEW.,$);
#14=IFCGEOMETRICREPRESENTATIONSUBCONTEXT('Box','Model',*,*,*,*,#11,$,.MODEL_VIEW.,$);
#15=IFCACTORROLE(.ENGINEER.,$,$);
#16=IFCPERSON('AdaUser',$,$,$,$,$,(#15),$);
#17=IFCORGANIZATION('ADA','Assembly For Design and Analysis',$,$,$);
#18=IFCPERSONANDORGANIZATION(#16,#17,$);
#19=IFCAPPLICATION(#17,'XXX','ADA','ADA');
#20=IFCOWNERHISTORY(#18,#19,.READWRITE.,$,$,#18,#19,1756367132);
#21=IFCDIRECTION((0.,0.,1.));
#22=IFCDIRECTION((1.,0.,0.));
#23=IFCCARTESIANPOINT((0.,0.,0.));
#24=IFCAXIS2PLACEMENT3D(#23,#21,#22);
#25=IFCLOCALPLACEMENT($,#24);
#26=IFCSITE('3192LLwf9Et9NYY6Dp1HMI',#20,'Ada',$,$,#25,$,$,.ELEMENT.,$,$,$,$,$);
#27=IFCRELAGGREGATES('3sB8i$7If0y9iXdBJx7Et7',#20,'Project Container',$,#1,(#26));
#28=IFCPROPERTYSINGLEVALUE('project',$,IFCTEXT('AdaProject'),$);
#29=IFCPROPERTYSINGLEVALUE('schema',$,IFCTEXT('IFC4X3_add2'),$);
#30=IFCPROPERTYSET('16zSs_zL5FTQaH0f6iQohK',#20,'Properties',$,(#28,#29));
#31=IFCRELDEFINESBYPROPERTIES('2hQUoEcor7uf16HkCAa06h',#20,'Properties',$,(#26),#30);
#32=IFCMATERIAL('S355',$,'Steel');
#33=IFCPROPERTYSINGLEVALUE('Grade',$,IFCTEXT('S355'),$);
#34=IFCPROPERTYSINGLEVALUE('YieldStress',$,IFCPRESSUREMEASURE(355000000.),$);
#35=IFCPROPERTYSINGLEVALUE('YoungModulus',$,IFCMODULUSOFELASTICITYMEASURE(210000000000.),$);
#36=IFCPROPERTYSINGLEVALUE('PoissonRatio',$,IFCPOSITIVERATIOMEASURE(0.3),$);
#37=IFCPROPERTYSINGLEVALUE('ThermalExpansionCoefficient',$,IFCTHERMALEXPANSIONCOEFFICIENTMEASURE(1.2E-05),$);
#38=IFCPROPERTYSINGLEVALUE('SpecificHeatCapacity',$,IFCSPECIFICHEATCAPACITYMEASURE(0.03),$);
#39=IFCPROPERTYSINGLEVALUE('MassDensity',$,IFCMASSDENSITYMEASURE(7850.),$);
#40=IFCMATERIALPROPERTIES('MaterialMechanical','A Material property description',(#33,#34,#35,#36,#37,#38,#39),#32);
#41=IFCRELASSOCIATESMATERIAL('3GCQxFEKjCmPtz21j5vEC_',#20,'S355','Objects related to S355',(#64),#32);
#42=IFCDIRECTION((0.,0.,1.));
#43=IFCDIRECTION((1.,0.,0.));
#44=IFCCARTESIANPOINT((0.,0.,0.));
#45=IFCAXIS2PLACEMENT3D(#44,#42,#43);
#46=IFCLOCALPLACEMENT(#25,#45);
#47=IFCCARTESIANPOINTLIST2D(((0.1,0.05),(0.,0.),(0.1,0.),(0.1,0.05)),$);
#48=IFCINDEXEDPOLYCURVE(#47,$,$);
#49=IFCARBITRARYCLOSEDPROFILEDEF(.AREA.,$,#48);
#50=IFCCARTESIANPOINTLIST3D(((50.,100.,200.),(50.,100.,200.389146),(50.0003133895072,100.025071208213,200.486102587622),(50.001174980994,100.093998658131,200.558749),(50.0086491903016,100.691934415524,200.932458971772),(50.0310627108963,100.770687414196,201.008805063266),(50.089001837944,100.800000190195,201.100002410475),(50.6760204909973,100.800000000803,201.843063903121),(50.7636872882004,100.858578730855,201.954034522829),(50.7999999397009,101.700000021708,201.999999960467),(50.8000002509973,100.999999960803,202.000000303121)),$);
#51=IFCINDEXEDPOLYCURVE(#50,(IFCLINEINDEX((1,2)),IFCARCINDEX((2,3,4)),IFCLINEINDEX((4,5)),IFCARCINDEX((5,6,7)),IFCLINEINDEX((7,8)),IFCARCINDEX((8,9,11)),IFCLINEINDEX((11,10))),$);
#52=IFCDIRECTION((1.,0.,0.));
#53=IFCCARTESIANPOINT((0.,0.,0.));
#54=IFCDIRECTION((0.,0.,1.));
#55=IFCDIRECTION((1.,0.,0.));
#56=IFCAXIS2PLACEMENT3D(#53,#54,#55);
#57=IFCFIXEDREFERENCESWEPTAREASOLID(#49,#56,#51,$,$,#52);
#58=IFCSHAPEREPRESENTATION(#12,'Body','AdvancedSweptSolid',(#57));
#59=IFCPRODUCTDEFINITIONSHAPE($,$,(#58));
#60=IFCCOLOURRGB('Color1',0.8,0.8,0.8);
#61=IFCSURFACESTYLESHADING(#60,0.);
#62=IFCSURFACESTYLE('Color1',.BOTH.,(#61));
#63=IFCSTYLEDITEM(#57,(#62),'Color1');
#64=IFCBUILDINGELEMENTPROXY('0Yr8J8fnj47xCNdvnijjk4',#20,'sweep2',$,$,#46,#59,$,$);
#65=IFCRELCONTAINEDINSPATIALSTRUCTURE('1Bl6up0hb69elL9bAj0Yd6',#20,'Physical model',$,(#64),#26);
ENDSEC;
END-ISO-10303-21;
@@ -0,0 +1,85 @@
import pathlib
from collections.abc import Sequence
import ifcopenshell
import pytest
def _bbox_from_vertices(verts: list[tuple[float, float, float]]):
if not verts:
return (0, 0, 0), (0, 0, 0)
xs = [v[0] for v in verts]
ys = [v[1] for v in verts]
zs = [v[2] for v in verts]
mn = (min(xs), min(ys), min(zs))
mx = (max(xs), max(ys), max(zs))
return mn, mx
def _size_from_bbox(mn, mx):
return (mx[0] - mn[0], mx[1] - mn[1], mx[2] - mn[2])
def _triples(flat: Sequence[float]) -> list[tuple[float, float, float]]:
return [(float(flat[i]), float(flat[i + 1]), float(flat[i + 2])) for i in range(0, len(flat), 3)]
def load_ifc_mesh_bbox(ifc_path: str):
"""Load first product's mesh from IFC using ifcopenshell.geom and return bbox and size."""
try:
import ifcopenshell.geom as geom
except Exception as e:
raise RuntimeError("ifcopenshell.geom not available: cannot validate IFC geometry") from e
settings = geom.settings()
settings.set(settings.USE_WORLD_COORDS, True)
f = ifcopenshell.open(ifc_path)
# Prefer the proxy we created, otherwise take any product with representation
products = f.by_type("IfcProduct")
target = None
for p in products:
if p.is_a("IfcBuildingElementProxy") and getattr(p, "Representation", None):
target = p
break
if target is None:
for p in products:
if getattr(p, "Representation", None):
target = p
break
if target is None:
raise RuntimeError("No representable product found in IFC for validation")
shape = geom.create_shape(settings, target)
verts = _triples(shape.geometry.verts)
mn, mx = _bbox_from_vertices(verts)
return mn, mx, _size_from_bbox(mn, mx)
@pytest.fixture
def geom_dir():
return pathlib.Path(__file__).parent.parent.resolve().absolute() / "fixtures/geom"
def test_simple_sweep_1(geom_dir):
ifc_file_path = geom_dir / "simple_sweep_1.ifc"
ifc_mn, ifc_mx, ifc_sz = load_ifc_mesh_bbox(ifc_file_path)
assert ifc_sz == pytest.approx((0.8957825463853046, 0.1, 1.1))
assert ifc_mn == pytest.approx((0.0, 0, -0.1))
assert ifc_mx == pytest.approx((0.8957825463853046, 0.1, 1.0))
def test_simple_sweep_2(geom_dir):
ifc_file_path = geom_dir / "simple_sweep_2.ifc"
ifc_mn, ifc_mx, ifc_sz = load_ifc_mesh_bbox(ifc_file_path)
assert ifc_mn == pytest.approx((50.0, 100.0, 200.0))
assert ifc_mx == pytest.approx((50.89584911299009, 101.70000025609394, 202.0000003710634))
assert ifc_sz == pytest.approx((0.8958491129900921, 1.7000002560939436, 2.0000003710634076))
def test_pipe_12d(geom_dir):
ifc_file_path = geom_dir / "pipe.ifc"
ifc_mn, ifc_mx, ifc_sz = load_ifc_mesh_bbox(ifc_file_path)
assert ifc_sz == pytest.approx((1.205888147422229, 0.9929900508137735, 0.35776115971654576))
assert ifc_mn == pytest.approx((288.9774190979147, 582.0537006391681, 118.70711942014172))
assert ifc_mx == pytest.approx((290.18330724533695, 583.0466906899819, 119.06488057985827))
+1 -1
View File
@@ -21,7 +21,7 @@ import pytest
import ifcopenshell
TEST_FILE_DIR = Path("../../test/input/")
TEST_FILE_DIR = Path(__file__).parent / "../../../test/input/"
class TestOpen:
+1 -1
View File
@@ -22,7 +22,7 @@ import pytest
import ifcopenshell
TEST_FILE_DIR = Path("../../test/input/")
TEST_FILE_DIR = Path(__file__).parent / "../../../test/input/"
class TestWrite: