Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update IFC4X3 #571

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Core/src/DataManagement/General/Data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
#include "EarlyBinding\IFC4X3_RC4\src\IFC4X3_RC4.h"
#endif

#ifdef OIP_MODULE_EARLYBINDING_IFC4X3
#include "EarlyBinding\IFC4X3\src\reader\IFC4X3Reader.h"
#include "EarlyBinding\IFC4X3\src\EMTIFC4X3EntityTypes.h"
#include "EarlyBinding\IFC4X3\src\IFC4X3.h"
#endif

#include "IfcGeometryConverter\GeometryInputData.h"
#include "IfcGeometryConverter\IfcPeekStepReader.h"
#include "IfcGeometryConverter\IfcImporterImpl.h"
Expand Down Expand Up @@ -196,6 +202,15 @@ void OpenInfraPlatform::Core::DataManagement::Data::importJob(const std::string&
#endif //OIP_MODULE_EARLYBINDING_IFC4X3_RC4
}

if (ifcSchema == IfcPeekStepReader::IfcSchema::IFC4X3) {
#ifdef OIP_MODULE_EARLYBINDING_IFC4X3
ParseExpressAndGeometryModel<emt::IFC4X3EntityTypes, OpenInfraPlatform::IFC4X3::IFC4X3Reader>(filename);
return;
#else // OIP_MODULE_EARLYBINDING_IFC4X3
IFCVersionNotCompiled("IFC4X3");
#endif //OIP_MODULE_EARLYBINDING_IFC4X3
}

IFCVersionNotCompiled(strSchema);
return;
}
Expand Down
112 changes: 98 additions & 14 deletions Core/src/IfcGeometryConverter/CurveConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ namespace OpenInfraPlatform
*/
}

#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)
/*! \brief Converts \c IfcSegment and its subtypes to a series of points.
* \param[in] segment The \c IfcSegment to be converted.
* \param[out] targetVec The tessellated line.
Expand Down Expand Up @@ -1507,7 +1507,7 @@ namespace OpenInfraPlatform
}
#endif

#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)
/*! \brief Converts \c IfcCurveSegment to a series of points and appends them to the curve.
* https://standards.buildingsmart.org/IFC/DEV/IFC4_3/RC4-voting/HTML/link/ifccurvesegment.htm
* \param[in] curveSegment The \c IfcCurveSegment to be converted.
Expand Down Expand Up @@ -1603,6 +1603,18 @@ namespace OpenInfraPlatform
point = getPointOnCurve(curveSegment->ParentCurve.as<typename IfcEntityTypesT::IfcThirdOrderPolynomialSpiral>(), runningLength);
direction = getDirectionOfCurve(curveSegment->ParentCurve.as<typename IfcEntityTypesT::IfcThirdOrderPolynomialSpiral>(), runningLength);
}
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3)
else if (curveSegment->ParentCurve.isOfType<typename IfcEntityTypesT::IfcSineSpiral>())
{
point = getPointOnCurve(curveSegment->ParentCurve.as<typename IfcEntityTypesT::IfcSineSpiral>(), runningLength, length);
direction = getDirectionOfCurve(curveSegment->ParentCurve.as<typename IfcEntityTypesT::IfcSineSpiral>(), runningLength, length);
}
else if (curveSegment->ParentCurve.isOfType<typename IfcEntityTypesT::IfcCosineSpiral>())
{
point = getPointOnCurve(curveSegment->ParentCurve.as<typename IfcEntityTypesT::IfcCosineSpiral>(), runningLength, length);
direction = getDirectionOfCurve(curveSegment->ParentCurve.as<typename IfcEntityTypesT::IfcCosineSpiral>(), runningLength, length);
}
#else
else if (curveSegment->ParentCurve.isOfType<typename IfcEntityTypesT::IfcSine>())
{
point = getPointOnCurve(curveSegment->ParentCurve.as<typename IfcEntityTypesT::IfcSine>(), runningLength, length);
Expand All @@ -1613,6 +1625,8 @@ namespace OpenInfraPlatform
point = getPointOnCurve(curveSegment->ParentCurve.as<typename IfcEntityTypesT::IfcCosine>(), runningLength, length);
direction = getDirectionOfCurve(curveSegment->ParentCurve.as<typename IfcEntityTypesT::IfcCosine>(), runningLength, length);
}
#endif

else if (curveSegment->ParentCurve.isOfType<typename IfcEntityTypesT::IfcSecondOrderPolynomialSpiral>())
{
point = getPointOnCurve(curveSegment->ParentCurve.as<typename IfcEntityTypesT::IfcSecondOrderPolynomialSpiral>(), runningLength);
Expand Down Expand Up @@ -2453,7 +2467,7 @@ namespace OpenInfraPlatform
}
}

#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)
template <typename TCurve>
carve::geom::vector<3> getPointOnCurve(
const EXPRESSReference<TCurve>& curve,
Expand Down Expand Up @@ -2644,7 +2658,7 @@ namespace OpenInfraPlatform
}


#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)

/*! \brief Calculates a trimming point on the clothoid.
* \param[in] clothoid A pointer to data from \c IfcClothoid.
Expand Down Expand Up @@ -2683,7 +2697,7 @@ namespace OpenInfraPlatform
return carve::geom::VECTOR(x, y, 0.);
}
#endif
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)

/*! \brief Calculates a trimming point on the second order polymonial spiral
* \param[in] secondOrderPolynomial A pointer to data from \c IfcSecondOrderPolynomialSpiral.
Expand Down Expand Up @@ -2736,7 +2750,7 @@ namespace OpenInfraPlatform
}

#endif
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)

/*! \brief Calculates a trimming point on the seventh order polymonial spiral
* \param[in] seventhOrderPolynomial A pointer to data from \c IfcSeventhOrderPolynomialSpiral.
Expand Down Expand Up @@ -2803,7 +2817,7 @@ namespace OpenInfraPlatform
return carve::geom::VECTOR(x, y, 0.);
}
#endif
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)

/*! \brief Calculates a trimming point on the third order polymonial spiral
* \param[in] thirdOrderPolynomial A pointer to data from \c IfcThirdOrderPolynomialSpiral.
Expand Down Expand Up @@ -2862,7 +2876,7 @@ namespace OpenInfraPlatform
return carve::geom::VECTOR(x, y, 0.);
}
#endif
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)

/*! \brief Calculates a trimming point on the sine curve.
* \param[in] sine A pointer to data from \c IfcSine.
Expand All @@ -2871,6 +2885,22 @@ namespace OpenInfraPlatform
* \return The location of the trimming point.
* \note
*/
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3)
template <>
carve::geom::vector<3> getPointOnCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcSineSpiral>& sine,
const typename IfcEntityTypesT::IfcParameterValue& parameter, const double& length) const noexcept(false)
{
return getPointOnCurve(sine, parameter * this->UnitConvert()->getLengthInMeterFactor(), length * this->UnitConvert()->getLengthInMeterFactor());
}
template <>
carve::geom::vector<3> getPointOnCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcSineSpiral>& sine,
const typename IfcEntityTypesT::IfcNonNegativeLengthMeasure& parameter, const double& length) const noexcept(false)
{
return getPointOnCurve(sine, parameter * this->UnitConvert()->getLengthInMeterFactor(), length * this->UnitConvert()->getLengthInMeterFactor());
}
carve::geom::vector<3> getPointOnCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcSineSpiral>& sine,
const double& parameter, const double& length) const noexcept(false)
#else
template <>
carve::geom::vector<3> getPointOnCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcSine>& sine,
const typename IfcEntityTypesT::IfcParameterValue& parameter, const double& length) const noexcept(false)
Expand All @@ -2885,6 +2915,7 @@ namespace OpenInfraPlatform
}
carve::geom::vector<3> getPointOnCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcSine>& sine,
const double& parameter, const double& length) const noexcept(false)
#endif
{
// Interpret parameter
double sineTerm = sine->SineTerm * this->UnitConvert()->getLengthInMeterFactor();
Expand Down Expand Up @@ -2926,6 +2957,23 @@ namespace OpenInfraPlatform
* \return The location of the trimming point.
* \note
*/
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3)

template <>
carve::geom::vector<3> getPointOnCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcCosineSpiral>& cosine,
const typename IfcEntityTypesT::IfcParameterValue& parameter, const double& length) const noexcept(false)
{
return getPointOnCurve(cosine, parameter * this->UnitConvert()->getLengthInMeterFactor(), length * this->UnitConvert()->getLengthInMeterFactor());
}
template <>
carve::geom::vector<3> getPointOnCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcCosineSpiral>& cosine,
const typename IfcEntityTypesT::IfcNonNegativeLengthMeasure& parameter, const double& length) const noexcept(false)
{
return getPointOnCurve(cosine, parameter * this->UnitConvert()->getLengthInMeterFactor(), length * this->UnitConvert()->getLengthInMeterFactor());
}
carve::geom::vector<3> getPointOnCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcCosineSpiral>& cosine,
const double& parameter, const double& length) const noexcept(false)
#else
template <>
carve::geom::vector<3> getPointOnCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcCosine>& cosine,
const typename IfcEntityTypesT::IfcParameterValue& parameter, const double& length) const noexcept(false)
Expand All @@ -2940,6 +2988,7 @@ namespace OpenInfraPlatform
}
carve::geom::vector<3> getPointOnCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcCosine>& cosine,
const double& parameter, const double& length) const noexcept(false)
#endif
{
// Interpret parameter
double cosineTerm = cosine->CosineTerm * this->UnitConvert()->getLengthInMeterFactor();
Expand Down Expand Up @@ -3045,7 +3094,7 @@ namespace OpenInfraPlatform
}
}

#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)
template <typename TCurve>
carve::geom::vector<3> getDirectionOfCurve(
const EXPRESSReference<TCurve>& curve,
Expand Down Expand Up @@ -3263,7 +3312,7 @@ namespace OpenInfraPlatform
}


#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)
/*! \brief Calculates an angle of the clothoid.
* \param[in] clothoid A pointer to data from \c IfcClothoid.
* \param[in] parameter The length.
Expand Down Expand Up @@ -3302,7 +3351,7 @@ namespace OpenInfraPlatform
return carve::geom::VECTOR(std::cos(angle), std::sin(angle), 0.);
}
#endif
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)
/*! \brief Calculates an angle of the second order polynomial spiral.
* \param[in] secondOrderPolynomial A pointer to data from \c IfcSecondOrderPolynomialSpiral.
* \param[in] parameter The length.
Expand Down Expand Up @@ -3349,7 +3398,7 @@ namespace OpenInfraPlatform
return carve::geom::VECTOR(std::cos(angle), std::sin(angle), 0.);
}
#endif
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)
/*! \brief Calculates an angle of the seventh order polynomial spiral.
* \param[in] seventhOrderPolynomial A pointer to data from \c IfcSeventhOrderPolynomialSpiral.
* \param[in] parameter The length.
Expand Down Expand Up @@ -3412,7 +3461,7 @@ namespace OpenInfraPlatform
return carve::geom::VECTOR(std::cos(angle), std::sin(angle), 0.);
}
#endif
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)
/*! \brief Calculates an angle of the third order polynomial spiral.
* \param[in] thirdOrderPolynomial A pointer to data from \c IfcThirdOrderPolynomialSpiral.
* \param[in] parameter The length.
Expand Down Expand Up @@ -3466,14 +3515,30 @@ namespace OpenInfraPlatform
}
#endif

#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4)
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC4) || defined(OIP_MODULE_EARLYBINDING_IFC4X3)
/*! \brief Calculates an angle of the sine.
* \param[in] sine A pointer to data from \c IfcSine.
* \param[in] parameter The trimmed length.
* \param[in] length The Lenght of the curve from \c IfcCurveMeasureSelect.
* \return The Angle in radians.
* \note
*/
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3)
template <>
carve::geom::vector<3> getDirectionOfCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcSineSpiral>& sine,
const typename IfcEntityTypesT::IfcParameterValue& parameter, const double& length) const noexcept(false)
{
return getDirectionOfCurve(sine, parameter * this->UnitConvert()->getLengthInMeterFactor(), length * this->UnitConvert()->getLengthInMeterFactor());
}
template <>
carve::geom::vector<3> getDirectionOfCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcSineSpiral>& sine,
const typename IfcEntityTypesT::IfcNonNegativeLengthMeasure& parameter, const double& length) const noexcept(false)
{
return getDirectionOfCurve(sine, parameter * this->UnitConvert()->getLengthInMeterFactor(), length * this->UnitConvert()->getLengthInMeterFactor());
}
carve::geom::vector<3> getDirectionOfCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcSineSpiral>& sine,
const double& parameter, const double& length) const noexcept(false)
#else
template <>
carve::geom::vector<3> getDirectionOfCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcSine>& sine,
const typename IfcEntityTypesT::IfcParameterValue& parameter, const double& length) const noexcept(false)
Expand All @@ -3488,6 +3553,7 @@ namespace OpenInfraPlatform
}
carve::geom::vector<3> getDirectionOfCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcSine>& sine,
const double& parameter, const double& length) const noexcept(false)
#endif
{
// Interpret parameter
double sineTerm = sine->SineTerm * this->UnitConvert()->getLengthInMeterFactor();
Expand Down Expand Up @@ -3528,6 +3594,23 @@ namespace OpenInfraPlatform
* \return The Angle in radians.
* \note
*/
#if defined(OIP_MODULE_EARLYBINDING_IFC4X3)
template <>
carve::geom::vector<3> getDirectionOfCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcCosineSpiral>& cosine,
const typename IfcEntityTypesT::IfcNonNegativeLengthMeasure& parameter, const double& length) const noexcept(false)
{
return getDirectionOfCurve(cosine, parameter * this->UnitConvert()->getLengthInMeterFactor(), length * this->UnitConvert()->getLengthInMeterFactor());
}
template<>
carve::geom::vector<3> getDirectionOfCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcCosineSpiral>& cosine,
const typename IfcEntityTypesT::IfcParameterValue& parameter, const double& length) const noexcept(false)
{
return getDirectionOfCurve(cosine, parameter * this->UnitConvert()->getLengthInMeterFactor(), length * this->UnitConvert()->getLengthInMeterFactor());
}
template<>
carve::geom::vector<3> getDirectionOfCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcCosineSpiral>& cosine,
const double& parameter, const double& length) const noexcept(false)
#else
template <>
carve::geom::vector<3> getDirectionOfCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcCosine>& cosine,
const typename IfcEntityTypesT::IfcNonNegativeLengthMeasure& parameter, const double& length) const noexcept(false)
Expand All @@ -3543,6 +3626,7 @@ namespace OpenInfraPlatform
template<>
carve::geom::vector<3> getDirectionOfCurve(const EXPRESSReference<typename IfcEntityTypesT::IfcCosine>& cosine,
const double& parameter, const double& length) const noexcept(false)
#endif
{
// Interpret parameter
double cosineTerm = cosine->CosineTerm * this->UnitConvert()->getLengthInMeterFactor();
Expand Down
5 changes: 5 additions & 0 deletions Core/src/IfcGeometryConverter/IfcImporterImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
#include "EarlyBinding\IFC4X3_RC4\src\IFC4X3_RC4Entities.h"
#endif

#ifdef OIP_MODULE_EARLYBINDING_IFC4X3
#include "EarlyBinding\IFC4X3\src\EMTIFC4X3EntityTypes.h"
#include "EarlyBinding\IFC4X3\src\IFC4X3Entities.h"
#endif

#include "namespace.h"
#include "PlacementConverterImpl.h"

Expand Down
3 changes: 2 additions & 1 deletion Core/src/IfcGeometryConverter/IfcPeekStepReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ std::map<std::string, IfcPeekStepReader::IfcSchema> schemata = {
MapType("ifc4", IfcPeekStepReader::IfcSchema::IFC4),
MapType("ifc4x1", IfcPeekStepReader::IfcSchema::IFC4X1),
MapType("ifc4x3_rc1", IfcPeekStepReader::IfcSchema::IFC4X3_RC1),
MapType("ifc4x3_rc4", IfcPeekStepReader::IfcSchema::IFC4X3_RC4)
MapType("ifc4x3_rc4", IfcPeekStepReader::IfcSchema::IFC4X3_RC4),
MapType("ifc4x3", IfcPeekStepReader::IfcSchema::IFC4X3)
};

IfcPeekStepReader::IfcPeekStepReader()
Expand Down
2 changes: 1 addition & 1 deletion Core/src/IfcGeometryConverter/IfcPeekStepReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace OpenInfraPlatform
virtual ~IfcPeekStepReader();

//TODO: Have this amended by cmake configure file
enum class IfcSchema : short { IFC2X3, IFC4, IFC4X1, IFC4X3_RC1, IFC4X3_RC4 };
enum class IfcSchema : short { IFC2X3, IFC4, IFC4X1, IFC4X3_RC1, IFC4X3_RC4, IFC4X3 };
static std::pair<std::string, IfcSchema> parseIfcHeader(const std::string& filename);
};
}
Expand Down
6 changes: 4 additions & 2 deletions Core/src/IfcGeometryConverter/SolidModelConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,11 @@ namespace OpenInfraPlatform

// Get cross section positions and fixed axis vertical (attributes 3-4).
const auto& crossSectionPositions = sectionedSolidHorizontal->CrossSectionPositions;

#if defined(OIP_MODULE_EARLYBINDING_IFC4X1) || defined(OIP_MODULE_EARLYBINDING_IFC4X3_RC1)
bool fixedAxisVertical = sectionedSolidHorizontal->FixedAxisVertical;

#else
bool fixedAxisVertical = true;//please rewrite it!! wrong implementation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please denote this as Todo

#endif
//check dimensions and correct attributes sizes
if (vecCrossSections.size() != crossSectionPositions.size())
{
Expand Down
Loading