review: Take into account remarks

This commit is contained in:
Esteban DUGUEPEROUX
2026-01-23 20:41:40 +01:00
parent a86c333a99
commit 8f3715c0f1
10 changed files with 59 additions and 164 deletions
+22 -14
View File
@@ -209,28 +209,36 @@ jobs:
- name: Build standalone examples to test cmake package
run: |
set -x
cd src/examples
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build .
# To display executed command
set -x
./arbitrary_open_profile_def
./composite_profile_def
./csg_primitive
./ellipse_pies
./faces
./ifc_curve_rebar
./arbitrary_open_profile_def && test -f arbitrary_open_profile_def.ifc
./composite_profile_def && test -f composite_profile_def.ifc
./csg_primitive && test -f csg_primitive.ifc
./ellipse_pies && test -f ellipse_pies.ifc
./faces && test -f faces.ifc
./ifc_curve_rebar && test -f ifc_curve_rebar.ifc
./profiles
test -f IfcUShapeProfileDef.ifc
test -f IfcTShapeProfileDef.ifc
test -f IfcZShapeProfileDef.ifc
test -f IfcEllipseProfileDef.ifc
test -f IfcIShapeProfileDef.ifc
test -f IfcLShapeProfileDef.ifc
test -f IfcCShapeProfileDef.ifc
test -f IfcCircleProfileDef.ifc
test -f IfcRectangleProfileDef.ifc
test -f IfcTrapeziumProfileDef.ifc
./IfcParseExamples "../IfcParseExamples_test.ifc"
./IfcOpenHouse
./IfcAdvancedHouse
./IfcAlignment
./IfcSimplifiedAlignment
./triangulated_faceset
set +x
./IfcOpenHouse && test -f IfcOpenHouse.ifc
./IfcAdvancedHouse && test -f IfcAdvancedHouse.ifc
./IfcAlignment && test -f IfcAlignment.ifc
./IfcSimplifiedAlignment && test -f IfcSimplifiedAlignment.ifc
./triangulated_faceset && test -f triangulated_faceset.ifc
- name: Test ifcopenshell-python
run: |
-1
View File
@@ -218,7 +218,6 @@ if(BUILD_IFCGEOM AND WITH_OPENCASCADE)
find_package(OpenCASCADE REQUIRED)
add_definitions(-DIFOPSH_WITH_OPENCASCADE)
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_OPENCASCADE)
# set(OPENCASCADE_LIBRARIES ${OpenCASCADE_LIBRARIES})
list(APPEND GEOMETRY_KERNELS opencascade)
endif()
+25 -137
View File
@@ -35,153 +35,41 @@ else()
include_directories("${CMAKE_SOURCE_DIR}/../src")
endif()
if(SCHEMA_VERSIONS MATCHES "4")
# arbitrary_open_profile_def
add_executable(arbitrary_open_profile_def arbitrary_open_profile_def.cpp)
macro(build_example exe_name)
set (additional_targets ${ARGN})
add_executable(${exe_name} ${exe_name}.cpp)
if(STANDALONE_PROJECT)
target_link_libraries(arbitrary_open_profile_def IfcOpenShell::IfcParse)
target_link_libraries(${exe_name} IfcOpenShell::IfcParse $<$<BOOL:${additional_targets}>:IfcOpenShell::${additional_targets}>)
else()
target_include_directories(arbitrary_open_profile_def PRIVATE "${CMAKE_SOURCE_DIR}/../src")
target_link_libraries(arbitrary_open_profile_def IfcParse)
set_target_properties(arbitrary_open_profile_def PROPERTIES FOLDER Examples)
target_include_directories(${exe_name} PRIVATE "${CMAKE_SOURCE_DIR}/../src")
target_link_libraries(${exe_name} IfcParse ${additional_targets})
set_target_properties(${exe_name} PROPERTIES FOLDER Examples)
endif()
install(TARGETS arbitrary_open_profile_def)
# triangulated_faceset
add_executable(triangulated_faceset triangulated_faceset.cpp)
if(STANDALONE_PROJECT)
target_link_libraries(triangulated_faceset IfcOpenShell::IfcParse)
else()
target_include_directories(triangulated_faceset PRIVATE "${CMAKE_SOURCE_DIR}/../src")
target_link_libraries(triangulated_faceset IfcParse)
set_target_properties(triangulated_faceset PROPERTIES FOLDER Examples)
endif()
install(TARGETS triangulated_faceset)
install(TARGETS ${exe_name})
endmacro()
if("4" IN_LIST SCHEMA_VERSIONS)
build_example(arbitrary_open_profile_def)
build_example(triangulated_faceset)
endif()
if(SCHEMA_VERSIONS MATCHES "2x3")
# composite_profile_def.cpp
add_executable(composite_profile_def composite_profile_def.cpp)
if(STANDALONE_PROJECT)
target_link_libraries(composite_profile_def IfcOpenShell::IfcParse)
else()
target_include_directories(composite_profile_def PRIVATE "${CMAKE_SOURCE_DIR}/../src")
target_link_libraries(composite_profile_def IfcParse)
set_target_properties(composite_profile_def PROPERTIES FOLDER Examples)
endif()
install(TARGETS composite_profile_def)
# csg_primitive
add_executable(csg_primitive csg_primitive.cpp)
if(STANDALONE_PROJECT)
target_link_libraries(csg_primitive IfcOpenShell::IfcParse)
else()
target_include_directories(csg_primitive PRIVATE "${CMAKE_SOURCE_DIR}/../src")
target_link_libraries(csg_primitive IfcParse)
set_target_properties(csg_primitive PROPERTIES FOLDER Examples)
endif()
install(TARGETS csg_primitive)
# ellipse_pies
add_executable(ellipse_pies ellipse_pies.cpp)
if(STANDALONE_PROJECT)
target_link_libraries(ellipse_pies IfcOpenShell::IfcParse)
else()
target_include_directories(ellipse_pies PRIVATE "${CMAKE_SOURCE_DIR}/../src")
target_link_libraries(ellipse_pies IfcParse)
set_target_properties(ellipse_pies PROPERTIES FOLDER Examples)
endif()
install(TARGETS ellipse_pies)
# faces
add_executable(faces faces.cpp)
if(STANDALONE_PROJECT)
target_link_libraries(faces IfcOpenShell::IfcParse)
else()
target_include_directories(faces PRIVATE "${CMAKE_SOURCE_DIR}/../src")
target_link_libraries(faces IfcParse)
set_target_properties(faces PROPERTIES FOLDER Examples)
endif()
install(TARGETS faces)
# ifc_curve_rebar
add_executable(ifc_curve_rebar ifc_curve_rebar.cpp)
if(STANDALONE_PROJECT)
target_link_libraries(ifc_curve_rebar IfcOpenShell::IfcParse)
else()
target_include_directories(ifc_curve_rebar PRIVATE "${CMAKE_SOURCE_DIR}/../src")
target_link_libraries(ifc_curve_rebar IfcParse)
set_target_properties(ifc_curve_rebar PROPERTIES FOLDER Examples)
endif()
install(TARGETS ifc_curve_rebar)
# profiles
add_executable(profiles profiles.cpp)
if(STANDALONE_PROJECT)
target_link_libraries(profiles IfcOpenShell::IfcParse)
else()
target_include_directories(profiles PRIVATE "${CMAKE_SOURCE_DIR}/../src")
target_link_libraries(profiles IfcParse)
set_target_properties(profiles PROPERTIES FOLDER Examples)
endif()
install(TARGETS profiles)
# IfcParseExamples
add_executable(IfcParseExamples IfcParseExamples.cpp)
if(STANDALONE_PROJECT)
target_link_libraries(IfcParseExamples IfcOpenShell::IfcParse)
else()
target_include_directories(IfcParseExamples PRIVATE "${CMAKE_SOURCE_DIR}/../src")
target_link_libraries(IfcParseExamples IfcParse)
set_target_properties(IfcParseExamples PROPERTIES FOLDER Examples)
endif()
install(TARGETS IfcParseExamples)
if("2x3" IN_LIST SCHEMA_VERSIONS)
build_example(composite_profile_def)
build_example(csg_primitive)
build_example(ellipse_pies)
build_example(faces)
build_example(ifc_curve_rebar)
build_example(profiles)
build_example(IfcParseExamples)
if(WITH_OPENCASCADE)
# IfcOpenHouse and IfcAdvancedHouse
add_executable(IfcOpenHouse IfcOpenHouse.cpp)
add_executable(IfcAdvancedHouse IfcAdvancedHouse.cpp)
add_library(IfcHouseInterface INTERFACE)
if(STANDALONE_PROJECT)
target_link_libraries(IfcHouseInterface INTERFACE IfcOpenShell::IfcParse IfcOpenShell::geometry_serializer)
else()
target_link_libraries(IfcHouseInterface INTERFACE IfcParse geometry_serializer)
set_target_properties(IfcOpenHouse PROPERTIES FOLDER Examples)
set_target_properties(IfcAdvancedHouse PROPERTIES FOLDER Examples)
endif()
target_link_libraries(IfcOpenHouse PRIVATE IfcHouseInterface)
target_link_libraries(IfcAdvancedHouse PRIVATE IfcHouseInterface)
install(TARGETS IfcOpenHouse IfcAdvancedHouse)
build_example(IfcOpenHouse geometry_serializer)
build_example(IfcAdvancedHouse geometry_serializer)
endif()
endif()
if(SCHEMA_VERSIONS MATCHES "4x3_add2")
# IfcAlignment and IfcSimplifiedAlignment
add_executable(IfcAlignment IfcAlignment.cpp)
add_executable(IfcSimplifiedAlignment IfcSimplifiedAlignment.cpp)
add_library(IfcAlignmentInterface INTERFACE)
if(STANDALONE_PROJECT)
target_link_libraries(IfcAlignmentInterface INTERFACE IfcOpenShell::IfcParse)
else()
target_link_libraries(IfcAlignmentInterface INTERFACE IfcParse)
set_target_properties(IfcAlignment PROPERTIES FOLDER Examples)
set_target_properties(IfcSimplifiedAlignment PROPERTIES FOLDER Examples)
endif()
target_link_libraries(IfcAlignment PRIVATE IfcAlignmentInterface)
target_link_libraries(IfcSimplifiedAlignment PRIVATE IfcAlignmentInterface)
install(TARGETS IfcAlignment IfcSimplifiedAlignment)
if("4x3_add2" IN_LIST SCHEMA_VERSIONS)
build_example(IfcAlignment)
build_example(IfcSimplifiedAlignment)
endif()
+1 -1
View File
@@ -489,6 +489,6 @@ int main() {
}
// That's it - save the model to a file
std::ofstream ofs("FHWA_Bridge_Geometry_Alignment_Example.ifc");
std::ofstream ofs("IfcAlignment.ifc");
ofs << file;
}
+1 -1
View File
@@ -159,6 +159,6 @@ int main() {
}
// That's it - save the model to a file
std::ofstream ofs("FHWA_Bridge_Geometry_Alignment_Example_Simplified.ifc");
std::ofstream ofs("IfcSimplifiedAlignment.ifc");
ofs << file;
}
+2 -2
View File
@@ -107,7 +107,7 @@ void create_products_from_curve(IfcHierarchyHelper<IfcSchema>& file, IfcSchema::
}
int main(int argc, char** argv) {
const char filename[] = "IfcArbitraryOpenProfileDef.ifc";
const char filename[] = "arbitrary_open_profile_def.ifc";
IfcHierarchyHelper<IfcSchema> file;
file.header().file_name()->setname(filename);
@@ -134,7 +134,7 @@ int main(int argc, char** argv) {
create_products_from_curve(file, trim);
using namespace std::string_literals;
file.getSingle<IfcSchema::IfcProject>()->setName("IfcArbitraryOpenProfileDef"s);
file.getSingle<IfcSchema::IfcProject>()->setName("arbitrary_open_profile_def"s);
std::ofstream f(filename);
f << file;
+2 -2
View File
@@ -36,7 +36,7 @@ typedef IfcParse::IfcGlobalId guid;
boost::none_t const null = boost::none;
int main(int argc, char** argv) {
const char filename[] = "IfcCompositeProfileDef.ifc";
const char filename[] = "composite_profile_def.ifc";
IfcHierarchyHelper<IfcSchema> file;
file.header().file_name()->setname(filename);
@@ -113,7 +113,7 @@ int main(int argc, char** argv) {
product->setRepresentation(shape);
using namespace std::string_literals;
file.getSingle<IfcSchema::IfcProject>()->setName("IfcCompositeProfileDef"s);
file.getSingle<IfcSchema::IfcProject>()->setName("composite_profile_def"s);
std::ofstream f(filename);
f << file;
+2 -2
View File
@@ -133,7 +133,7 @@ public:
};
int main(int argc, char** argv) {
const char filename[] = "IfcCsgPrimitive.ifc";
const char filename[] = "csg_primitive.ifc";
IfcHierarchyHelper<IfcSchema> file;
file.header().file_name()->setname(filename);
@@ -187,7 +187,7 @@ int main(int argc, char** argv) {
product->setRepresentation(shape);
using namespace std::string_literals;
file.getSingle<IfcSchema::IfcProject>()->setName("IfcCompositeProfileDef"s);
file.getSingle<IfcSchema::IfcProject>()->setName("csg_primitive"s);
std::ofstream f(filename);
f << file;
+3 -3
View File
@@ -82,8 +82,8 @@ void create_curve_rebar(IfcHierarchyHelper<IfcSchema>& file)
IfcSchema::IfcCircle* circle = new IfcSchema::IfcCircle(axis1, R);
file.addEntity(circle);
aggregate_of_instance::ptr trim1(new aggregate_of_instance);
aggregate_of_instance::ptr trim2(new aggregate_of_instance);
IfcSchema::IfcTrimmingSelect::list::ptr trim1(new IfcSchema::IfcTrimmingSelect::list);
IfcSchema::IfcTrimmingSelect::list::ptr trim2(new IfcSchema::IfcTrimmingSelect::list);
trim1->push(new IfcSchema::IfcParameterValue(180));
trim1->push(p2);
@@ -91,7 +91,7 @@ void create_curve_rebar(IfcHierarchyHelper<IfcSchema>& file)
trim2->push(new IfcSchema::IfcParameterValue(270));
trim2->push(p4);
IfcSchema::IfcTrimmedCurve* trimmed_curve = new IfcSchema::IfcTrimmedCurve(circle, trim1->as<IfcSchema::IfcTrimmingSelect>(), trim2->as<IfcSchema::IfcTrimmingSelect>(), false, IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
IfcSchema::IfcTrimmedCurve* trimmed_curve = new IfcSchema::IfcTrimmedCurve(circle, trim1, trim2, false, IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
file.addEntity(trimmed_curve);
IfcSchema::IfcCompositeCurveSegment* segment2 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTSAMEGRADIENT, false, trimmed_curve);
+1 -1
View File
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
product->setRepresentation(shape);
const std::string filename = "tesselated_faceset.ifc";
const std::string filename = "triangulated_faceset.ifc";
file.header().file_name()->setname(filename);
std::ofstream f(filename);
f << file;