In contrast to rigid segments flexible duct is not a connection of multiple elements (straight segments and bends), instead a type of ducting pipe that could easily be bent in different angles. Since Archicad 28 there is a flexible pipe as well for liquids. FlexibleSegment either has a spline geometry defined by control points, or a polyline geometry, which is defined by alternating straight line parts and spline parts. Line parts are defined by their starting and ending coordinates, while spline parts are defined by control points. These alterning segments must start where the previous one ends. Polyline FlexibleSegemnts are only supported in the Piping domain. In the Ventilation domain FlexibleSegments can only be splines.
More...
#include <MEPFlexibleSegment.hpp>
In contrast to rigid segments flexible duct is not a connection of multiple elements (straight segments and bends), instead a type of ducting pipe that could easily be bent in different angles. Since Archicad 28 there is a flexible pipe as well for liquids. FlexibleSegment either has a spline geometry defined by control points, or a polyline geometry, which is defined by alternating straight line parts and spline parts. Line parts are defined by their starting and ending coordinates, while spline parts are defined by control points. These alterning segments must start where the previous one ends. Polyline FlexibleSegemnts are only supported in the Piping domain. In the Ventilation domain FlexibleSegments can only be splines.
- Since
- Archicad 27
- Example code snippet from Test / New MEP
- Getters
if (flexibleSegment.
IsErr ()) {
return;
}
Reporter reporter;
reporter.SetTabCount (0);
reporter.Add ("Control points:");
reporter.SetTabCount (1);
if (controlPoints.
IsErr ()) {
return;
}
reporter.Add (ToString (controlPoint));
reporter.AddNewLine ();
static Result< FlexibleSegment > Get(const UniqueID &uniqueId)
Returns a FlexibleSegment.
Result is the standard return type of API functions.
Definition: Result.hpp:845
E UnwrapErr() const
Unwraps the error value contained in the Result. Trying to UnwrapErr the value while it contains an O...
Definition: Result.hpp:1140
bool IsErr() const
Definition: Result.hpp:945
void ACAPI_WriteReport(const GS::UniString &format, bool withDial,...)
Writes a report string into the Report Windowot into a custom alert window.
Real (Cartesian) 3D coordinates of a three-dimensional space.
Definition: APIdefs_Base.h:108
Modification
if (flexibleSegment.
IsErr ()) {
}
if (
ACAPI::Result<std::vector<API_Coord3D>> controlPoints = flexibleSegment->GetControlPoints (); controlPoints.
IsOk ()) {
controlPoint.x += 1.0;
ACAPI::Result<void> modifyResult = flexibleSegment->Modify ([&](FlexibleSegment::Modifier& modifier) {
modifier.SetControlPoints (*controlPoints);
}, "Modify the control points of Flexible Segment.");
for (std::variant<FlexibleSegmentPolylineLinePart, FlexibleSegmentPolylineSplinePart>& polylinePart : *polyline) {
std::visit (GS::Overloaded {
[] (FlexibleSegmentPolylineLinePart& line) {
line.begin.x *= 2.0;
line.begin.y *= 2.0;
line.begin.z *= 2.0;
line.end.x *= 2.0;
line.end.y *= 2.0;
line.end.z *= 2.0;
},
[] (FlexibleSegmentPolylineSplinePart& spline) {
for (
API_Coord3D& controlPoint : spline.controlPoints) {
controlPoint.x *= 2.0;
controlPoint.y *= 2.0;
controlPoint.z *= 2.0;
}
}
}, polylinePart);
}
ACAPI::Result<void> modifyResult = flexibleSegment->Modify ([&](FlexibleSegment::Modifier& modifier) {
modifier.SetPolyline (*polyline);
}, "Modify the polyline of Flexible Segment.");
} else {
return Error;
}
return NoError;
bool IsOk() const
Definition: Result.hpp:940
◆ Get()
◆ GetControlPoints()
Result< std::vector< API_Coord3D > > ACAPI::MEP::v1::FlexibleSegment::GetControlPoints |
( |
| ) |
const |
- Returns
- Returns the control points of the FlexibleSegment if it is defined by a spline.
◆ GetDomain()
Domain ACAPI::MEP::v1::FlexibleSegment::GetDomain |
( |
| ) |
const |
Returns the domain of the FlexibleSegment.
- Returns
- The returned domain could only be ventilation.
◆ GetHeight()
double ACAPI::MEP::v1::FlexibleSegment::GetHeight |
( |
| ) |
const |
◆ GetPolyline()
- Returns
- Returns the polyline of the FlexibleSegment if it is defined by a polyline .
◆ GetWidth()
double ACAPI::MEP::v1::FlexibleSegment::GetWidth |
( |
| ) |
const |
◆ Inject()
Injects the Default settings into the FlexibleSegment.
- Parameters
-
flexibleSegmentDefault | The Default what will be injected. |
- Returns
- Returns an error if the injection fails for some reason, otherwise nothing.
◆ Modify()
template<typename ModifierFunc >
Result< void > ACAPI::MEP::v1::FlexibleSegment::Modify |
( |
const ModifierFunc & |
modifierFunc, |
|
|
const GS::UniString & |
undoString |
|
) |
| |
Executes the passed modifier scope in an Undoable command.
- Parameters
-
modifierFunc | The modifier scope (lambda, std::function or function pointer) the caller wants to execute. |
undoString | The text which appears in the undo queue of Archicad after executing the command. |
- Returns
- Returns an error if the process of modification fails for some reason, otherwise nothing.
◆ PickUpDefault()
◆ SetControlPoints()
Result< void > ACAPI::MEP::v1::FlexibleSegment::SetControlPoints |
( |
const std::vector< API_Coord3D > & |
controlPoints | ) |
|
Sets the FlexibleSegment's geometry to a spline.
- Parameters
-
controlPoints | The control points of the spline to be set. |
- Returns
- Returns an error if the points are invalid, for example:
- Control points are empty.
- Two adjacent points at the same location.
◆ SetHeight()
Result< void > ACAPI::MEP::v1::FlexibleSegment::SetHeight |
( |
double |
height | ) |
|
Sets the height of the FlexibleSegment.
- Parameters
-
height | The value to be set. |
- Returns
- Returns an error if the height is not positive, otherwise nothing.
◆ SetPolyline()
Sets the FlexibleSegment's geometry to a polyline.
- Parameters
-
polyline | The polyline to be set. |
- Returns
- Returns an error if the polyline is invalid, for example:
- Polyline is empty.
- Adjacent segments are of the same type.
- Adjacent starting/ending points don't connect.
- Setting polyline geometry on a Ventillation FlexibleSegment.
◆ SetWidth()
Result< void > ACAPI::MEP::v1::FlexibleSegment::SetWidth |
( |
double |
width | ) |
|
Sets the width of the FlexibleSegment.
- Parameters
-
width | The value to be set. |
- Returns
- Returns an error if the width is not positive, otherwise nothing.