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 - name: Build standalone examples to test cmake package
run: | run: |
set -x
cd src/examples cd src/examples
mkdir build && cd build mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \ cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build . cmake --build .
# To display executed command ./arbitrary_open_profile_def && test -f arbitrary_open_profile_def.ifc
set -x ./composite_profile_def && test -f composite_profile_def.ifc
./arbitrary_open_profile_def ./csg_primitive && test -f csg_primitive.ifc
./composite_profile_def ./ellipse_pies && test -f ellipse_pies.ifc
./csg_primitive ./faces && test -f faces.ifc
./ellipse_pies ./ifc_curve_rebar && test -f ifc_curve_rebar.ifc
./faces
./ifc_curve_rebar
./profiles ./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" ./IfcParseExamples "../IfcParseExamples_test.ifc"
./IfcOpenHouse ./IfcOpenHouse && test -f IfcOpenHouse.ifc
./IfcAdvancedHouse ./IfcAdvancedHouse && test -f IfcAdvancedHouse.ifc
./IfcAlignment ./IfcAlignment && test -f IfcAlignment.ifc
./IfcSimplifiedAlignment ./IfcSimplifiedAlignment && test -f IfcSimplifiedAlignment.ifc
./triangulated_faceset ./triangulated_faceset && test -f triangulated_faceset.ifc
set +x
- name: Test ifcopenshell-python - name: Test ifcopenshell-python
run: | run: |
-1
View File
@@ -218,7 +218,6 @@ if(BUILD_IFCGEOM AND WITH_OPENCASCADE)
find_package(OpenCASCADE REQUIRED) find_package(OpenCASCADE REQUIRED)
add_definitions(-DIFOPSH_WITH_OPENCASCADE) add_definitions(-DIFOPSH_WITH_OPENCASCADE)
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_OPENCASCADE) set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_OPENCASCADE)
# set(OPENCASCADE_LIBRARIES ${OpenCASCADE_LIBRARIES})
list(APPEND GEOMETRY_KERNELS opencascade) list(APPEND GEOMETRY_KERNELS opencascade)
endif() endif()
+25 -137
View File
@@ -35,153 +35,41 @@ else()
include_directories("${CMAKE_SOURCE_DIR}/../src") include_directories("${CMAKE_SOURCE_DIR}/../src")
endif() endif()
if(SCHEMA_VERSIONS MATCHES "4") macro(build_example exe_name)
# arbitrary_open_profile_def set (additional_targets ${ARGN})
add_executable(arbitrary_open_profile_def arbitrary_open_profile_def.cpp) add_executable(${exe_name} ${exe_name}.cpp)
if(STANDALONE_PROJECT) 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() else()
target_include_directories(arbitrary_open_profile_def PRIVATE "${CMAKE_SOURCE_DIR}/../src") target_include_directories(${exe_name} PRIVATE "${CMAKE_SOURCE_DIR}/../src")
target_link_libraries(arbitrary_open_profile_def IfcParse) target_link_libraries(${exe_name} IfcParse ${additional_targets})
set_target_properties(arbitrary_open_profile_def PROPERTIES FOLDER Examples) set_target_properties(${exe_name} PROPERTIES FOLDER Examples)
endif() endif()
install(TARGETS arbitrary_open_profile_def) install(TARGETS ${exe_name})
endmacro()
# 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)
if("4" IN_LIST SCHEMA_VERSIONS)
build_example(arbitrary_open_profile_def)
build_example(triangulated_faceset)
endif() endif()
if(SCHEMA_VERSIONS MATCHES "2x3") if("2x3" IN_LIST SCHEMA_VERSIONS)
# composite_profile_def.cpp build_example(composite_profile_def)
add_executable(composite_profile_def composite_profile_def.cpp) build_example(csg_primitive)
build_example(ellipse_pies)
if(STANDALONE_PROJECT) build_example(faces)
target_link_libraries(composite_profile_def IfcOpenShell::IfcParse) build_example(ifc_curve_rebar)
else() build_example(profiles)
target_include_directories(composite_profile_def PRIVATE "${CMAKE_SOURCE_DIR}/../src") build_example(IfcParseExamples)
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(WITH_OPENCASCADE) if(WITH_OPENCASCADE)
# IfcOpenHouse and IfcAdvancedHouse build_example(IfcOpenHouse geometry_serializer)
add_executable(IfcOpenHouse IfcOpenHouse.cpp) build_example(IfcAdvancedHouse geometry_serializer)
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)
endif() endif()
endif() endif()
if(SCHEMA_VERSIONS MATCHES "4x3_add2") if("4x3_add2" IN_LIST SCHEMA_VERSIONS)
# IfcAlignment and IfcSimplifiedAlignment build_example(IfcAlignment)
add_executable(IfcAlignment IfcAlignment.cpp) build_example(IfcSimplifiedAlignment)
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)
endif() endif()
+1 -1
View File
@@ -489,6 +489,6 @@ int main() {
} }
// That's it - save the model to a file // 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; ofs << file;
} }
+1 -1
View File
@@ -159,6 +159,6 @@ int main() {
} }
// That's it - save the model to a file // 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; 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) { int main(int argc, char** argv) {
const char filename[] = "IfcArbitraryOpenProfileDef.ifc"; const char filename[] = "arbitrary_open_profile_def.ifc";
IfcHierarchyHelper<IfcSchema> file; IfcHierarchyHelper<IfcSchema> file;
file.header().file_name()->setname(filename); file.header().file_name()->setname(filename);
@@ -134,7 +134,7 @@ int main(int argc, char** argv) {
create_products_from_curve(file, trim); create_products_from_curve(file, trim);
using namespace std::string_literals; 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); std::ofstream f(filename);
f << file; f << file;
+2 -2
View File
@@ -36,7 +36,7 @@ typedef IfcParse::IfcGlobalId guid;
boost::none_t const null = boost::none; boost::none_t const null = boost::none;
int main(int argc, char** argv) { int main(int argc, char** argv) {
const char filename[] = "IfcCompositeProfileDef.ifc"; const char filename[] = "composite_profile_def.ifc";
IfcHierarchyHelper<IfcSchema> file; IfcHierarchyHelper<IfcSchema> file;
file.header().file_name()->setname(filename); file.header().file_name()->setname(filename);
@@ -113,7 +113,7 @@ int main(int argc, char** argv) {
product->setRepresentation(shape); product->setRepresentation(shape);
using namespace std::string_literals; 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); std::ofstream f(filename);
f << file; f << file;
+2 -2
View File
@@ -133,7 +133,7 @@ public:
}; };
int main(int argc, char** argv) { int main(int argc, char** argv) {
const char filename[] = "IfcCsgPrimitive.ifc"; const char filename[] = "csg_primitive.ifc";
IfcHierarchyHelper<IfcSchema> file; IfcHierarchyHelper<IfcSchema> file;
file.header().file_name()->setname(filename); file.header().file_name()->setname(filename);
@@ -187,7 +187,7 @@ int main(int argc, char** argv) {
product->setRepresentation(shape); product->setRepresentation(shape);
using namespace std::string_literals; using namespace std::string_literals;
file.getSingle<IfcSchema::IfcProject>()->setName("IfcCompositeProfileDef"s); file.getSingle<IfcSchema::IfcProject>()->setName("csg_primitive"s);
std::ofstream f(filename); std::ofstream f(filename);
f << file; 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); IfcSchema::IfcCircle* circle = new IfcSchema::IfcCircle(axis1, R);
file.addEntity(circle); file.addEntity(circle);
aggregate_of_instance::ptr trim1(new aggregate_of_instance); IfcSchema::IfcTrimmingSelect::list::ptr trim1(new IfcSchema::IfcTrimmingSelect::list);
aggregate_of_instance::ptr trim2(new aggregate_of_instance); IfcSchema::IfcTrimmingSelect::list::ptr trim2(new IfcSchema::IfcTrimmingSelect::list);
trim1->push(new IfcSchema::IfcParameterValue(180)); trim1->push(new IfcSchema::IfcParameterValue(180));
trim1->push(p2); trim1->push(p2);
@@ -91,7 +91,7 @@ void create_curve_rebar(IfcHierarchyHelper<IfcSchema>& file)
trim2->push(new IfcSchema::IfcParameterValue(270)); trim2->push(new IfcSchema::IfcParameterValue(270));
trim2->push(p4); 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); file.addEntity(trimmed_curve);
IfcSchema::IfcCompositeCurveSegment* segment2 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTSAMEGRADIENT, false, 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); product->setRepresentation(shape);
const std::string filename = "tesselated_faceset.ifc"; const std::string filename = "triangulated_faceset.ifc";
file.header().file_name()->setname(filename); file.header().file_name()->setname(filename);
std::ofstream f(filename); std::ofstream f(filename);
f << file; f << file;