if (routingElement.
IsErr ()) {
return;
}
Reporter routingElementReporter;
Domain domain = routingElement->GetDomain ();
routingElementReporter.Add ("Domain", domain);
std::vector<API_Coord3D> polyLine = routingElement->GetPolyLine ();
routingElementReporter.Add ("Polyline of the routing element:");
routingElementReporter.SetTabCount (1);
routingElementReporter.Add (node);
routingElementReporter.SetTabCount (0);
if (domain != Domain::CableCarrier)
routingElementReporter.Add ("Branch Preference Table Id", *routingElement->GetBranchPreferenceTableId ());
routingElementReporter.Add ("Offset from Home Story", routingElement->GetOffsetFromHomeStory ());
if (routingElement->GetMEPSystem () == APIInvalidAttributeIndex) {
routingElementReporter.Add ("MEP System", GS::UniString { "Undefined" });
} else {
attribute.
header.
index = routingElement->GetMEPSystem ();
if DBVERIFY (err == NoError)
routingElementReporter.Add (
"MEP System", GS::UniString { attribute.
header.
name });
}
std::optional<UniqueID> portOnBegin = routingElement->GetLogicallyConnectedPortIdAtRouteBegin ();
portOnBegin.has_value () ? routingElementReporter.Add ("Logically connected Port Id at begin", *portOnBegin) : routingElementReporter.Add ("Unconnected begin node.");
std::optional<UniqueID> portOnEnd = routingElement->GetLogicallyConnectedPortIdAtRouteEnd ();
portOnEnd.has_value () ? routingElementReporter.Add ("Logically connected Port Id at end", *portOnEnd) : routingElementReporter.Add ("Unconnected end node.");
static Result< RoutingElement > Get(const UniqueID &uniqueId)
Returns a Routing Element.
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
GSErrCode ACAPI_Attribute_Get(API_Attribute *attribute)
Retrieves an attribute from the database.
void ACAPI_WriteReport(const GS::UniString &format, bool withDial,...)
Writes a report string into the Report Windowot into a custom alert window.
Domain
Type of the domain.
Definition: MEPEnums.hpp:16
API_AttrTypeID typeID
Type of the attribute; this identifies the attribute along with the index field. Refer to the API_Att...
Definition: APIdefs_Attributes.h:86
API_AttributeIndex index
The attribute index is the current database index of the given attribute. References to any attribute...
Definition: APIdefs_Attributes.h:94
char name[API_AttrNameLen]
The name of the attribute as UTF-8 encoded C string, which appears in the appropriate dialogs.
Definition: APIdefs_Attributes.h:115
Real (Cartesian) 3D coordinates of a three-dimensional space.
Definition: APIdefs_Base.h:108
Describes the different attributes.
Definition: APIdefs_Attributes.h:1855
API_Attr_Head header
A common header for all the attribute types. It contains information which applies to all the attribu...
Definition: APIdefs_Attributes.h:1861
if (routingElement.
IsErr ()) {
}
ERRCHK_NO_ASSERT (ModifyRoutingMEPSystem (*routingElement));
std::vector<UniqueID> routingNodeIds = routingElement->GetRoutingNodeIds ();
std::vector<UniqueID> routingSegmentIds = routingElement->GetRoutingSegmentIds ();
ERRCHK_NO_ASSERT (ModifyRoutingNode (*node));
ERRCHK_NO_ASSERT (ModifyRoutingSegment (*segment));
ERRCHK_NO_ASSERT (ModifyDefaultRoutingNode (*routingElement));
ERRCHK_NO_ASSERT (ModifyDefaultRoutingSegment (*routingElement));
return NoError;
static Result< RoutingNode > Get(const UniqueID &uniqueId)
Returns a RoutingNode.
static Result< RoutingSegment > Get(const UniqueID &uniqueId)
Returns a Routing Segment.
Connection of two RoutingElements
{
if (routeIds.empty ())
if (routingElem.
IsErr ())
std::vector<RouteConnectionResult> routeConnectionResults;
for (size_t i = 1; i < routeIds.size (); ++i) {
ACAPI::Result<void> modifyResult = routingElem->Modify ([&](RoutingElement::Modifier& modifier) -> GSErrCode {
if (connectionResult.
IsErr ())
routeConnectionResults.push_back (*connectionResult);
return NoError;
}, "Connect routes.");
if (modifyResult.
IsErr ())
}
return ACAPI::Ok (routeConnectionResults);
}
API_Token ACAPI_GetToken()
Returns the token associated with the AddOn.
Error type for ACAPI::Result containing an error message and an error code.
Definition: Result.hpp:47
Placement and Connection wrapped together
if (flexibleSegment.
IsErr ())
if (flexibleSegmentPort.
IsErr ())
return flexibleSegmentPort.
UnwrapErr ().kind;
modifier.SetShape (ConnectorShape::Circular);
modifier.SetWidth (0.35);
modifier.SetShape (ConnectorShape::Circular);
modifier.SetWidth (0.35);
}, "Set FlexibleSegment Port2 size.");
}, "Set FlexibleSegment Port size.");
if (terminalDefault.
IsErr ())
std::vector<API_Coord3D> referenceCoords;
referenceCoords.push_back ({ 5.0, -10.0, 0.0 });
referenceCoords.push_back ({ 8.0, -10.0, 0.0 });
referenceCoords.push_back ({ 8.0, -10.0, 10.0 });
std::map<UInt32, ACAPI::MEP::RoutingSegmentRectangularCrossSectionData> rectangularCrossSectionData;
std::map<UInt32, ACAPI::MEP::RoutingSegmentCircularCrossSectionData> circularCrossSectionData;
ACAPI::Result<std::vector<UniqueID>> routingElementId = PlaceRoutes ({ { referenceCoords, std::make_pair (rectangularCrossSectionData, circularCrossSectionData) } }, Domain::Ventilation);
if (routingElementId.
IsErr ())
if (routingElement.
IsErr ())
ACAPI::Result connectResult = routingElement->Modify ([&](RoutingElement::Modifier& modifier) -> GSErrCode {
modifier.SetMEPSystem (flexibleSegmentPort2->GetMEPSystem ());
if (connectionResult.
IsErr ())
return NoError;
}, "Connect RoutingElement to FlexibleSegment.");
static Result< FlexibleSegment > Get(const UniqueID &uniqueId)
Returns a FlexibleSegment.
Modifier(PortBase &parent)
Constructs a Modifier with the given port base parent.
static Result< Port > Get(const UniqueID &uniqueId)
Returns a Port.
Defines the necessary data for placing RectangularRoutingSegments of a RoutingElement.
Definition: MEPTypes.hpp:39