Archicad 28 C++ API
Loading...
Searching...
No Matches
ACAPI::MEP::v1::RoutingElementDefault Class Reference

The RoutingElementDefault contains the necessary non-geometric data for creating a Routing element. More...

#include <MEPRoutingElementDefault.hpp>

Inheritance diagram for ACAPI::MEP::v1::RoutingElementDefault:
ACAPI::v1::ElementDefault ACAPI::v1::Object

Public Member Functions

RoutingSegmentDefault GetRoutingSegmentDefault () const
 
RoutingNodeDefault GetRoutingNodeDefault () const
 
Domain GetDomain () const
 Retrieves the domain of the RoutingElementDefault.
 
API_AttributeIndex GetMEPSystem () const
 
Result< UniqueIDGetBranchPreferenceTableId () const
 
Result< UniqueIDPlace (const std::vector< API_Coord3D > &nodeCoordinates, const std::map< UInt32, RoutingSegmentRectangularCrossSectionData > &rectangularCrossSectionData, const std::map< UInt32, RoutingSegmentCircularCrossSectionData > &circularCrossSectionData, const std::optional< API_Guid > &requiredId=std::nullopt) const
 Places a Routing element based on the Default.
 
template<class ModifierFunc >
Result< void > Modify (ModifierFunc &&modifierFunc)
 Executes the given modifier scope in a NotUndoable command.
 
void SetRoutingSegmentDefault (const RoutingSegmentDefault &routingSegmentDefault)
 Sets the RoutingSegmentDefault of RoutingElement.
 
void SetRoutingNodeDefault (const RoutingNodeDefault &routingNodeDefault)
 Sets the RoutingNodeDefault of RoutingElement.
 
Result< void > SetMEPSystem (const API_AttributeIndex &attributeIndex)
 Sets the MEPSystem attribute of RoutingElement.
 
Result< void > SetBranchPreferenceTableId (const UniqueID &uniqueId)
 Sets the Branch PreferenceTable of the RoutingElementDefault.
 
- Public Member Functions inherited from ACAPI::v1::ElementDefault
Result< void > SetAsArchicadDefault () const
 Sets the locally prepared Default settings to the Archicad Default.
 
- 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.
 

Protected Member Functions

 RoutingElementDefault (std::shared_ptr< Impl::IRoutingElementDefaultImpl > impl)
 Constructs a RoutingElementDefault with the given implementation.
 
- Protected Member Functions inherited from ACAPI::v1::ElementDefault
 ElementDefault (std::shared_ptr< Impl::ElementDefaultImpl > impl)
 Constructs a new ElementDefault.
 
- Protected Member Functions inherited from ACAPI::v1::Object
 ~Object ()
 Default destructor.
 

Static Protected Member Functions

static Result< RoutingElementDefaultCreate (const API_Token &token, Domain domain)
 Creates a RoutingElementDefault with the given token and domain.
 

Friends

class ACAPI::Impl::ObjectCreator
 
Result< RoutingElementDefaultCreateRoutingElementDefault (Domain)
 Creates a RoutingElementDefault.
 

Additional Inherited Members

- Protected Attributes inherited from ACAPI::v1::Object
std::shared_ptr< Impl::ObjectImplmImpl
 Impl object given by constructor.
 

Detailed Description

The RoutingElementDefault contains the necessary non-geometric data for creating a Routing element.

Since
Archicad 27
Example code snippet from Test / New MEP
Pickup and Getters
// Write Defaults
RoutingElementDefault routingElementDefault = routingElement->PickUpDefault ();
// Default Routing Segment
routingElementReporter.AddNewLine ();
routingElementReporter.Add ("Default Routing Segment:");
routingElementReporter.SetTabCount (1);
RoutingSegmentDefault routingSegmentDefault = routingElementDefault.GetRoutingSegmentDefault ();
ConnectorShape shape = routingSegmentDefault.GetCrossSectionShape ();
routingElementReporter.Add ("Table of dimensions ID", routingSegmentDefault.GetPreferenceTableId ());
if (shape == ConnectorShape::Circular)
routingElementReporter.Add ("Reference ID", *routingSegmentDefault.GetCrossSectionReferenceId ());
routingElementReporter.Add ("Cross Section Shape", shape);
routingElementReporter.Add ("Cross Section Width", routingSegmentDefault.GetCrossSectionWidth ());
routingElementReporter.Add ("Cross Section Height", routingSegmentDefault.GetCrossSectionHeight ());
routingElementReporter.Add ("Wall thickness", routingSegmentDefault.GetWallThickness ());
routingElementReporter.Add ("Anchor", routingSegmentDefault.GetAnchor ());
routingElementReporter.Add ("Offset X", routingSegmentDefault.GetReferenceLineOffsetX ());
routingElementReporter.Add ("Offset Y", routingSegmentDefault.GetReferenceLineOffsetY ());
ConnectionStyle style = routingSegmentDefault.GetConnectionStyle ();
routingElementReporter.Add ("Connection style", style);
if (style == ConnectionStyle::Flanged)
routingElementReporter.Add (shape == ConnectorShape::Circular ? "Flange diameter" : "Flange width", *routingSegmentDefault.GetFlangeSize ());
routingElementReporter.AddNewLine ();
routingElementReporter.Add ("Default Rigid Segment:");
routingElementReporter.SetTabCount (2);
RigidSegmentDefault rigidSegmentDefault = routingSegmentDefault.GetRigidSegmentDefault ();
routingElementReporter.Add ("Width", rigidSegmentDefault.GetWidth ());
routingElementReporter.Add ("Height", rigidSegmentDefault.GetHeight ());
routingElementReporter.Add ("Shape", rigidSegmentDefault.GetShape ());
// Default Routing Node
routingElementReporter.SetTabCount (0);
routingElementReporter.AddNewLine ();
routingElementReporter.Add ("Default Routing Node:");
routingElementReporter.SetTabCount (1);
RoutingNodeDefault routingNodeDefault = routingElementDefault.GetRoutingNodeDefault ();
routingElementReporter.Add ("Preferred Transition Placement", routingNodeDefault.GetPreferredTransitionPlacement ());
routingElementReporter.AddNewLine ();
routingElementReporter.Add ("Default Bend:");
routingElementReporter.SetTabCount (2);
BendDefault bendDefault = routingNodeDefault.GetBendDefault ();
if (bendDefault.GetDomain () != Domain::Piping)
routingElementReporter.Add ("Factor Radius", *bendDefault.GetFactorRadius ());
routingElementReporter.SetTabCount (1);
routingElementReporter.AddNewLine ();
routingElementReporter.Add ("Default Transition:");
routingElementReporter.SetTabCount (2);
TransitionDefault transitionDefault = routingNodeDefault.GetTransitionDefault ();
if (transitionDefault.GetDomain () != Domain::Piping)
routingElementReporter.Add ("Angle", *transitionDefault.GetAngle ());
routingElementReporter.Add ("Offset Y", transitionDefault.GetOffsetY ());
routingElementReporter.Add ("Offset Z", transitionDefault.GetOffsetZ ());
routingElementReporter.Write ();
The BendDefault contains the necessary non-geometric data for modifying a Bend.
Definition: MEPBendDefault.hpp:34
Result< double > GetFactorRadius() const
The radius of the Bend is calculated with the help of this value in the case of Duct and Cable Carrie...
The RigidSegmentDefault contains the necessary non-geometric data for creating a RigidSegment element...
Definition: MEPRigidSegmentDefault.hpp:33
ConnectorShape GetShape() const
The RoutingElementDefault contains the necessary non-geometric data for creating a Routing element.
Definition: MEPRoutingElementDefault.hpp:38
RoutingNodeDefault GetRoutingNodeDefault() const
RoutingSegmentDefault GetRoutingSegmentDefault() const
The RoutingNodeDefault contains the necessary non-geometric data for creating and modifying a Routing...
Definition: MEPRoutingNodeDefault.hpp:143
PreferredTransitionPlacement GetPreferredTransitionPlacement() const
BendDefault GetBendDefault() const
TransitionDefault GetTransitionDefault() const
The RoutingSegmentDefault contains the necessary non-geometric data for creating and modifying a Rout...
Definition: MEPRoutingSegmentDefault.hpp:33
Result< uint32_t > GetCrossSectionReferenceId() const
RigidSegmentDefault GetRigidSegmentDefault() const
ConnectionStyle GetConnectionStyle() const
ConnectorShape GetCrossSectionShape() const
The TransitionDefault contains the necessary non-geometric data for creating and modifying a Transiti...
Definition: MEPTransitionDefault.hpp:139
ConnectionStyle
Style of the connection.
Definition: MEPEnums.hpp:41
ConnectorShape
Shape of the connector.
Definition: MEPEnums.hpp:28
Assemble placement data
std::vector<API_Coord3D> referenceCoords1;
referenceCoords1.push_back ({ 0.0, 0.0, 2.0 });
referenceCoords1.push_back ({ 5.0, 0.0, 2.0 });
referenceCoords1.push_back ({ 5.0, 5.0, 2.0 });
referenceCoords1.push_back ({ 10.0, 5.0, 2.0 });
referenceCoords1.push_back ({ 10.0, 10.0, 2.0 });
std::map<UInt32, ACAPI::MEP::RoutingSegmentRectangularCrossSectionData> rectangularCrossSectionData1;
std::map<UInt32, ACAPI::MEP::RoutingSegmentCircularCrossSectionData> circularCrossSectionData1;
std::vector<API_Coord3D> referenceCoords2;
referenceCoords2.push_back ({ 10.0, 10.0, 2.0 });
referenceCoords2.push_back ({ 15.0, 10.0, 2.0 });
referenceCoords2.push_back ({ 15.0, 15.0, 2.0 });
std::map<UInt32, ACAPI::MEP::RoutingSegmentRectangularCrossSectionData> rectangularCrossSectionData2;
std::map<UInt32, ACAPI::MEP::RoutingSegmentCircularCrossSectionData> circularCrossSectionData2;
circularCrossSectionData2.emplace (0, ACAPI::MEP::RoutingSegmentCircularCrossSectionData (20));
circularCrossSectionData2.emplace (1, ACAPI::MEP::RoutingSegmentCircularCrossSectionData (20));
return PlaceRoutesAndConnect ({ { referenceCoords1, std::make_pair (rectangularCrossSectionData1, circularCrossSectionData1) }, { referenceCoords2, std::make_pair (rectangularCrossSectionData2, circularCrossSectionData2) } }, Domain::Piping);
Defines the necessary data for placing CircularRoutingSegments of a RoutingElement.
Definition: MEPTypes.hpp:63
Placement
std::vector<UniqueID> routeIds;
routeIds.reserve (placementData.size ());
if (routingElementDefault.IsErr ())
return { routingElementDefault.UnwrapErr (), ACAPI_GetToken () };
for (const auto& [referenceCoords, crossSectionDataMaps] : placementData) {
// Optionally, you could provide a GUID for the placed route with a third parameter
ACAPI::Result<UniqueID> routingElemId = routingElementDefault->Place (referenceCoords, crossSectionDataMaps.first, crossSectionDataMaps.second);
if (routingElemId.IsErr ())
return { routingElemId.UnwrapErr (), ACAPI_GetToken () };
routeIds.emplace_back (*routingElemId);
}
return ACAPI::Ok (std::move (routeIds));
friend Result< RoutingElementDefault > CreateRoutingElementDefault(Domain)
Creates a RoutingElementDefault.
Definition: MEPRoutingElementDefault.hpp:146
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
API_Token ACAPI_GetToken()
Returns the token associated with the AddOn.

Constructor & Destructor Documentation

◆ RoutingElementDefault()

ACAPI::MEP::v1::RoutingElementDefault::RoutingElementDefault ( std::shared_ptr< Impl::IRoutingElementDefaultImpl >  impl)
protected

Constructs a RoutingElementDefault with the given implementation.

Parameters
implThe given implementation.

Member Function Documentation

◆ Create()

static Result< RoutingElementDefault > ACAPI::MEP::v1::RoutingElementDefault::Create ( const API_Token token,
Domain  domain 
)
staticprotected

Creates a RoutingElementDefault with the given token and domain.

Parameters
tokenThe given token.
domainThe given domain.
Returns
The result with the created RoutingElementDefault.

◆ GetBranchPreferenceTableId()

Result< UniqueID > ACAPI::MEP::v1::RoutingElementDefault::GetBranchPreferenceTableId ( ) const
Returns
Returns the UniqueID of the Branch PreferenceTable of a Duct or Pipe RoutingElementDefault, in case of Cable Carrier returns Error.

◆ GetDomain()

Domain ACAPI::MEP::v1::RoutingElementDefault::GetDomain ( ) const

Retrieves the domain of the RoutingElementDefault.

Returns
The domain of the RoutingElementDefault.

◆ GetMEPSystem()

API_AttributeIndex ACAPI::MEP::v1::RoutingElementDefault::GetMEPSystem ( ) const
Returns
Returns the MEPSystem attribute of the RoutingElementDefault.

◆ GetRoutingNodeDefault()

RoutingNodeDefault ACAPI::MEP::v1::RoutingElementDefault::GetRoutingNodeDefault ( ) const
Returns
Returns the RoutingNodeDefault of the RoutingElementDefault.

◆ GetRoutingSegmentDefault()

RoutingSegmentDefault ACAPI::MEP::v1::RoutingElementDefault::GetRoutingSegmentDefault ( ) const
Returns
Returns the RoutingSegmentDefault of the RoutingElementDefault.

◆ Modify()

template<class ModifierFunc >
Result< void > ACAPI::MEP::v1::RoutingElementDefault::Modify ( ModifierFunc &&  modifierFunc)

Executes the given modifier scope in a NotUndoable command.

Parameters
modifierFuncThe modifier scope (lambda, std::function or function pointer) the caller wants to execute.
Returns
Returns an error if the process of modification fails for some reason, otherwise nothing.

◆ Place()

Result< UniqueID > ACAPI::MEP::v1::RoutingElementDefault::Place ( const std::vector< API_Coord3D > &  nodeCoordinates,
const std::map< UInt32, RoutingSegmentRectangularCrossSectionData > &  rectangularCrossSectionData,
const std::map< UInt32, RoutingSegmentCircularCrossSectionData > &  circularCrossSectionData,
const std::optional< API_Guid > &  requiredId = std::nullopt 
) const

Places a Routing element based on the Default.

The implementation creates an Undoable Command Scope before executing the placement. This Command Scope is automatically closed after execution. When someone would like to group the placement of several RoutingElements and/or MEP elements together, it is recommended to create a single Command Scope. Doing this prevents the opening and closing of a Command Scope for every single created RoutingElement and/or MEP element, therefore the performance should be improved.

Parameters
nodeCoordinatesList of coordinates for the corner points of RoutingElement.
rectangularCrossSectionDataList of data for the rectangular cross sections of the RoutingSegments.
circularCrossSectionDataList of data for the circular cross sections of the RoutingSegments.
requiredIdThe guid to be set for the RoutingElement - optional parameter
Returns
If executed with success, returns the newly placed RoutingElement's uniqueId, otherwise Error.

◆ SetBranchPreferenceTableId()

Result< void > ACAPI::MEP::v1::RoutingElementDefault::SetBranchPreferenceTableId ( const UniqueID uniqueId)

Sets the Branch PreferenceTable of the RoutingElementDefault.

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

◆ SetMEPSystem()

Result< void > ACAPI::MEP::v1::RoutingElementDefault::SetMEPSystem ( const API_AttributeIndex attributeIndex)

Sets the MEPSystem attribute of RoutingElement.

Parameters
attributeIndexThe MEPSystem AttributeIndex to be set.
Returns
The result of the setting.

◆ SetRoutingNodeDefault()

void ACAPI::MEP::v1::RoutingElementDefault::SetRoutingNodeDefault ( const RoutingNodeDefault routingNodeDefault)

Sets the RoutingNodeDefault of RoutingElement.

Parameters
routingNodeDefaultThe default to be set.

◆ SetRoutingSegmentDefault()

void ACAPI::MEP::v1::RoutingElementDefault::SetRoutingSegmentDefault ( const RoutingSegmentDefault routingSegmentDefault)

Sets the RoutingSegmentDefault of RoutingElement.

Parameters
routingSegmentDefaultThe default to be set.

Friends And Related Symbol Documentation

◆ CreateRoutingElementDefault

Result< RoutingElementDefault > CreateRoutingElementDefault ( Domain  domain)
friend

Creates a RoutingElementDefault.

Parameters
domainThe Domain of the requested RoutingElementDefault.
Returns
If able, returns a copy of Archicad's current Default of the RoutingElement tool for the domain defined by the parameter, otherwise Error.