diff --git a/ChangeLog.md b/ChangeLog.md index 0458b05e9..8208e2d40 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,6 +5,7 @@ Changes since last release ---------------- 2025/09/26 -General changes + - Add new lofting algorithm to create wing surfaces with rounded segments [#1284](https://github.com/DLR-SC/tigl/pull/1338) - TiGLCreator: Draw option menus are now updated when adding new wings or fuselages. - TiGLCreator: Bi-directional selection of shapes via the GUI or the CPACSTree is supported now [#1275](https://github.com/DLR-SC/tigl/issues/1275). - TIGLCreator: Use NACA profiles and standard profiles in the TIGLCreator templates ([#1367](https://github.com/DLR-SC/tigl/issues/1367)) diff --git a/bindings/python_internal/geometry.i b/bindings/python_internal/geometry.i index f9ee06ac3..06b9f800e 100644 --- a/bindings/python_internal/geometry.i +++ b/bindings/python_internal/geometry.i @@ -73,6 +73,7 @@ #include "CTiglInterpolateCurveNetwork.h" #include "CTiglPointsToBSplineInterpolation.h" #include "CTiglCurvesToSurface.h" +#include "CTiglRoundedSegmentSurface.h" #include "CTiglIntersectBSplines.h" #include "CTiglInterpolatePointsWithKinks.h" #include "CTiglApproxResult.h" @@ -107,6 +108,7 @@ %include "CTiglPointsToBSplineInterpolation.h" %include "CTiglInterpolateCurveNetwork.h" %include "CTiglCurvesToSurface.h" +%include "CTiglRoundedSegmentSurface.h" %include "tiglcommonfunctions.h" %include "CTiglProjectOnLinearSpline.h" %include "CTiglMakeLoft.h" diff --git a/cpacs_gen_input/cpacs_schema.xsd b/cpacs_gen_input/cpacs_schema.xsd index ed12d6f87..f3b882200 100644 --- a/cpacs_gen_input/cpacs_schema.xsd +++ b/cpacs_gen_input/cpacs_schema.xsd @@ -12740,6 +12740,26 @@ The fuel tank volume type should also be used for the wing fuel tank + + + This parameter only has an effect if the roundedSegments attribute in the fuselage/duct definition is set to true. It defines the blending distance at the inner end of this segment to create a smooth segment transition. The distance is provided in absolute length units. + + + + + + + + + + This parameter only has an effect if the roundedSegments attribute in the fuselage/duct definition is set to true. It defines the blending distance at the outer end of this segment to create a smooth segment transition. The distance is provided in absolute length units. + + + + + + + @@ -12867,6 +12887,13 @@ The fuel tank volume type should also be used for the wing fuel tank + + + This attribute determines the lofting approach of this fuselage. +If set to true, a different lofting algorithm will be used allowing to specify rounding radii at each section which create a smooth transition between two segments. +This can be achieved e.g. by activating the approximation setting in the profile definitions. + + @@ -28757,6 +28784,26 @@ The fuel tank volume type should also be used for the wing fuel tank + + + This parameter only has an effect if the roundedSegments attribute in the fuselage/duct definition is set to true. It defines the blending distance at the inner end of this segment to create a smooth segment transition. The distance is provided in absolute length units. + + + + + + + + + + This parameter only has an effect if the roundedSegments attribute in the fuselage/duct definition is set to true. It defines the blending distance at the outer end of this segment to create a smooth segment transition. The distance is provided in absolute length units. + + + + + + + @@ -29135,6 +29182,14 @@ The fuel tank volume type should also be used for the wing fuel tank + + + This attribute determines the lofting approach of this fuselage. +If set to true, a different lofting algorithm will be used allowing to specify rounding radii at each section which create a smooth transition between two segments. +This can be achieved e.g. by activating the approximation setting in the profile definitions. + + + @@ -35759,6 +35814,13 @@ The fuel tank volume type should also be used for the wing fuel tank + + + This attribute determines the lofting approach of this fuselage. +If set to true, a different lofting algorithm will be used allowing to specify rounding radii at each section which create a smooth transition between two segments. +This can be achieved e.g. by activating the approximation setting in the profile definitions. + + diff --git a/src/generated/CPACSDuct.cpp b/src/generated/CPACSDuct.cpp index 51dc522ea..a16c65832 100644 --- a/src/generated/CPACSDuct.cpp +++ b/src/generated/CPACSDuct.cpp @@ -101,6 +101,11 @@ namespace generated m_symmetry = stringToTiglSymmetryAxis(tixi::TixiGetAttribute(tixiHandle, xpath, "symmetry")); } + // read attribute roundedSegments + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "roundedSegments")) { + m_roundedSegments = tixi::TixiGetAttribute(tixiHandle, xpath, "roundedSegments"); + } + // read element name if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); @@ -187,6 +192,16 @@ namespace generated } } + // write attribute roundedSegments + if (m_roundedSegments) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "roundedSegments", *m_roundedSegments); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "roundedSegments")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "roundedSegments"); + } + } + // write element name tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/name"); tixi::TixiSaveElement(tixiHandle, xpath + "/name", m_name); @@ -273,6 +288,16 @@ namespace generated m_symmetry = value; } + const boost::optional& CPACSDuct::GetRoundedSegments() const + { + return m_roundedSegments; + } + + void CPACSDuct::SetRoundedSegments(const boost::optional& value) + { + m_roundedSegments = value; + } + const std::string& CPACSDuct::GetName() const { return m_name; diff --git a/src/generated/CPACSDuct.h b/src/generated/CPACSDuct.h index 71cec98ca..958e70a25 100644 --- a/src/generated/CPACSDuct.h +++ b/src/generated/CPACSDuct.h @@ -70,6 +70,9 @@ namespace generated TIGL_EXPORT virtual const boost::optional& GetSymmetry() const; TIGL_EXPORT virtual void SetSymmetry(const boost::optional& value); + TIGL_EXPORT virtual const boost::optional& GetRoundedSegments() const; + TIGL_EXPORT virtual void SetRoundedSegments(const boost::optional& value); + TIGL_EXPORT virtual const std::string& GetName() const; TIGL_EXPORT virtual void SetName(const std::string& value); @@ -109,6 +112,11 @@ namespace generated boost::optional m_symmetry; + /// This attribute determines the lofting approach of this fuselage. + /// If set to true, a different lofting algorithm will be used allowing to specify rounding radii at each section which create a smooth transition between two segments. + /// This can be achieved e.g. by activating the approximation setting in the profile definitions. + boost::optional m_roundedSegments; + /// Name std::string m_name; diff --git a/src/generated/CPACSFuselage.cpp b/src/generated/CPACSFuselage.cpp index c22878ab0..290489577 100644 --- a/src/generated/CPACSFuselage.cpp +++ b/src/generated/CPACSFuselage.cpp @@ -105,6 +105,11 @@ namespace generated m_symmetry = stringToTiglSymmetryAxis(tixi::TixiGetAttribute(tixiHandle, xpath, "symmetry")); } + // read attribute roundedSegments + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "roundedSegments")) { + m_roundedSegments = tixi::TixiGetAttribute(tixiHandle, xpath, "roundedSegments"); + } + // read element name if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); @@ -219,6 +224,16 @@ namespace generated } } + // write attribute roundedSegments + if (m_roundedSegments) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "roundedSegments", *m_roundedSegments); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "roundedSegments")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "roundedSegments"); + } + } + // write element name tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/name"); tixi::TixiSaveElement(tixiHandle, xpath + "/name", m_name); @@ -331,6 +346,16 @@ namespace generated m_symmetry = value; } + const boost::optional& CPACSFuselage::GetRoundedSegments() const + { + return m_roundedSegments; + } + + void CPACSFuselage::SetRoundedSegments(const boost::optional& value) + { + m_roundedSegments = value; + } + const std::string& CPACSFuselage::GetName() const { return m_name; diff --git a/src/generated/CPACSFuselage.h b/src/generated/CPACSFuselage.h index 2ffd6e4e8..3095ee921 100644 --- a/src/generated/CPACSFuselage.h +++ b/src/generated/CPACSFuselage.h @@ -76,6 +76,9 @@ namespace generated TIGL_EXPORT virtual const boost::optional& GetSymmetry() const; TIGL_EXPORT virtual void SetSymmetry(const boost::optional& value); + TIGL_EXPORT virtual const boost::optional& GetRoundedSegments() const; + TIGL_EXPORT virtual void SetRoundedSegments(const boost::optional& value); + TIGL_EXPORT virtual const std::string& GetName() const; TIGL_EXPORT virtual void SetName(const std::string& value); @@ -127,6 +130,11 @@ namespace generated boost::optional m_symmetry; + /// This attribute determines the lofting approach of this fuselage. + /// If set to true, a different lofting algorithm will be used allowing to specify rounding radii at each section which create a smooth transition between two segments. + /// This can be achieved e.g. by activating the approximation setting in the profile definitions. + boost::optional m_roundedSegments; + /// Name of fuselage std::string m_name; diff --git a/src/generated/CPACSFuselageSegment.cpp b/src/generated/CPACSFuselageSegment.cpp index d37c01a8d..938cfc584 100644 --- a/src/generated/CPACSFuselageSegment.cpp +++ b/src/generated/CPACSFuselageSegment.cpp @@ -152,6 +152,16 @@ namespace generated } } + // read element innerRoundingDistance + if (tixi::TixiCheckElement(tixiHandle, xpath + "/innerRoundingDistance")) { + m_innerRoundingDistance = tixi::TixiGetElement(tixiHandle, xpath + "/innerRoundingDistance"); + } + + // read element outerRoundingDistance + if (tixi::TixiCheckElement(tixiHandle, xpath + "/outerRoundingDistance")) { + m_outerRoundingDistance = tixi::TixiGetElement(tixiHandle, xpath + "/outerRoundingDistance"); + } + if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); } @@ -194,6 +204,28 @@ namespace generated } } + // write element innerRoundingDistance + if (m_innerRoundingDistance) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/innerRoundingDistance"); + tixi::TixiSaveElement(tixiHandle, xpath + "/innerRoundingDistance", *m_innerRoundingDistance); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/innerRoundingDistance")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/innerRoundingDistance"); + } + } + + // write element outerRoundingDistance + if (m_outerRoundingDistance) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/outerRoundingDistance"); + tixi::TixiSaveElement(tixiHandle, xpath + "/outerRoundingDistance", *m_outerRoundingDistance); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/outerRoundingDistance")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/outerRoundingDistance"); + } + } + } const std::string& CPACSFuselageSegment::GetUID() const @@ -272,6 +304,26 @@ namespace generated return m_guideCurves; } + const boost::optional& CPACSFuselageSegment::GetInnerRoundingDistance() const + { + return m_innerRoundingDistance; + } + + void CPACSFuselageSegment::SetInnerRoundingDistance(const boost::optional& value) + { + m_innerRoundingDistance = value; + } + + const boost::optional& CPACSFuselageSegment::GetOuterRoundingDistance() const + { + return m_outerRoundingDistance; + } + + void CPACSFuselageSegment::SetOuterRoundingDistance(const boost::optional& value) + { + m_outerRoundingDistance = value; + } + CCPACSGuideCurves& CPACSFuselageSegment::GetGuideCurves(CreateIfNotExistsTag) { if (!m_guideCurves) diff --git a/src/generated/CPACSFuselageSegment.h b/src/generated/CPACSFuselageSegment.h index 3ccb946dc..dc49f400c 100644 --- a/src/generated/CPACSFuselageSegment.h +++ b/src/generated/CPACSFuselageSegment.h @@ -80,6 +80,12 @@ namespace generated TIGL_EXPORT virtual const boost::optional& GetGuideCurves() const; TIGL_EXPORT virtual boost::optional& GetGuideCurves(); + TIGL_EXPORT virtual const boost::optional& GetInnerRoundingDistance() const; + TIGL_EXPORT virtual void SetInnerRoundingDistance(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetOuterRoundingDistance() const; + TIGL_EXPORT virtual void SetOuterRoundingDistance(const boost::optional& value); + TIGL_EXPORT virtual CCPACSGuideCurves& GetGuideCurves(CreateIfNotExistsTag); TIGL_EXPORT virtual void RemoveGuideCurves(); @@ -108,6 +114,12 @@ namespace generated /// the outer geometry. boost::optional m_guideCurves; + /// This parameter only has an effect if the roundedSegments attribute in the fuselage/duct definition is set to true. It defines the blending distance at the inner end of this segment to create a smooth segment transition. The distance is provided in absolute length units. + boost::optional m_innerRoundingDistance; + + /// This parameter only has an effect if the roundedSegments attribute in the fuselage/duct definition is set to true. It defines the blending distance at the outer end of this segment to create a smooth segment transition. The distance is provided in absolute length units. + boost::optional m_outerRoundingDistance; + private: TIGL_EXPORT const CTiglUIDObject* GetNextUIDObject() const final; TIGL_EXPORT void NotifyUIDChange(const std::string& oldUid, const std::string& newUid) final; diff --git a/src/generated/CPACSWing.cpp b/src/generated/CPACSWing.cpp index 9bcd48d19..bd99a3652 100644 --- a/src/generated/CPACSWing.cpp +++ b/src/generated/CPACSWing.cpp @@ -118,6 +118,11 @@ namespace generated m_symmetry = stringToTiglSymmetryAxis(tixi::TixiGetAttribute(tixiHandle, xpath, "symmetry")); } + // read attribute roundedSegments + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "roundedSegments")) { + m_roundedSegments = tixi::TixiGetAttribute(tixiHandle, xpath, "roundedSegments"); + } + // read element name if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); @@ -210,6 +215,16 @@ namespace generated } } + // write attribute roundedSegments + if (m_roundedSegments) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "roundedSegments", *m_roundedSegments); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "roundedSegments")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "roundedSegments"); + } + } + // write element name tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/name"); tixi::TixiSaveElement(tixiHandle, xpath + "/name", m_name); @@ -300,6 +315,16 @@ namespace generated m_symmetry = value; } + const boost::optional& CPACSWing::GetRoundedSegments() const + { + return m_roundedSegments; + } + + void CPACSWing::SetRoundedSegments(const boost::optional& value) + { + m_roundedSegments = value; + } + const std::string& CPACSWing::GetName() const { return m_name; diff --git a/src/generated/CPACSWing.h b/src/generated/CPACSWing.h index 11e06daac..1a1522fa8 100644 --- a/src/generated/CPACSWing.h +++ b/src/generated/CPACSWing.h @@ -127,6 +127,9 @@ namespace generated TIGL_EXPORT virtual const boost::optional& GetSymmetry() const; TIGL_EXPORT virtual void SetSymmetry(const boost::optional& value); + TIGL_EXPORT virtual const boost::optional& GetRoundedSegments() const; + TIGL_EXPORT virtual void SetRoundedSegments(const boost::optional& value); + TIGL_EXPORT virtual const std::string& GetName() const; TIGL_EXPORT virtual void SetName(const std::string& value); @@ -167,6 +170,11 @@ namespace generated boost::optional m_symmetry; + /// This attribute determines the lofting approach of this fuselage. + /// If set to true, a different lofting algorithm will be used allowing to specify rounding radii at each section which create a smooth transition between two segments. + /// This can be achieved e.g. by activating the approximation setting in the profile definitions. + boost::optional m_roundedSegments; + /// Name of the wing. std::string m_name; diff --git a/src/generated/CPACSWingSegment.cpp b/src/generated/CPACSWingSegment.cpp index 8b83c4a6f..af215b7c6 100644 --- a/src/generated/CPACSWingSegment.cpp +++ b/src/generated/CPACSWingSegment.cpp @@ -152,6 +152,16 @@ namespace generated } } + // read element innerRoundingDistance + if (tixi::TixiCheckElement(tixiHandle, xpath + "/innerRoundingDistance")) { + m_innerRoundingDistance = tixi::TixiGetElement(tixiHandle, xpath + "/innerRoundingDistance"); + } + + // read element outerRoundingDistance + if (tixi::TixiCheckElement(tixiHandle, xpath + "/outerRoundingDistance")) { + m_outerRoundingDistance = tixi::TixiGetElement(tixiHandle, xpath + "/outerRoundingDistance"); + } + if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); } @@ -194,6 +204,28 @@ namespace generated } } + // write element innerRoundingDistance + if (m_innerRoundingDistance) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/innerRoundingDistance"); + tixi::TixiSaveElement(tixiHandle, xpath + "/innerRoundingDistance", *m_innerRoundingDistance); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/innerRoundingDistance")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/innerRoundingDistance"); + } + } + + // write element outerRoundingDistance + if (m_outerRoundingDistance) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/outerRoundingDistance"); + tixi::TixiSaveElement(tixiHandle, xpath + "/outerRoundingDistance", *m_outerRoundingDistance); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/outerRoundingDistance")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/outerRoundingDistance"); + } + } + } const std::string& CPACSWingSegment::GetUID() const @@ -272,6 +304,26 @@ namespace generated return m_guideCurves; } + const boost::optional& CPACSWingSegment::GetInnerRoundingDistance() const + { + return m_innerRoundingDistance; + } + + void CPACSWingSegment::SetInnerRoundingDistance(const boost::optional& value) + { + m_innerRoundingDistance = value; + } + + const boost::optional& CPACSWingSegment::GetOuterRoundingDistance() const + { + return m_outerRoundingDistance; + } + + void CPACSWingSegment::SetOuterRoundingDistance(const boost::optional& value) + { + m_outerRoundingDistance = value; + } + CCPACSGuideCurves& CPACSWingSegment::GetGuideCurves(CreateIfNotExistsTag) { if (!m_guideCurves) diff --git a/src/generated/CPACSWingSegment.h b/src/generated/CPACSWingSegment.h index e7a262653..a32f37619 100644 --- a/src/generated/CPACSWingSegment.h +++ b/src/generated/CPACSWingSegment.h @@ -83,6 +83,12 @@ namespace generated TIGL_EXPORT virtual const boost::optional& GetGuideCurves() const; TIGL_EXPORT virtual boost::optional& GetGuideCurves(); + TIGL_EXPORT virtual const boost::optional& GetInnerRoundingDistance() const; + TIGL_EXPORT virtual void SetInnerRoundingDistance(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetOuterRoundingDistance() const; + TIGL_EXPORT virtual void SetOuterRoundingDistance(const boost::optional& value); + TIGL_EXPORT virtual CCPACSGuideCurves& GetGuideCurves(CreateIfNotExistsTag); TIGL_EXPORT virtual void RemoveGuideCurves(); @@ -111,6 +117,12 @@ namespace generated /// the outer geometry. boost::optional m_guideCurves; + /// This parameter only has an effect if the roundedSegments attribute in the fuselage/duct definition is set to true. It defines the blending distance at the inner end of this segment to create a smooth segment transition. The distance is provided in absolute length units. + boost::optional m_innerRoundingDistance; + + /// This parameter only has an effect if the roundedSegments attribute in the fuselage/duct definition is set to true. It defines the blending distance at the outer end of this segment to create a smooth segment transition. The distance is provided in absolute length units. + boost::optional m_outerRoundingDistance; + private: TIGL_EXPORT const CTiglUIDObject* GetNextUIDObject() const final; TIGL_EXPORT void NotifyUIDChange(const std::string& oldUid, const std::string& newUid) final; diff --git a/src/geometry/CTiglMakeLoft.cpp b/src/geometry/CTiglMakeLoft.cpp index b30ace58d..17596536c 100644 --- a/src/geometry/CTiglMakeLoft.cpp +++ b/src/geometry/CTiglMakeLoft.cpp @@ -24,6 +24,7 @@ #include "CTiglBSplineAlgorithms.h" #include "CTiglCurvesToSurface.h" +#include "geometry/CTiglRoundedSegmentSurface.h" #include "CTiglPatchShell.h" #include "Debugging.h" #include "to_string.h" @@ -93,6 +94,14 @@ void CTiglMakeLoft::addProfiles(const TopoDS_Shape &profiles) } } +void CTiglMakeLoft::setInnerRoundingDistance(std::vector innerRoundingDistance){ + m_innerRoundingDistance = innerRoundingDistance; +} + +void CTiglMakeLoft::setOuterRoundingDistance(std::vector outerRoundingDistance){ + m_outerRoundingDistance = outerRoundingDistance; +} + void CTiglMakeLoft::addGuides(const TopoDS_Shape &guides) { if (guides.ShapeType() == TopAbs_COMPOUND) { @@ -136,6 +145,8 @@ void CTiglMakeLoft::Perform() // to the loft with guides makeLoftWithGuides(); + } else if (m_innerRoundingDistance.size()>0&&m_outerRoundingDistance.size()>0){ + makeLoftWithRoundedSegments(); } else { makeLoftWithoutGuides(); @@ -153,6 +164,72 @@ void CTiglMakeLoft::setMakeSmooth(bool enabled) _makeSmooth = enabled; } +void CTiglMakeLoft::makeLoftWithRoundedSegments(){ + //check if there are both rounding distances defined for each segment + if(!(m_innerRoundingDistance.size()==profiles.size()-1)){ + throw tigl::CTiglError("CTiglMakeLoft: Number mismatch of segments (is "+std::to_string(m_innerRoundingDistance.size())+" ) and inner rounding distances: "+std::to_string(profiles.size()-1)); + } + if(!(m_outerRoundingDistance.size()==profiles.size()-1)){ + throw tigl::CTiglError("CTiglMakeLoft: Number mismatch of segments and outer rounding distances."); + } + + // check number of edges are all same + std::vector edgeCountPerProfile; + for (const auto& profile : profiles) { + edgeCountPerProfile.push_back(GetNumberOfEdges(profile)); + } + if (!AllSame(edgeCountPerProfile.begin(), edgeCountPerProfile.end())) { + throw tigl::CTiglError("Number of edges not equal in CTiglMakeLoft"); + } + + TopoDS_Shell faces; + BRep_Builder builder; + builder.MakeShell(faces); + + // get number of edges per profile wire + // --> should be the same for all profiles + TopTools_IndexedMapOfShape firstProfileMap; + TopExp::MapShapes(profiles[0], TopAbs_EDGE, firstProfileMap); + int const nEdgesPerProfile = firstProfileMap.Extent(); + + // skin the surface edge by adge + // CAUTION: Here it is assumed that the edges are ordered + // in the same way along each profile (e.g. lower edge, + // upper edge, trailing edge for a wing) + for ( int iE = 1; iE <= nEdgesPerProfile; ++iE ) { + + // get the curves + std::vector profileCurves; + profileCurves.reserve(profiles.size()); + for (unsigned iP=0; iP= iE ); + + TopoDS_Edge edge = TopoDS::Edge(profileMap(iE)); + profileCurves.push_back(GetBSplineCurve(edge)); + } + + // CHECK!!! MAYBE create a common knot vector for profileCurves + // std::vector compatibleProfileCurves = tigl::CTiglBSplineAlgorithms::createCommonKnotsVectorCurve(profileCurves, 1e-14); + + // skin the curves + tigl::CTiglRoundedSegmentSurface surfaceSkinner(profileCurves, m_innerRoundingDistance, m_outerRoundingDistance); + Handle(Geom_BSplineSurface) surface = surfaceSkinner.Surface(); + + // remember the profile parameters used for the skinning + + builder.Add(faces, BRepBuilderAPI_MakeFace(surface, 1e-6).Face()); + } + _result = tigl::CTiglTopoAlgorithms::CutShellAtUVParameters(faces, {}, vparams); + + // make sure the order is the same as for the COONS Patch algorithm + _result = ResortFaces(_result, nEdgesPerProfile, static_cast(vparams.size()-1)); + _result = tigl::CTiglTopoAlgorithms::CutShellAtKinks(_result); + CloseShape(); +} + /** * @brief Builds the loft using profiles and guide curves */ diff --git a/src/geometry/CTiglMakeLoft.h b/src/geometry/CTiglMakeLoft.h index cc0273f85..1913d5504 100644 --- a/src/geometry/CTiglMakeLoft.h +++ b/src/geometry/CTiglMakeLoft.h @@ -38,11 +38,29 @@ class CTiglMakeLoft /** * @brief Should be called to add sections/profiles to the algorithm. - * * @param profiles A shape that is either a wire or a compound consisting of multiple wires. */ TIGL_EXPORT void addProfiles(const TopoDS_Shape& profiles); - + + /** + * @brief If the class is used to create a loft with rounded segments, you can add + * inner/outer rounding distances as a vector. Make sure to add a value for each + * segment. If no rounding distance is given the value must be '0.' + * + * @param innerRoundingDistance This is a set of distances relative to 1 + * for each segment of a surface. Make sure to provide a value for each segment. + */ + TIGL_EXPORT void setInnerRoundingDistance(std::vector innerRoundingDistance); + + /** + * @brief If the class is used to create a loft with rounded segments, you can add + * inner/outer rounding distances as a vector. Make sure to add a value for each + * segment. If no rounding distance is given the value must be '0.' + * @param outerRoundingDistance This is a set of distances relative to 1 + * for each segment of a surface. Make sure to provide a value for each segment. + */ + TIGL_EXPORT void setOuterRoundingDistance(std::vector outerRoundingDistance); + /** * This function may be called to add guide curves to * the lofting algo. The shape should be either a wire @@ -78,6 +96,8 @@ class CTiglMakeLoft TIGL_EXPORT void Perform(); private: + + void makeLoftWithRoundedSegments(); void makeLoftWithGuides(); void makeLoftWithoutGuides(); @@ -104,6 +124,8 @@ class CTiglMakeLoft double _mySameKnotTolerance; std::vector guides, profiles; std::vector uparams, vparams; + std::vector m_innerRoundingDistance; + std::vector m_outerRoundingDistance; bool _hasPerformed, _makeSolid; bool _makeSmooth = false; diff --git a/src/geometry/CTiglRoundedSegmentSurface.cpp b/src/geometry/CTiglRoundedSegmentSurface.cpp new file mode 100644 index 000000000..987afef3f --- /dev/null +++ b/src/geometry/CTiglRoundedSegmentSurface.cpp @@ -0,0 +1,105 @@ +#include "CTiglRoundedSegmentSurface.h" +#include "BRepBuilderAPI_MakeEdge.hxx" +#include "BRepBuilderAPI_MakeFace.hxx" +#include "CTiglError.h" +#include "Debugging.h" +#include "TopTools_IndexedMapOfShape.hxx" +#include "TopoDS_Edge.hxx" +#include "tiglcommonfunctions.h" +#include +#include "CTiglBSplineAlgorithms.h" + + +namespace tigl{ +CTiglRoundedSegmentSurface::CTiglRoundedSegmentSurface(const std::vector &profileCurves , + const std::vector &inner_rounding_distance, + const std::vector &outer_rounding_distance): + m_inner_rounding_distance(inner_rounding_distance), + m_outer_rounding_distance(outer_rounding_distance), + m_segments({}), + m_surface(nullptr) + { + + m_profileCurves.reserve(profileCurves.size()); + for (Handle(Geom_Curve) curve : profileCurves) { + m_profileCurves.push_back(GeomConvert::CurveToBSplineCurve(curve)); + } + + CTiglBSplineAlgorithms::matchDegree(m_profileCurves); + + m_pole_matrix = TColgp_Array2OfPnt(1,m_profileCurves.size()+(m_profileCurves.size()-2)*6,1, (m_profileCurves[0]->NbPoles())); + m_u_knots = TColStd_Array1OfReal(1,m_profileCurves[0]->NbKnots()); + m_v_knots = TColStd_Array1OfReal(1, m_pole_matrix.ColLength()-_v_degree+1); + m_u_multiplicities = m_profileCurves[0]->Multiplicities(); + m_v_multiplicities= TColStd_HArray1OfInteger(1, m_pole_matrix.ColLength()-_v_degree+1, 1); +} + +TIGL_EXPORT Handle(Geom_BSplineSurface) CTiglRoundedSegmentSurface::Surface(){ + + Perform(); + + auto surface = new Geom_BSplineSurface(m_pole_matrix, m_v_knots, m_u_knots, m_v_multiplicities, m_u_multiplicities,_v_degree, _u_degree, false, false); + return surface; +} + +void CTiglRoundedSegmentSurface::Perform(){ + if (_hasPerformed) { + return; + } + + //create knots in v-direction + auto nb_v_knots = m_pole_matrix.ColLength()-_v_degree+1; + std::vector tmp_v = LinspaceWithBreaks(0., 1., nb_v_knots,{}); + for(int i=1;iKnots(); + if (m_u_multiplicities.Length()==2){ + _u_degree =m_profileCurves[0]->Degree(); + } else { + m_u_multiplicities = m_profileCurves[0]->Multiplicities(); + } + + //initialize m_segments vector + for(int i = 0; i < m_profileCurves.size()-1; i++){ + m_segments.push_back(RoundedSegment(m_profileCurves[i], + m_profileCurves[i+1], + m_inner_rounding_distance[i], + m_outer_rounding_distance[i])); + } + + //Write poles in pole matrix + int row=1; //counter for inserted rows + for(RoundedSegment seg: m_segments){ + //fill pole matrix + for( int col = 1;col< m_profileCurves[0]->NbPoles()+1; col++){ + m_pole_matrix.SetValue(row,col,seg.get_first_profile().Value(col)); + } + row++; + for(TColgp_HArray1OfPnt profile: seg.getDummyProfiles()){ + for( int col = 1;col< m_profileCurves[0]->NbPoles()+1; col++){ + m_pole_matrix.SetValue(row,col,profile.Value(col)); + } + row++; + } + if(row==m_pole_matrix.ColLength()){ + + for( int col = 1;col< m_profileCurves[0]->NbPoles()+1; col++){ + m_pole_matrix.SetValue(row,col,seg.get_last_profile().Value(col)); + } + } + } + //Check if number of rows matches expected total number of profile curves + if (row + +namespace tigl { +/** + * @brief This class can be used to create a surface from a given set of profile curves, + * that is rounded in two seperate definable distances to each side of the profile: + * The 'innerRoundingDistance', and 'outerRoundingDistance' + * In case of an aircraft wing 'inner' refers to the direction from profile curve to fuselage, + * 'outer' refers to the direction from profile curve to wing tip. + */ +class CTiglRoundedSegmentSurface +{ +public: + /** + * @brief CTiglRoundedSegmentSurface + * Surface skinning algorithm to create a loft for a given set of + * profile curves with rounded sections. + * @param m_profileCurves + * @param inner_rounding_distance Vector of numbers between 0.< 1. per section + * with a size of m_profileCurves.size()-2 + * (outer section has no inner rounding distance) + * @param outer_rounding_distance Vector of numbers between 0.< 1. per section + * with a size of m_profileCurves.size()-2 + * (inner section has no outer rounding distance) + */ + TIGL_EXPORT CTiglRoundedSegmentSurface(const std::vector &m_profileCurves, + const std::vector &inner_rounding_distance, + const std::vector &outer_rounding_distance); + + TIGL_EXPORT Handle(Geom_BSplineSurface) Surface(); + +private: + + TIGL_EXPORT void Perform(); + + + /** + * @brief The RoundedSegment class + * A Rounded Segment is a helper container to simplify keeping the order of the profile + * and 'dummy-curves' when creating the required pole matrix for the lofting-algorithm. + * + * It represents one sement, with first and last profile and two rounding distances. + * From these parameters it takes care of creating the poles of 3 dummy-profile curves + * for each direction, 'inner' and 'outer', given they are greater than zero. + */ + struct RoundedSegment + { + TColgp_HArray1OfPnt firstProfile; + TColgp_HArray1OfPnt lastProfile; + std::vector dummyProfiles; + double inner_rounding_distance; + double outer_rounding_distance; + + RoundedSegment(Handle(Geom_BSplineCurve) const& start, + Handle(Geom_BSplineCurve) const& end, + double inner_rd, + double outer_rd): + firstProfile(1,start->NbPoles()), + lastProfile(1,start->NbPoles()), + dummyProfiles({}), + inner_rounding_distance(inner_rd), + outer_rounding_distance(outer_rd) + { + for(int i = 1; i < start->NbPoles()+1; i++){ + firstProfile.SetValue(i,start->Pole(i)); + lastProfile.SetValue(i,end->Pole(i)); + } + if(inner_rounding_distance>1e-6){ + insert_inner_rows(3); + } + if(outer_rounding_distance>1e-6){ + insert_outer_rows(3); + } + } + + void insert_inner_rows(int nb_dummies) { + for (int i = 0; i < nb_dummies; i++) { + auto row = new TColgp_HArray1OfPnt(1, firstProfile.Size()); + // for every profile point in start profile + for(int j = 1; j< firstProfile.Size()+1; j++){ + //calculate Vector between both profile poles and normalize it + gp_Vec vector_in_v_direction(firstProfile.Value(j), lastProfile.Value(j)); //v01 + gp_Vec normalized_vector_in_v_direction(vector_in_v_direction); + // interpolate relative position between the point in the start and end profiles for the ith dummy profile + // append interpolated point to row + double inner_distance = inner_rounding_distance/nb_dummies*(i+1); + gp_Vec inner_pole_vec(firstProfile.Value(j).Coord().X(),firstProfile.Value(j).Coord().Y(),firstProfile.Value(j).Coord().Z()); + //save new poles in a vector for each inner dummy profile + gp_Vec inner_vec(normalized_vector_in_v_direction); + inner_vec.Scale(inner_distance); //scaled normalized vector in v-direction + inner_vec.Add(inner_pole_vec); //vector to new k-th pole + gp_Pnt new_pole_inner(inner_vec.XYZ()); + row->SetValue(j, new_pole_inner); + } + dummyProfiles.push_back(*row); + } + } + + void insert_outer_rows(int nb_dummies) { + for (int i = 0; i < nb_dummies; i++) { + auto row = new TColgp_HArray1OfPnt(1, firstProfile.Size()); + for (int j=1; j < firstProfile.Size()+1; j++){ + //calculate Vector between both profile poles and normalize it + gp_Vec vector_in_v_direction(firstProfile.Value(j), lastProfile.Value(j)); //v01 + gp_Vec normalized_vector_in_v_direction(vector_in_v_direction); + //calculate distance between k-th outer dummy-pole in v-direction and profile + double outer_distance = (outer_rounding_distance/nb_dummies) * (nb_dummies-i); + gp_Vec outer_vec(lastProfile.Value(j).Coord().X(), + lastProfile.Value(j).Coord().Y(), + lastProfile.Value(j).Coord().Z()); + gp_Vec outer_normalized_vec(normalized_vector_in_v_direction); + outer_normalized_vec.Scale(outer_distance); //scaled normalized vector in v-direction + outer_vec.Subtract(outer_normalized_vec); + gp_Pnt new_pole_outer(outer_vec.XYZ()); + //save new poles in a vector for each outer dummy profile + row->SetValue(j, new_pole_outer); + } + dummyProfiles.push_back(*row); + } + } + + TColgp_HArray1OfPnt get_first_profile(){ + return firstProfile; + } + TColgp_HArray1OfPnt get_last_profile(){ + return lastProfile; + } + std::vector getDummyProfiles(){ + return dummyProfiles; + } + + + }; + + TIGL_EXPORT void Invalidate() { _hasPerformed = false; } + +private: + // Rows represent the poles of the given profile curves (u-direction) and dummy curves + // Columns represent the poles of the curves in v-direction + TColgp_Array2OfPnt m_pole_matrix; + + // Knots and poles in u_direction are equal to the profile curves' knots and pole + TColStd_Array1OfReal m_u_knots; + + // The knots are distributed linearly, the number of knots is calculated als follows: + // number of poles - curve degree + 1 + // This already takes into account: The number of multiplicities at the start + // and the end of the curve must be 4, else 1 + + TColStd_Array1OfReal m_v_knots; + + // Multiplicities in u_direction are equal to the profile curves' multiplicities + TColStd_HArray1OfInteger m_u_multiplicities; + + // Multiplicites in v_direction are 4 at start and end of the curve, else 1 + // The number of multiplicities must be equal to the number of + TColStd_HArray1OfInteger m_v_multiplicities; + + // Stores given inner and outer rounding distance per segment! + // This means: + // First Segment gets an inner rounding distance of 0. -> first entry in this list is 0. + // analogue: Last segment gets a outer rounding distance of 0. -> last entry in this list is 0. + std::vector m_inner_rounding_distance; + std::vector m_outer_rounding_distance; + + // The given profile curves (or list of edges of the profile curves) + std::vector m_profileCurves; + + // A list of rounded segments is used to create the pole_matrix + std::vector m_segments; + Handle(Geom_BSplineSurface) m_surface; + + bool _hasPerformed = false; + int _maxDegree = 3; + int _u_degree = 3; + int _v_degree = 3; + size_t _nb_dummies =3; //Rows per rounding distance + + +}; + +} +#endif // CTIGLROUNDEDSEGMENTSURFACE_H diff --git a/src/wing/CTiglWingBuilder.cpp b/src/wing/CTiglWingBuilder.cpp index d3b8090e3..1bfa266f3 100644 --- a/src/wing/CTiglWingBuilder.cpp +++ b/src/wing/CTiglWingBuilder.cpp @@ -61,13 +61,37 @@ PNamedShape CTiglWingBuilder::BuildShape() CTiglMakeLoft lofter; lofter.setMakeSolid(true); + std::vector innerRoundingDistance; + std::vector outerRoundingDistance; for (int i=1; i <= segments.GetSegmentCount(); i++) { const TopoDS_Shape& startWire = segments.GetSegment(i).GetInnerWire(); + if (hasBluntTE != segments.GetSegment(i).GetInnerConnection().GetProfile().HasBluntTE()) { throw CTiglError("Cannot mix profiles with blunt and sharp trailing edges in one wing.", TIGL_ERROR); } lofter.addProfiles(startWire); + + //Check if Segments are rounded, if so add distances to lofter + if(_wing.GetRoundedSegments()){ + double ird,ord; + if(segments.GetSegment(i).GetInnerRoundingDistance()){ + ird = *segments.GetSegment(i).GetInnerRoundingDistance(); + innerRoundingDistance.push_back(ird); + } else { + innerRoundingDistance.push_back(0.); + } + if(segments.GetSegment(i).GetOuterRoundingDistance()){ + ord = *segments.GetSegment(i).GetOuterRoundingDistance(); + outerRoundingDistance.push_back(ord); + } else { + outerRoundingDistance.push_back(0.); + } + } + + lofter.setInnerRoundingDistance(innerRoundingDistance); + lofter.setOuterRoundingDistance(outerRoundingDistance); + } TopoDS_Wire endWire = segments.GetSegment(segments.GetSegmentCount()).GetOuterWire(); diff --git a/tests/TestData/simpletest-roundedSegmentSurface.cpacs.xml b/tests/TestData/simpletest-roundedSegmentSurface.cpacs.xml new file mode 100644 index 000000000..369390f82 --- /dev/null +++ b/tests/TestData/simpletest-roundedSegmentSurface.cpacs.xml @@ -0,0 +1,520 @@ + + +
+ Cpacs2Test + 0.2.0 + + + 3.0 + Martin Siggel + Simple Wing for unit testing + 2012-10-09T15:12:47 + + + 3.0 + cpacs2to3 + Converted to cpacs 3.0 using cpacs2to3 - does not include structure update + 2018-01-15T09:22:57 + + +
+ + + + Cpacs2Test + + 1 + 1 + + 0 + 0 + 0 + + + + + name + description + + + 1.0 + 0.5 + 0.5 + + + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + + + +
+ D150_Fuselage_1Section1 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section1 + fuselageCircleProfileuID + + + 1.0 + 1.0 + 1.0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section2 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0.5 + 0 + 0 + + + + + D150_Fuselage_1Section2 + fuselageCircleProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section3 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section3 + fuselageCircleProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ + + D150_Fuselage_1Positioning1 + -0.5 + 90 + 0 + D150_Fuselage_1Section1ID + + + D150_Fuselage_1Positioning3 + 2 + 90 + 0 + D150_Fuselage_1Section1ID + D150_Fuselage_1Section3ID + + + + + D150_Fuselage_1Segment2 + D150_Fuselage_1Section1IDElement1 + D150_Fuselage_1Section2IDElement1 + + + D150_Fuselage_1Segment3 + D150_Fuselage_1Section2IDElement1 + D150_Fuselage_1Section3IDElement1 + + +
+
+ + + Wing + SimpleFuselage + This wing has been generated to test CATIA2CPACS. + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + +
+ Cpacs2Test - Wing Section 1 + Cpacs2Test - Wing Section 1 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 1 Main Element + Cpacs2Test - Wing Section 1 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 2 + Cpacs2Test - Wing Section 2 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test - Wing Section 2 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 3 + Cpacs2Test - Wing Section 3 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test - Wing Section 3 Main Element + NACA0012 + + + 0.5 + 0.5 + 0.5 + + + 0 + 0 + 0 + + + 0.5 + 0 + 0 + + + + +
+
+ + + Cpacs2Test - Wing Section 1 Positioning + Cpacs2Test - Wing Section 1 Positioning + 0 + 0 + 0 + Cpacs2Test_Wing_Sec1 + + + Cpacs2Test - Wing Section 2 Positioning + Cpacs2Test - Wing Section 2 Positioning + 1 + 0 + 0 + Cpacs2Test_Wing_Sec1 + Cpacs2Test_Wing_Sec2 + + + Cpacs2Test - Wing Section 3 Positioning + Cpacs2Test - Wing Section 3 Positioning + 1 + 0 + 0 + Cpacs2Test_Wing_Sec2 + Cpacs2Test_Wing_Sec3 + + + + + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec2_El1 + 0.2 + + + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test_Wing_Sec2_El1 + Cpacs2Test_Wing_Sec3_El1 + 0.3 + + + + + Wing_CS1 + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec3_El1 + + + + + MySkinMat + 0.0 + + + + + + + MyCellMat + 0.0 + + + + 0.8 + 0.8 + + + 1.0 + 1.0 + + + + 0 + WING_CS1 + + + 0 + WING_CS1 + + + + + 0.5 + WING_CS1 + + + 0.5 + WING_CS1 + + + + + + + + + MySkinMat + + + + + + +
+
+
+
+ + + + NACA0.00.00.12 + NACA 4 Series Profile + + 1.0;0.9875;0.975;0.9625;0.95;0.9375;0.925;0.9125;0.9;0.8875;0.875;0.8625;0.85;0.8375;0.825;0.8125;0.8;0.7875;0.775;0.7625;0.75;0.7375;0.725;0.7125;0.7;0.6875;0.675;0.6625;0.65;0.6375;0.625;0.6125;0.6;0.5875;0.575;0.5625;0.55;0.5375;0.525;0.5125;0.5;0.4875;0.475;0.4625;0.45;0.4375;0.425;0.4125;0.4;0.3875;0.375;0.3625;0.35;0.3375;0.325;0.3125;0.3;0.2875;0.275;0.2625;0.25;0.2375;0.225;0.2125;0.2;0.1875;0.175;0.1625;0.15;0.1375;0.125;0.1125;0.1;0.0875;0.075;0.0625;0.05;0.0375;0.025;0.0125;0.0;0.0125;0.025;0.0375;0.05;0.0625;0.075;0.0875;0.1;0.1125;0.125;0.1375;0.15;0.1625;0.175;0.1875;0.2;0.2125;0.225;0.2375;0.25;0.2625;0.275;0.2875;0.3;0.3125;0.325;0.3375;0.35;0.3625;0.375;0.3875;0.4;0.4125;0.425;0.4375;0.45;0.4625;0.475;0.4875;0.5;0.5125;0.525;0.5375;0.55;0.5625;0.575;0.5875;0.6;0.6125;0.625;0.6375;0.65;0.6625;0.675;0.6875;0.7;0.7125;0.725;0.7375;0.75;0.7625;0.775;0.7875;0.8;0.8125;0.825;0.8375;0.85;0.8625;0.875;0.8875;0.9;0.9125;0.925;0.9375;0.95;0.9625;0.975;0.9875;1.0 + 0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0 + -0.00126;-0.0030004180415;-0.00471438572941;-0.00640256842113;-0.00806559133343;-0.00970403933653;-0.0113184567357;-0.0129093470398;-0.0144771727147;-0.0160223549226;-0.0175452732434;-0.0190462653789;-0.0205256268372;-0.0219836105968;-0.0234204267471;-0.024836242105;-0.0262311798047;-0.0276053188583;-0.0289586936852;-0.0302912936071;-0.0316030623052;-0.0328938972373;-0.0341636490097;-0.0354121207001;-0.0366390671268;-0.0378441940595;-0.0390271573644;-0.0401875620783;-0.0413249614032;-0.042438855614;-0.043528690869;-0.0445938579126;-0.0456336906587;-0.04664746464;-0.0476343953088;-0.0485936361694;-0.0495242767241;-0.0504253402064;-0.0512957810767;-0.0521344822472;-0.0529402520006;-0.0537118205596;-0.0544478362583;-0.0551468612564;-0.0558073667285;-0.0564277274483;-0.0570062156697;-0.0575409941929;-0.0580301084765;-0.0584714776309;-0.0588628840933;-0.059201961739;-0.0594861821311;-0.0597128385384;-0.059879027262;-0.0599816256958;-0.060017266394;-0.059982306219;-0.05987278938;-0.0596844028137;-0.059412421875;-0.059051643633;-0.0585963041308;-0.0580399746271;-0.0573754299024;-0.0565944788455;-0.0556877432118;-0.054644363746;-0.0534516022043;-0.0520942903127;-0.0505540468987;-0.0488081315259;-0.0468277042382;-0.0445750655553;-0.0419990347204;-0.0390266537476;-0.0355468568262;-0.0313738751622;-0.0261471986426;-0.0189390266528;0.0;0.0189390266528;0.0261471986426;0.0313738751622;0.0355468568262;0.0390266537476;0.0419990347204;0.0445750655553;0.0468277042382;0.0488081315259;0.0505540468987;0.0520942903127;0.0534516022043;0.054644363746;0.0556877432118;0.0565944788455;0.0573754299024;0.0580399746271;0.0585963041308;0.059051643633;0.059412421875;0.0596844028137;0.05987278938;0.059982306219;0.060017266394;0.0599816256958;0.059879027262;0.0597128385384;0.0594861821311;0.059201961739;0.0588628840933;0.0584714776309;0.0580301084765;0.0575409941929;0.0570062156697;0.0564277274483;0.0558073667285;0.0551468612564;0.0544478362583;0.0537118205596;0.0529402520006;0.0521344822472;0.0512957810767;0.0504253402064;0.0495242767241;0.0485936361694;0.0476343953088;0.04664746464;0.0456336906587;0.0445938579126;0.043528690869;0.042438855614;0.0413249614032;0.0401875620783;0.0390271573644;0.0378441940595;0.0366390671268;0.0354121207001;0.0341636490097;0.0328938972373;0.0316030623052;0.0302912936071;0.0289586936852;0.0276053188583;0.0262311798047;0.024836242105;0.0234204267471;0.0219836105968;0.0205256268372;0.0190462653789;0.0175452732434;0.0160223549226;0.0144771727147;0.0129093470398;0.0113184567357;0.00970403933653;0.00806559133343;0.00640256842113;0.00471438572941;0.0030004180415;0.00126 + + + + + + Circle + Profile build up from set of Points on Circle where may Dimensions are 1..-1 + + 0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0 + 0.0;0.0774924206719;0.154518792808;0.230615870742;0.305325997695;0.378199858172;0.4487991802;0.516699371152;0.581492071288;0.642787609687;0.700217347767;0.753435896328;0.802123192755;0.84598642592;0.884761797177;0.91821610688;0.946148156876;0.968389960528;0.984807753012;0.995302795793;0.999811970449;0.998308158271;0.990800403365;0.977333858251;0.957989512315;0.932883704732;0.902167424781;0.866025403784;0.824675004109;0.778364911924;0.727373641573;0.672007860556;0.612600545193;0.549508978071;0.483112599297;0.413810724505;0.342020143326;0.268172612761;0.192712260548;0.116092914125;0.0387753712568;-0.0387753712568;-0.116092914125;-0.192712260548;-0.268172612761;-0.342020143326;-0.413810724505;-0.483112599297;-0.549508978071;-0.612600545193;-0.672007860556;-0.727373641573;-0.778364911924;-0.824675004109;-0.866025403784;-0.902167424781;-0.932883704732;-0.957989512315;-0.977333858251;-0.990800403365;-0.998308158271;-0.999811970449;-0.995302795793;-0.984807753012;-0.968389960528;-0.946148156876;-0.91821610688;-0.884761797177;-0.84598642592;-0.802123192755;-0.753435896328;-0.700217347767;-0.642787609687;-0.581492071288;-0.516699371152;-0.4487991802;-0.378199858172;-0.305325997695;-0.230615870742;-0.154518792808;-0.0774924206719;0.0 + 1.0;0.996992941168;0.987989849477;0.97304487058;0.952247885338;0.925723969269;0.893632640323;0.85616689953;0.813552070263;0.766044443119;0.713929734558;0.657521368569;0.597158591703;0.533204432802;0.466043519703;0.396079766039;0.323733942058;0.249441144058;0.173648177667;0.0968108707032;0.0193913317718;-0.0581448289105;-0.13533129975;-0.211703872229;-0.286803232711;-0.360177724805;-0.431386065681;-0.5;-0.565606875487;-0.627812124672;-0.686241637869;-0.740544013109;-0.790392669519;-0.835487811413;-0.875558231302;-0.910362940966;-0.939692620786;-0.963370878616;-0.981255310627;-0.993238357742;-0.999247952504;-0.999247952504;-0.993238357742;-0.981255310627;-0.963370878616;-0.939692620786;-0.910362940966;-0.875558231302;-0.835487811413;-0.790392669519;-0.740544013109;-0.686241637869;-0.627812124672;-0.565606875487;-0.5;-0.431386065681;-0.360177724805;-0.286803232711;-0.211703872229;-0.13533129975;-0.0581448289105;0.0193913317718;0.0968108707032;0.173648177667;0.249441144058;0.323733942058;0.396079766039;0.466043519703;0.533204432802;0.597158591703;0.657521368569;0.713929734558;0.766044443119;0.813552070263;0.85616689953;0.893632640323;0.925723969269;0.952247885338;0.97304487058;0.987989849477;0.996992941168;1.0 + + + + +
+ + + + halfCube + 10.0 + 1. + + + +
diff --git a/tests/TestData/simpletest-roundedSegmentSurface2.cpacs.xml b/tests/TestData/simpletest-roundedSegmentSurface2.cpacs.xml new file mode 100644 index 000000000..454b6e451 --- /dev/null +++ b/tests/TestData/simpletest-roundedSegmentSurface2.cpacs.xml @@ -0,0 +1,573 @@ + + +
+ Cpacs2Test + 0.2.0 + + + 3.0 + Martin Siggel + Simple Wing for unit testing + 2012-10-09T15:12:47 + + + 3.0 + cpacs2to3 + Converted to cpacs 3.0 using cpacs2to3 - does not include structure update + 2018-01-15T09:22:57 + + +
+ + + + Cpacs2Test + + 1 + 1 + + 0 + 0 + 0 + + + + + name + description + + + 1.0 + 0.5 + 0.5 + + + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + + + +
+ D150_Fuselage_1Section1 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section1 + fuselageCircleProfileuID + + + 1.0 + 1.0 + 1.0 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section2 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0.5 + 0 + 0 + + + + + D150_Fuselage_1Section2 + fuselageCircleProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ D150_Fuselage_1Section3 + + + 1.0 + 1.0 + 1.0 + + + 0.0 + 0.0 + 0.0 + + + 0 + 0 + 0 + + + + + D150_Fuselage_1Section3 + fuselageCircleProfileuID + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ + + D150_Fuselage_1Positioning1 + -0.5 + 90 + 0 + D150_Fuselage_1Section1ID + + + D150_Fuselage_1Positioning3 + 2 + 90 + 0 + D150_Fuselage_1Section1ID + D150_Fuselage_1Section3ID + + + + + D150_Fuselage_1Segment2 + D150_Fuselage_1Section1IDElement1 + D150_Fuselage_1Section2IDElement1 + + + D150_Fuselage_1Segment3 + D150_Fuselage_1Section2IDElement1 + D150_Fuselage_1Section3IDElement1 + + +
+
+ + + Wing + SimpleFuselage + This wing has been generated to test CATIA2CPACS. + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + +
+ Cpacs2Test - Wing Section 1 + Cpacs2Test - Wing Section 1 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 1 Main Element + Cpacs2Test - Wing Section 1 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 2 + Cpacs2Test - Wing Section 2 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test - Wing Section 2 Main Element + NACA0012 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 3 + Cpacs2Test - Wing Section 3 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test - Wing Section 3 Main Element + NACA0012 + + + 0.5 + 0.5 + 0.5 + + + 0 + 0 + 0 + + + 0.75 + 0.0 + 0 + + + + +
+
+ Cpacs2Test - Wing Section 4 + Cpacs2Test - Wing Section 4 + + + 1 + 1 + 1 + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + + + Cpacs2Test - Wing Section 4 Main Element + Cpacs2Test - Wing Section 4 Main Element + NACA0012 + + + 0.25 + 0.25 + 0.25 + + + 0 + 0 + 0 + + + 1.0 + 2.25 + 0.0 + + + + +
+
+ + + Cpacs2Test - Wing Section 1 Positioning + Cpacs2Test - Wing Section 1 Positioning + 0 + 0 + 0 + Cpacs2Test_Wing_Sec1 + + + Cpacs2Test - Wing Section 2 Positioning + Cpacs2Test - Wing Section 2 Positioning + 1 + 0 + 0 + Cpacs2Test_Wing_Sec1 + Cpacs2Test_Wing_Sec2 + + + Cpacs2Test - Wing Section 3 Positioning + Cpacs2Test - Wing Section 3 Positioning + 1 + 0 + 0 + Cpacs2Test_Wing_Sec2 + Cpacs2Test_Wing_Sec3 + + + + + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 1 Main Element to Cpacs2Test - Wing Section 2 Main Element + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec2_El1 + 0.2 + + + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test_Wing_Sec2_El1 + Cpacs2Test_Wing_Sec3_El1 + 0.3 + 0.2 + + + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Fuselage Segment from Cpacs2Test - Wing Section 2 Main Element to Cpacs2Test - Wing Section 3 Main Element + Cpacs2Test_Wing_Sec3_El1 + Cpacs2Test_Wing_Sec4_El1 + 0.3 + + + + + Wing_CS1 + Cpacs2Test_Wing_Sec1_El1 + Cpacs2Test_Wing_Sec3_El1 + + + + + MySkinMat + 0.0 + + + + + + + MyCellMat + 0.0 + + + + 0.8 + 0.8 + + + 1.0 + 1.0 + + + + 0 + WING_CS1 + + + 0 + WING_CS1 + + + + + 0.5 + WING_CS1 + + + 0.5 + WING_CS1 + + + + + + + + + MySkinMat + + + + + + +
+
+
+
+ + + + NACA0.00.00.12 + NACA 4 Series Profile + + 1.0;0.9875;0.975;0.9625;0.95;0.9375;0.925;0.9125;0.9;0.8875;0.875;0.8625;0.85;0.8375;0.825;0.8125;0.8;0.7875;0.775;0.7625;0.75;0.7375;0.725;0.7125;0.7;0.6875;0.675;0.6625;0.65;0.6375;0.625;0.6125;0.6;0.5875;0.575;0.5625;0.55;0.5375;0.525;0.5125;0.5;0.4875;0.475;0.4625;0.45;0.4375;0.425;0.4125;0.4;0.3875;0.375;0.3625;0.35;0.3375;0.325;0.3125;0.3;0.2875;0.275;0.2625;0.25;0.2375;0.225;0.2125;0.2;0.1875;0.175;0.1625;0.15;0.1375;0.125;0.1125;0.1;0.0875;0.075;0.0625;0.05;0.0375;0.025;0.0125;0.0;0.0125;0.025;0.0375;0.05;0.0625;0.075;0.0875;0.1;0.1125;0.125;0.1375;0.15;0.1625;0.175;0.1875;0.2;0.2125;0.225;0.2375;0.25;0.2625;0.275;0.2875;0.3;0.3125;0.325;0.3375;0.35;0.3625;0.375;0.3875;0.4;0.4125;0.425;0.4375;0.45;0.4625;0.475;0.4875;0.5;0.5125;0.525;0.5375;0.55;0.5625;0.575;0.5875;0.6;0.6125;0.625;0.6375;0.65;0.6625;0.675;0.6875;0.7;0.7125;0.725;0.7375;0.75;0.7625;0.775;0.7875;0.8;0.8125;0.825;0.8375;0.85;0.8625;0.875;0.8875;0.9;0.9125;0.925;0.9375;0.95;0.9625;0.975;0.9875;1.0 + 0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0 + -0.00126;-0.0030004180415;-0.00471438572941;-0.00640256842113;-0.00806559133343;-0.00970403933653;-0.0113184567357;-0.0129093470398;-0.0144771727147;-0.0160223549226;-0.0175452732434;-0.0190462653789;-0.0205256268372;-0.0219836105968;-0.0234204267471;-0.024836242105;-0.0262311798047;-0.0276053188583;-0.0289586936852;-0.0302912936071;-0.0316030623052;-0.0328938972373;-0.0341636490097;-0.0354121207001;-0.0366390671268;-0.0378441940595;-0.0390271573644;-0.0401875620783;-0.0413249614032;-0.042438855614;-0.043528690869;-0.0445938579126;-0.0456336906587;-0.04664746464;-0.0476343953088;-0.0485936361694;-0.0495242767241;-0.0504253402064;-0.0512957810767;-0.0521344822472;-0.0529402520006;-0.0537118205596;-0.0544478362583;-0.0551468612564;-0.0558073667285;-0.0564277274483;-0.0570062156697;-0.0575409941929;-0.0580301084765;-0.0584714776309;-0.0588628840933;-0.059201961739;-0.0594861821311;-0.0597128385384;-0.059879027262;-0.0599816256958;-0.060017266394;-0.059982306219;-0.05987278938;-0.0596844028137;-0.059412421875;-0.059051643633;-0.0585963041308;-0.0580399746271;-0.0573754299024;-0.0565944788455;-0.0556877432118;-0.054644363746;-0.0534516022043;-0.0520942903127;-0.0505540468987;-0.0488081315259;-0.0468277042382;-0.0445750655553;-0.0419990347204;-0.0390266537476;-0.0355468568262;-0.0313738751622;-0.0261471986426;-0.0189390266528;0.0;0.0189390266528;0.0261471986426;0.0313738751622;0.0355468568262;0.0390266537476;0.0419990347204;0.0445750655553;0.0468277042382;0.0488081315259;0.0505540468987;0.0520942903127;0.0534516022043;0.054644363746;0.0556877432118;0.0565944788455;0.0573754299024;0.0580399746271;0.0585963041308;0.059051643633;0.059412421875;0.0596844028137;0.05987278938;0.059982306219;0.060017266394;0.0599816256958;0.059879027262;0.0597128385384;0.0594861821311;0.059201961739;0.0588628840933;0.0584714776309;0.0580301084765;0.0575409941929;0.0570062156697;0.0564277274483;0.0558073667285;0.0551468612564;0.0544478362583;0.0537118205596;0.0529402520006;0.0521344822472;0.0512957810767;0.0504253402064;0.0495242767241;0.0485936361694;0.0476343953088;0.04664746464;0.0456336906587;0.0445938579126;0.043528690869;0.042438855614;0.0413249614032;0.0401875620783;0.0390271573644;0.0378441940595;0.0366390671268;0.0354121207001;0.0341636490097;0.0328938972373;0.0316030623052;0.0302912936071;0.0289586936852;0.0276053188583;0.0262311798047;0.024836242105;0.0234204267471;0.0219836105968;0.0205256268372;0.0190462653789;0.0175452732434;0.0160223549226;0.0144771727147;0.0129093470398;0.0113184567357;0.00970403933653;0.00806559133343;0.00640256842113;0.00471438572941;0.0030004180415;0.00126 + + + + + + Circle + Profile build up from set of Points on Circle where may Dimensions are 1..-1 + + 0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0 + 0.0;0.0774924206719;0.154518792808;0.230615870742;0.305325997695;0.378199858172;0.4487991802;0.516699371152;0.581492071288;0.642787609687;0.700217347767;0.753435896328;0.802123192755;0.84598642592;0.884761797177;0.91821610688;0.946148156876;0.968389960528;0.984807753012;0.995302795793;0.999811970449;0.998308158271;0.990800403365;0.977333858251;0.957989512315;0.932883704732;0.902167424781;0.866025403784;0.824675004109;0.778364911924;0.727373641573;0.672007860556;0.612600545193;0.549508978071;0.483112599297;0.413810724505;0.342020143326;0.268172612761;0.192712260548;0.116092914125;0.0387753712568;-0.0387753712568;-0.116092914125;-0.192712260548;-0.268172612761;-0.342020143326;-0.413810724505;-0.483112599297;-0.549508978071;-0.612600545193;-0.672007860556;-0.727373641573;-0.778364911924;-0.824675004109;-0.866025403784;-0.902167424781;-0.932883704732;-0.957989512315;-0.977333858251;-0.990800403365;-0.998308158271;-0.999811970449;-0.995302795793;-0.984807753012;-0.968389960528;-0.946148156876;-0.91821610688;-0.884761797177;-0.84598642592;-0.802123192755;-0.753435896328;-0.700217347767;-0.642787609687;-0.581492071288;-0.516699371152;-0.4487991802;-0.378199858172;-0.305325997695;-0.230615870742;-0.154518792808;-0.0774924206719;0.0 + 1.0;0.996992941168;0.987989849477;0.97304487058;0.952247885338;0.925723969269;0.893632640323;0.85616689953;0.813552070263;0.766044443119;0.713929734558;0.657521368569;0.597158591703;0.533204432802;0.466043519703;0.396079766039;0.323733942058;0.249441144058;0.173648177667;0.0968108707032;0.0193913317718;-0.0581448289105;-0.13533129975;-0.211703872229;-0.286803232711;-0.360177724805;-0.431386065681;-0.5;-0.565606875487;-0.627812124672;-0.686241637869;-0.740544013109;-0.790392669519;-0.835487811413;-0.875558231302;-0.910362940966;-0.939692620786;-0.963370878616;-0.981255310627;-0.993238357742;-0.999247952504;-0.999247952504;-0.993238357742;-0.981255310627;-0.963370878616;-0.939692620786;-0.910362940966;-0.875558231302;-0.835487811413;-0.790392669519;-0.740544013109;-0.686241637869;-0.627812124672;-0.565606875487;-0.5;-0.431386065681;-0.360177724805;-0.286803232711;-0.211703872229;-0.13533129975;-0.0581448289105;0.0193913317718;0.0968108707032;0.173648177667;0.249441144058;0.323733942058;0.396079766039;0.466043519703;0.533204432802;0.597158591703;0.657521368569;0.713929734558;0.766044443119;0.813552070263;0.85616689953;0.893632640323;0.925723969269;0.952247885338;0.97304487058;0.987989849477;0.996992941168;1.0 + + + + +
+ + + + halfCube + 10.0 + 1. + + + +
diff --git a/tests/unittests/TestCTiglRoundedSegmentSurface.cpp b/tests/unittests/TestCTiglRoundedSegmentSurface.cpp new file mode 100644 index 000000000..a8b3b3de2 --- /dev/null +++ b/tests/unittests/TestCTiglRoundedSegmentSurface.cpp @@ -0,0 +1,178 @@ +#include "CCPACSWingSection.h" +#include "CTiglRoundedSegmentSurface.h" +#include "Debugging.h" +#include "test.h" +#include "tigl.h" +#include "tiglcommonfunctions.h" +#include "tixi.h" + +#include "CCPACSConfigurationManager.h" + +#include "CTiglMakeLoft.h" +#include "CTiglError.h" +#include "CCPACSConfigurationManager.h" +#include "CCPACSWing.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "CCPACSCurvePointListXYZ.h" +#include "CCPACSCurveParamPointMap.h" + + +TEST(TestCTiglRoundedSegmentSurface, make_minimal_Shape) +{ + std::vector profileCurves; + //Create Profile Curves Vector + TColgp_HArray1OfPnt u_poles(1,7); + u_poles.SetValue(1,gp_Pnt(1., 0., 0.)); + u_poles.SetValue(2,gp_Pnt(0.66, 0., -0.015)); + u_poles.SetValue(3,gp_Pnt(0., 0., -0.1)); + u_poles.SetValue(4,gp_Pnt(0., 0., 0.)); + u_poles.SetValue(5,gp_Pnt(0., 0., 0.1)); + u_poles.SetValue(6,gp_Pnt(0.33, 0., 0.05)); + u_poles.SetValue(7,gp_Pnt(1., 0., 0.)); + + TColgp_HArray1OfPnt u1_poles(1,7); + u1_poles.SetValue(1,gp_Pnt(1., 0., 0.)); + u1_poles.SetValue(2,gp_Pnt(0.66, 0., -0.015)); + u1_poles.SetValue(3,gp_Pnt(0., 0., -0.1)); + u1_poles.SetValue(4,gp_Pnt(0., 0., 0.)); + u1_poles.SetValue(5,gp_Pnt(0., 0., 0.1)); + u1_poles.SetValue(6,gp_Pnt(0.33, 0., 0.05)); + u1_poles.SetValue(7,gp_Pnt(1., 0., 0.)); + + TColgp_HArray1OfPnt u2_poles(1,7); + u2_poles.SetValue(1,gp_Pnt(1., 0., 0.)); + u2_poles.SetValue(2,gp_Pnt(0.66, 0., -0.015)); + u2_poles.SetValue(3,gp_Pnt(0., 0., -0.1)); + u2_poles.SetValue(4,gp_Pnt(0., 0., 0.)); + u2_poles.SetValue(5,gp_Pnt(0., 0., 0.1)); + u2_poles.SetValue(6,gp_Pnt(0.33, 0., 0.05)); + u2_poles.SetValue(7,gp_Pnt(1., 0., 0.)); + + + TColStd_Array1OfReal u_knots(1,3); + u_knots.SetValue(1,-1.); + u_knots.SetValue(2,0.); + u_knots.SetValue(3,1.); + + TColStd_Array1OfInteger u_mults(1,3); + u_mults.SetValue(1,4); + u_mults.SetValue(2,3); + u_mults.SetValue(3,4); + + int u_degree = 3; + + //Create three profiles for the loft + auto profile_root = new Geom_BSplineCurve(u_poles, u_knots, u_mults, u_degree); + profileCurves.push_back(profile_root); + + Handle(Geom_BSplineCurve) profile_mid = new Geom_BSplineCurve(u1_poles, u_knots, u_mults, u_degree); + //Scale by (0.66,1.,0.66) Translate by (0.2,0.5,0.) + for(int i= 1; i< profile_root->NbPoles() + 1;i++){ + double X = profile_mid->Poles().Value(i).Coord().X()*0.66+0.2; + double Y = profile_mid->Poles().Value(i).Coord().Y()*1.+0.5; + double Z = profile_mid->Poles().Value(i).Coord().Z()*0.66+0.; + gp_Pnt transformed_pole(X,Y,Z); + profile_mid->SetPole(i,transformed_pole); + } + + profileCurves.push_back(profile_mid); + + Handle(Geom_BSplineCurve) profile_tip = new Geom_BSplineCurve(u2_poles, u_knots, u_mults, u_degree); + //Scale by (0.2,1.,0.1) Translate by (1.,2.,0.) + for(int i= 1; i< profile_root->NbPoles() + 1;i++){ + double X = profile_tip->Poles().Value(i).Coord().X()*0.2+1.; + double Y = profile_tip->Poles().Value(i).Coord().Y()*1.+2.; + double Z = profile_tip->Poles().Value(i).Coord().Z()*0.1+0.; + gp_Pnt transformed_pole(X,Y,Z); + profile_tip->SetPole(i,transformed_pole); + } + + profileCurves.push_back(profile_tip); + + for(int i=0; i ird; + std::vector ord; + ird.push_back(0.); + ord.push_back(0.); + for(int i=1; i< profileCurves.size()-1; i++){ + ird.push_back(0.25); + ord.push_back(0.25); + } + ird.push_back(0.); + ord.push_back(0.); + + tigl::CTiglRoundedSegmentSurface lofter(profileCurves, ird, ord); + auto surface = lofter.Surface(); + // DEBUG DELETEME + Handle(Geom_Surface) handle_surface = surface; + TopoDS_Shape surf = BRepBuilderAPI_MakeFace(handle_surface, 1e-15); + tigl::dumpShape(surf, "makeLoftWing", "Surface",1); +} + +TEST(TestCTiglRoundedSegmentSurface, openCpacsTwoRoundedSegments){ + + const char* filename = "TestData/simpletest-roundedSegmentSurface.cpacs.xml"; + ReturnCode tixiRet; + TiglReturnCode tiglRet; + + TixiDocumentHandle tiglHandle = -1; + TiglCPACSConfigurationHandle tixiHandle = -1; + + + tiglHandle = -1; + tixiHandle = -1; + + tixiRet = tixiOpenDocument(filename, &tixiHandle); + ASSERT_TRUE (tixiRet == SUCCESS); + + tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "", &tiglHandle); + ASSERT_TRUE(tiglRet == TIGL_SUCCESS); + + tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); + tigl::CCPACSConfiguration& config = manager.GetConfiguration(tiglHandle); + auto wing = config.GetWing(1).GetLoftWithCutouts(); + ASSERT_TRUE(BRepCheck_Analyzer(wing).IsValid()); +} + + +TEST(TestCTiglRoundedSegmentSurface, openCpacsThreeRoundedSegments){ + + const char* filename = "TestData/simpletest-roundedSegmentSurface2.cpacs.xml"; + ReturnCode tixiRet; + TiglReturnCode tiglRet; + + TixiDocumentHandle tiglHandle = -1; + TiglCPACSConfigurationHandle tixiHandle = -1; + + + tiglHandle = -1; + tixiHandle = -1; + + tixiRet = tixiOpenDocument(filename, &tixiHandle); + ASSERT_TRUE (tixiRet == SUCCESS); + + tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "", &tiglHandle); + ASSERT_TRUE(tiglRet == TIGL_SUCCESS); + + tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); + tigl::CCPACSConfiguration& config = manager.GetConfiguration(tiglHandle); + auto wing = config.GetWing(1).GetLoftWithCutouts(); + ASSERT_TRUE(BRepCheck_Analyzer(wing).IsValid()); +} +