diff --git a/src/examples/profiles.cpp b/src/examples/profiles.cpp
new file mode 100644
index 0000000000..e0c2a992d5
--- /dev/null
+++ b/src/examples/profiles.cpp
@@ -0,0 +1,203 @@
+/********************************************************************************
+ * *
+ * This file is part of IfcOpenShell. *
+ * *
+ * IfcOpenShell is free software: you can redistribute it and/or modify *
+ * it under the terms of the Lesser GNU General Public License as published by *
+ * the Free Software Foundation, either version 3.0 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * IfcOpenShell is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * Lesser GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the Lesser GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ********************************************************************************/
+
+/********************************************************************************
+ * *
+ * Example that generates extrusions of parameterized profiles. *
+ * *
+ ********************************************************************************/
+
+#include
+#include
+#include
+
+#include "../ifcparse/Ifc2x3.h"
+#include "../ifcparse/IfcUtil.h"
+#include "../ifcparse/IfcHierarchyHelper.h"
+
+typedef std::string S;
+typedef IfcWrite::IfcGuidHelper guid;
+boost::none_t const null = (static_cast(0));
+
+void create_testcase_for(IfcSchema::IfcProfileDef::list profiles) {
+ IfcSchema::IfcProfileDef* profile = *profiles->begin();
+ const std::string profile_type = IfcSchema::Type::ToString(profile->type());
+ const std::string filename = profile_type + ".ifc";
+
+ IfcHierarchyHelper file;
+ file.filename(filename);
+
+ int i = 0;
+ for (IfcSchema::IfcProfileDef::it it = profiles->begin(); it != profiles->end(); ++it, ++i) {
+ IfcSchema::IfcProfileDef* profile = *it;
+ IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy(
+ guid(), 0, S("profile"), null, null, 0, 0, null, null);
+ file.addBuildingProduct(product);
+ file.getSingle()->setName(profile_type);
+ product->setOwnerHistory(file.getSingle());
+
+ product->setObjectPlacement(file.addLocalPlacement(100 * i));
+
+ if (profile->is(IfcSchema::Type::IfcParameterizedProfileDef)) {
+ ((IfcSchema::IfcParameterizedProfileDef*) profile)->setPosition(file.addPlacement2d());
+ }
+
+ IfcSchema::IfcExtrudedAreaSolid* solid = new IfcSchema::IfcExtrudedAreaSolid(profile,
+ file.addPlacement3d(), file.addTriplet(0, 0, 1), 20.0);
+
+ file.AddEntity(profile);
+ file.AddEntity(solid);
+
+ IfcSchema::IfcRepresentation::list reps (new IfcTemplatedEntityList());
+ IfcSchema::IfcRepresentationItem::list items (new IfcTemplatedEntityList());
+
+ items->push(solid);
+ IfcSchema::IfcShapeRepresentation* rep = new IfcSchema::IfcShapeRepresentation(
+ file.getSingle(), S("Body"), S("SweptSolid"), items);
+ reps->push(rep);
+
+ IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps);
+ file.AddEntity(rep);
+ file.AddEntity(shape);
+
+ product->setRepresentation(shape);
+ }
+
+ std::ofstream f(filename.c_str());
+ f << file;
+}
+
+int main(int argc, char** argv) {
+ { IfcSchema::IfcProfileDef::list profiles (new IfcTemplatedEntityList());
+ profiles->push(new Ifc2x3::IfcUShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 5.0, null, null, null, null));
+ profiles->push(new Ifc2x3::IfcUShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 5.0, 2.0, 2.0, null, null));
+ profiles->push(new Ifc2x3::IfcUShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 5.0, null, null, 0.1, null));
+ profiles->push(new Ifc2x3::IfcUShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 5.0, 1.0, 3.0, 0.1, null));
+ create_testcase_for(profiles); }
+
+ { IfcSchema::IfcProfileDef::list profiles (new IfcTemplatedEntityList());
+ profiles->push(new Ifc2x3::IfcTShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 5.0, null, null, null, null, null, null));
+ profiles->push(new Ifc2x3::IfcTShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 5.0, 2.0, 2.0, 2.0, null, null, null));
+ profiles->push(new Ifc2x3::IfcTShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 5.0, null, null, null, 0.1, 0.1, null));
+ profiles->push(new Ifc2x3::IfcTShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 5.0, 1.0, 2.0, 3.0, 0.1, 0.2, null));
+ create_testcase_for(profiles); }
+
+ { IfcSchema::IfcProfileDef::list profiles (new IfcTemplatedEntityList());
+ profiles->push(new Ifc2x3::IfcZShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 5.0, null, null));
+ profiles->push(new Ifc2x3::IfcZShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 5.0, 2.0, 2.0));
+ create_testcase_for(profiles); }
+
+ { IfcSchema::IfcProfileDef::list profiles (new IfcTemplatedEntityList());
+ profiles->push(new Ifc2x3::IfcEllipseProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0));
+ profiles->push(new Ifc2x3::IfcEllipseProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 25.0, 50.0));
+ create_testcase_for(profiles); }
+
+ { IfcSchema::IfcProfileDef::list profiles (new IfcTemplatedEntityList());
+ profiles->push(new Ifc2x3::IfcIShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 25.0, 50.0, 5.0, 5.0, null));
+ profiles->push(new Ifc2x3::IfcIShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 25.0, 50.0, 5.0, 5.0, 2.0));
+ create_testcase_for(profiles); }
+
+ { IfcSchema::IfcProfileDef::list profiles (new IfcTemplatedEntityList());
+ profiles->push(new Ifc2x3::IfcLShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, null, null, null, null, null));
+ profiles->push(new Ifc2x3::IfcLShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 2.0, 2.0, null, null, null));
+ profiles->push(new Ifc2x3::IfcLShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, null, null, 0.1, null, null));
+ profiles->push(new Ifc2x3::IfcLShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 1.0, 2.0, 0.3, null, null));
+ create_testcase_for(profiles); }
+
+ { IfcSchema::IfcProfileDef::list profiles (new IfcTemplatedEntityList());
+ profiles->push(new Ifc2x3::IfcCShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 10.0, null, null));
+ profiles->push(new Ifc2x3::IfcCShapeProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 10.0, 2.0, null));
+ create_testcase_for(profiles); }
+
+ { IfcSchema::IfcProfileDef::list profiles (new IfcTemplatedEntityList());
+ profiles->push(new Ifc2x3::IfcCircleProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 25.0));
+ profiles->push(new Ifc2x3::IfcCircleHollowProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 25.0, 5.0));
+ create_testcase_for(profiles); }
+
+ { IfcSchema::IfcProfileDef::list profiles (new IfcTemplatedEntityList());
+ profiles->push(new Ifc2x3::IfcRectangleProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0));
+ profiles->push(new Ifc2x3::IfcRoundedRectangleProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0));
+ profiles->push(new Ifc2x3::IfcRectangleHollowProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, null, null));
+ profiles->push(new Ifc2x3::IfcRectangleHollowProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 25.0, 5.0, 2.0, 4.0));
+ create_testcase_for(profiles); }
+
+ { IfcSchema::IfcProfileDef::list profiles (new IfcTemplatedEntityList());
+ profiles->push(new Ifc2x3::IfcTrapeziumProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 30.0, 25.0, 0.0));
+ profiles->push(new Ifc2x3::IfcTrapeziumProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 60.0, 25.0, -20.0));
+ profiles->push(new Ifc2x3::IfcTrapeziumProfileDef(
+ IfcSchema::IfcProfileTypeEnum::IfcProfileType_AREA,
+ null, 0, 50.0, 10.0, 25.0, 30.0));
+ create_testcase_for(profiles); }
+}
diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp
index 6894753474..99252efd1b 100644
--- a/src/ifcparse/IfcParse.cpp
+++ b/src/ifcparse/IfcParse.cpp
@@ -851,7 +851,7 @@ MapEntityById::const_iterator IfcFile::end() const {
std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f) {
os << "ISO-10303-21;" << std::endl;
os << "HEADER;" << std::endl;
- os << "FILE_DESCRIPTION(('ViewDefinition []'),'2;1');" << std::endl;
+ os << "FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');" << std::endl;
os << "FILE_NAME("
<< static_cast(IfcWrite::IfcCharacterEncoder(f.filename())) << ","
<< static_cast(IfcWrite::IfcCharacterEncoder(f.timestamp())) << ",("
diff --git a/test/run.py b/test/run.py
index 16febba72e..2a06374d59 100644
--- a/test/run.py
+++ b/test/run.py
@@ -206,6 +206,19 @@ TestFile("acad2010_objects.ifc")
# Various half space configuration to test cutting tolerances
TestFile("ifcopenshell_halfspaces.ifc")
+# Several parameterized profile extrusions generated by one
+# of the examples from the IfcOpenShell repository
+TestFile("IfcCShapeProfileDef.ifc")
+TestFile("IfcCircleProfileDef.ifc")
+TestFile("IfcEllipseProfileDef.ifc")
+TestFile("IfcIShapeProfileDef.ifc")
+TestFile("IfcLShapeProfileDef.ifc")
+TestFile("IfcRectangleProfileDef.ifc")
+TestFile("IfcTShapeProfileDef.ifc")
+TestFile("IfcTrapeziumProfileDef.ifc")
+TestFile("IfcUShapeProfileDef.ifc")
+TestFile("IfcZShapeProfileDef.ifc")
+
for test in test_cases:
succes = test()
if not succes:
@@ -217,4 +230,4 @@ if len(failed):
print (test)
else:
print("[Notice] All cases succeeded")
-
\ No newline at end of file
+