Archicad 28 C++ API
Loading...
Searching...
No Matches
ACAPI::MEP::v1::RoutingSegment Class Referencefinal

The RoutingSegment can contain Rigid Segment elements. More...

#include <MEPRoutingSegment.hpp>

Inheritance diagram for ACAPI::MEP::v1::RoutingSegment:
ACAPI::v1::ElementBase ACAPI::v1::Object

Public Member Functions

double GetCrossSectionWidth () const
 
double GetCrossSectionHeight () const
 
ConnectorShape GetCrossSectionShape () const
 
Result< uint32_t > GetCrossSectionReferenceId () const
 
std::vector< UniqueIDGetRigidSegmentIds () const
 
UniqueID GetBeginNodeId () const
 
UniqueID GetEndNodeId () const
 
UniqueID GetRoutingElementId () const
 
Domain GetDomain () const
 
RoutingSegmentDefault PickUpDefault () const
 Picks up and returns the Default of the RoutingSegment.
 
RigidSegmentDefault GetRigidSegmentDefaultParameters () const
 
UniqueID GetPreferenceTableId () const
 
API_AnchorID GetAnchor () const
 
double GetReferenceLineOffsetX () const
 
double GetReferenceLineOffsetY () const
 
double GetWallThickness () const
 
ConnectionStyle GetConnectionStyle () const
 
std::optional< double > GetFlangeSize () const
 
template<typename ModifierFunc >
Result< void > Modify (const ModifierFunc &modifierFunc, const GS::UniString &undoString)
 Executes the passed modifier scope in an Undoable command.
 
Result< void > SetCrossSectionWidth (double width)
 Sets the width of the RoutingSegment.
 
Result< void > SetCrossSectionHeight (double height)
 Sets the height of the Routing Segment.
 
Result< void > SetCrossSectionShape (ConnectorShape shape)
 Sets the shape of the Routing Segment.
 
Result< void > SetCrossSectionReferenceId (uint32_t referenceId)
 Sets the referenceId of Circular Cross Section in the Routing Segment.
 
Result< void > Inject (const RoutingSegmentDefault &routingSegmentDefault)
 Injects the given Default settings to the RoutingSegment.
 
Result< void > SetRigidSegmentDefaultParameters (const RigidSegmentDefault &rigidSegmentDefault)
 Sets the parameters of the RigidSegments.
 
Result< void > SetPreferenceTableId (const UniqueID &uniqueId)
 Sets the PreferenceTable of the RoutingSegment.
 
void SetAnchor (API_AnchorID anchor)
 Sets the anchor position of the RoutingSegment.
 
void SetReferenceLineOffsetX (double offset)
 Sets the offset from the reference line along the X-axis of cross-section's plane.
 
void SetReferenceLineOffsetY (double offset)
 Sets the offset from the reference line along the Y-axis of cross-section's plane.
 
Result< void > SetWallThickness (double thickness)
 Sets the wall thickness of the RoutingSegment.
 
Result< void > SetConnectionStyle (ConnectionStyle connectionStyle)
 Sets the connection style of the RoutingSegment.
 
Result< void > SetFlangeSize (double flangeSize)
 Sets the flange size (width for Ventilation, diameter for Piping) of the RoutingSegment if its connection style is Flanged.
 
- Public Member Functions inherited from ACAPI::v1::ElementBase
UniqueID GetElemId () const
 Get unique identifier of the ElementBase object.
 
Result< void > IsEditable () const
 Checks whether the element is editable.
 
- Public Member Functions inherited from ACAPI::v1::Object
 Object (std::shared_ptr< Impl::ObjectImpl > impl)
 Constructs a new object.
 
const API_TokenGetToken () const
 Get the token for this object.
 

Static Public Member Functions

static Result< RoutingSegmentGet (const UniqueID &uniqueId)
 Returns a Routing Segment.
 

Additional Inherited Members

- Protected Member Functions inherited from ACAPI::v1::ElementBase
 ElementBase (std::shared_ptr< Impl::ObjectImpl > impl)
 Constructs a new ElementBase.
 
- Protected Member Functions inherited from ACAPI::v1::Object
 ~Object ()
 Default destructor.
 
- Protected Attributes inherited from ACAPI::v1::Object
std::shared_ptr< Impl::ObjectImplmImpl
 Impl object given by constructor.
 

Detailed Description

The RoutingSegment can contain Rigid Segment elements.

This type of element is placed between the corner points of RoutingElement.

Since
Archicad 27
Example code snippet from Test / New MEP
Getters
if (routingSegment.IsErr ()) {
ACAPI_WriteReport (routingSegment.UnwrapErr ().text.c_str (), false);
return;
}
Reporter routingSegmentReporter (1);
routingSegmentReporter.Add ("Routing Segment", id);
routingSegmentReporter.SetTabCount (2);
ConnectorShape shape = routingSegment->GetCrossSectionShape ();
routingSegmentReporter.Add ("Table of dimensions ID", routingSegment->GetPreferenceTableId ());
if (shape == ConnectorShape::Circular)
routingSegmentReporter.Add ("Reference ID", *routingSegment->GetCrossSectionReferenceId ());
routingSegmentReporter.Add ("Cross Section Shape", shape);
routingSegmentReporter.Add ("Cross Section Width", routingSegment->GetCrossSectionWidth ());
routingSegmentReporter.Add ("Cross Section Height", routingSegment->GetCrossSectionHeight ());
routingSegmentReporter.Add ("Wall thickness", routingSegment->GetWallThickness ());
routingSegmentReporter.Add ("Anchor", routingSegment->GetAnchor ());
routingSegmentReporter.Add ("Offset X", routingSegment->GetReferenceLineOffsetX ());
routingSegmentReporter.Add ("Offset Y", routingSegment->GetReferenceLineOffsetY ());
ConnectionStyle style = routingSegment->GetConnectionStyle ();
routingSegmentReporter.Add ("Connection style", style);
if (style == ConnectionStyle::Flanged)
routingSegmentReporter.Add (shape == ConnectorShape::Circular ? "Flange diameter" : "Flange width", *routingSegment->GetFlangeSize ());
routingSegmentReporter.Add ("Guid of Begin Node", routingSegment->GetBeginNodeId ());
routingSegmentReporter.Add ("Guid of End Node", routingSegment->GetEndNodeId ());
routingSegmentReporter.Write ();
// Rigid Segments
std::vector<UniqueID> rigidSegmentIds = routingSegment->GetRigidSegmentIds ();
if (!rigidSegmentIds.empty ()) {
ACAPI_WriteReport ("\t\tList of Rigid Segments:\n", false);
for (const UniqueID& id : rigidSegmentIds)
WriteRigidSegmentDetails (id);
}
The MEP unique identifier.
Definition: MEPUniqueID.hpp:30
std::optional< double > GetFlangeSize() const
static Result< RoutingSegment > Get(const UniqueID &uniqueId)
Returns a Routing Segment.
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.
ConnectionStyle
Style of the connection.
Definition: MEPEnums.hpp:41
ConnectorShape
Shape of the connector.
Definition: MEPEnums.hpp:28
Modification - Rectangular
double currentWidth = routingSegment.GetCrossSectionWidth ();
double currentHeight = routingSegment.GetCrossSectionHeight ();
ACAPI::Result<void> modifyResult = routingSegment.Modify ([&](RoutingSegment::Modifier& modifier) {
modifier.SetCrossSectionWidth (0.5 * currentWidth);
modifier.SetCrossSectionHeight (0.5 * currentHeight);
}, "Modify the dimensions of Cross Section of Routing Segment.");
if (modifyResult.IsErr ())
return modifyResult.UnwrapErr ().kind;
return NoError;
Modification - Circular
uint32_t newReferenceId = 63;
ACAPI::Result<void> modifyResult = routingSegment.Modify ([&](RoutingSegment::Modifier& modifier) {
modifier.SetCrossSectionReferenceId (newReferenceId);
}, "Modify the referenceId of Cross Section of Routing Segment.");
if (modifyResult.IsErr ())
return modifyResult.UnwrapErr ().kind;
return NoError;

Member Function Documentation

◆ Get()

static Result< RoutingSegment > ACAPI::MEP::v1::RoutingSegment::Get ( const UniqueID uniqueId)
static

Returns a Routing Segment.

Parameters
uniqueIdThe UniqueID of the requested RoutingSegment.
Returns
If the uniqueId belongs to a RoutingSegment, returns the object associated to it, otherwise Error.

◆ GetAnchor()

API_AnchorID ACAPI::MEP::v1::RoutingSegment::GetAnchor ( ) const
Returns
Returns the anchor position of the RoutingSegment.

◆ GetBeginNodeId()

UniqueID ACAPI::MEP::v1::RoutingSegment::GetBeginNodeId ( ) const
Returns
Returns the UniqueID of the RoutingNode from which the RoutingSegment starts.

◆ GetConnectionStyle()

ConnectionStyle ACAPI::MEP::v1::RoutingSegment::GetConnectionStyle ( ) const
Returns
Returns the connection style used by the RigidSegment's Ports.

◆ GetCrossSectionHeight()

double ACAPI::MEP::v1::RoutingSegment::GetCrossSectionHeight ( ) const
Returns
Returns the height of the RoutingSegment.

◆ GetCrossSectionReferenceId()

Result< uint32_t > ACAPI::MEP::v1::RoutingSegment::GetCrossSectionReferenceId ( ) const
Returns
Returns error if the Cross Section shape is Rectangular, otherwise the referenceId of the Circular Cross Section in the RoutingSegment.

◆ GetCrossSectionShape()

ConnectorShape ACAPI::MEP::v1::RoutingSegment::GetCrossSectionShape ( ) const
Returns
Returns the shape of the RoutingSegment.

◆ GetCrossSectionWidth()

double ACAPI::MEP::v1::RoutingSegment::GetCrossSectionWidth ( ) const
Returns
Returns the width of the RoutingSegment.

◆ GetDomain()

Domain ACAPI::MEP::v1::RoutingSegment::GetDomain ( ) const
Returns
Returns the domain of the RoutingSegment.

◆ GetEndNodeId()

UniqueID ACAPI::MEP::v1::RoutingSegment::GetEndNodeId ( ) const
Returns
Returns the UniqueID of the RoutingNode at which the RoutingSegment ends.

◆ GetFlangeSize()

std::optional< double > ACAPI::MEP::v1::RoutingSegment::GetFlangeSize ( ) const
Returns
Returns the size of the flange (width for Ventilation, diameter for Piping) if the connection style is Flanged.

◆ GetPreferenceTableId()

UniqueID ACAPI::MEP::v1::RoutingSegment::GetPreferenceTableId ( ) const
Returns
Returns the UniqueID of the PreferenceTable is associated with.

◆ GetReferenceLineOffsetX()

double ACAPI::MEP::v1::RoutingSegment::GetReferenceLineOffsetX ( ) const
Returns
Returns the offset from the reference line along the X-axis of cross-section's plane.

◆ GetReferenceLineOffsetY()

double ACAPI::MEP::v1::RoutingSegment::GetReferenceLineOffsetY ( ) const
Returns
Returns the offset from the reference line along the Y-axis of cross-section's plane.

◆ GetRigidSegmentDefaultParameters()

RigidSegmentDefault ACAPI::MEP::v1::RoutingSegment::GetRigidSegmentDefaultParameters ( ) const
Returns
Returns the default parameters of the uncustomized RigidSegments.

◆ GetRigidSegmentIds()

std::vector< UniqueID > ACAPI::MEP::v1::RoutingSegment::GetRigidSegmentIds ( ) const
Returns
Returns the UniqueIDs of the RigidSegments contained by the RoutingSegment.

◆ GetRoutingElementId()

UniqueID ACAPI::MEP::v1::RoutingSegment::GetRoutingElementId ( ) const
Returns
Returns the UniqueID of the RoutingElement that it belongs to.

◆ GetWallThickness()

double ACAPI::MEP::v1::RoutingSegment::GetWallThickness ( ) const
Returns
Returns the wall thickness of the RoutingSegment. The RigidSegment's Port will use this value as well.

◆ Inject()

Result< void > ACAPI::MEP::v1::RoutingSegment::Inject ( const RoutingSegmentDefault routingSegmentDefault)

Injects the given Default settings to the RoutingSegment.

Parameters
routingSegmentDefaultThe Default which 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::RoutingSegment::Modify ( const ModifierFunc &  modifierFunc,
const GS::UniString &  undoString 
)

Executes the passed modifier scope in an Undoable command.

Parameters
modifierFuncThe modifier scope (lambda, std::function or function pointer) the caller wants to execute.
undoStringThe 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()

RoutingSegmentDefault ACAPI::MEP::v1::RoutingSegment::PickUpDefault ( ) const

Picks up and returns the Default of the RoutingSegment.

Returns
Returns a RoutingSegmentDefault with the parameters of the object it was called for.

◆ SetAnchor()

void ACAPI::MEP::v1::RoutingSegment::SetAnchor ( API_AnchorID  anchor)

Sets the anchor position of the RoutingSegment.

Parameters
anchorThe value to be set.

◆ SetConnectionStyle()

Result< void > ACAPI::MEP::v1::RoutingSegment::SetConnectionStyle ( ConnectionStyle  connectionStyle)

Sets the connection style of the RoutingSegment.

Parameters
connectionStyleThe value to be set.
Returns
Returns an error if the RoutingSegment's domain does not support the provided connection style, otherwise nothing.

◆ SetCrossSectionHeight()

Result< void > ACAPI::MEP::v1::RoutingSegment::SetCrossSectionHeight ( double  height)

Sets the height of the Routing Segment.

Parameters
heightThe value to be set.
Returns
Returns error if the Cross Section Shape is Circular, otherwise nothing.

◆ SetCrossSectionReferenceId()

Result< void > ACAPI::MEP::v1::RoutingSegment::SetCrossSectionReferenceId ( uint32_t  referenceId)

Sets the referenceId of Circular Cross Section in the Routing Segment.

Parameters
referenceIdThe referenceId of the row from the Segment PreferenceTable. Only the valid row's ReferenceId can be set.
Returns
Returns an error if the Cross Section Shape is not Circular or the referenceId is not a valid row of the actual preferenceTable, otherwise nothing.

◆ SetCrossSectionShape()

Result< void > ACAPI::MEP::v1::RoutingSegment::SetCrossSectionShape ( ConnectorShape  shape)

Sets the shape of the Routing Segment.

Parameters
shapeThe value to be set.
Returns
Returns error if the shape is not supported by the RoutingSegment, otherwise nothing.

◆ SetCrossSectionWidth()

Result< void > ACAPI::MEP::v1::RoutingSegment::SetCrossSectionWidth ( double  width)

Sets the width of the RoutingSegment.

Parameters
widthThe value to be set.
Returns
Returns error if the Cross Section Shape is Circular, otherwise nothing.

◆ SetFlangeSize()

Result< void > ACAPI::MEP::v1::RoutingSegment::SetFlangeSize ( double  flangeSize)

Sets the flange size (width for Ventilation, diameter for Piping) of the RoutingSegment if its connection style is Flanged.

Parameters
flangeSizeThe value to be set.
Returns
Returns an error if the RoutingSegment's connection style is not Flanged, otherwise nothing.

◆ SetPreferenceTableId()

Result< void > ACAPI::MEP::v1::RoutingSegment::SetPreferenceTableId ( const UniqueID uniqueId)

Sets the PreferenceTable of the RoutingSegment.

Parameters
uniqueIdThe UniqueID of the PreferenceTable.
Returns
Returns an error if the parameter does not identify a PreferenceTable, otherwise nothing.

◆ SetReferenceLineOffsetX()

void ACAPI::MEP::v1::RoutingSegment::SetReferenceLineOffsetX ( double  offset)

Sets the offset from the reference line along the X-axis of cross-section's plane.

Parameters
offsetThe value to be set.

◆ SetReferenceLineOffsetY()

void ACAPI::MEP::v1::RoutingSegment::SetReferenceLineOffsetY ( double  offset)

Sets the offset from the reference line along the Y-axis of cross-section's plane.

Parameters
offsetThe value to be set.

◆ SetRigidSegmentDefaultParameters()

Result< void > ACAPI::MEP::v1::RoutingSegment::SetRigidSegmentDefaultParameters ( const RigidSegmentDefault rigidSegmentDefault)

Sets the parameters of the RigidSegments.

Parameters
rigidSegmentDefaultThe Default to be set. One should pay attention to the parameter, it has to belong to the same domain than the object it is called for.
Returns
Returns an error in case of domain mismatch or if the set operation fails for some internal reason, otherwise nothing.

◆ SetWallThickness()

Result< void > ACAPI::MEP::v1::RoutingSegment::SetWallThickness ( double  thickness)

Sets the wall thickness of the RoutingSegment.

Parameters
thicknessThe value to be set.
Returns
Returns an error if the RoutingSegment's wall thickness is controlled by its PreferenceTable, otherwise nothing.