Archicad 28 C++ API
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
ACAPI::MEP::v1::AccessoryDefault Class Referencefinal

The AccessoryDefault contains the necessary non-geometric data for creating an Accessory element. More...

#include <MEPAccessoryDefault.hpp>

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

Public Member Functions

Result< UniqueIDPlace (const API_Coord3D &coordinate, const Orientation &orientation, const std::optional< API_Guid > &requiredId=std::nullopt) const
 Places an Accessory element based on this Default.
 
Result< UniqueIDPlace (const UniqueID &portOrNodeId, const std::optional< API_Guid > &requiredId=std::nullopt) const
 Places an Accessory element based on this Default and connects it with the provided Port or RoutingNode, if it is possible.
 
- Public Member Functions inherited from ACAPI::MEP::v1::ElementDefault
std::optional< double > GetInsulationThickness () const
 
uint32_t GetPortCount () const
 
Domain GetDomain () const
 
API_Guid GetObjectId () const
 
Result< DomainGetDomainOfPort (uint32_t portIndex) const
 
Result< VentilationPortDefaultGetVentilationPortDefault (uint32_t portIndex) const
 
Result< PipingPortDefaultGetPipingPortDefault (uint32_t portIndex) const
 
Result< CableCarrierPortDefaultGetCableCarrierPortDefault (uint32_t portIndex) const
 
template<class ModifierFunc >
Result< void > Modify (ModifierFunc &&modifierFunc)
 Executes the given modifier scope in a NotUndoable command.
 
void RemoveInsulation ()
 Removes the insulation.
 
Result< void > SetInsulationThickness (double insulationThickness)
 Sets the thickness of insulation on the ElementDefault.
 
void SetObjectId (const API_Guid &libraryPartId)
 Sets the referenced library part of the ElementDefault.
 
- 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.
 

Friends

class ACAPI::Impl::ObjectCreator
 
Result< AccessoryDefaultCreateAccessoryDefault (Domain)
 Creates an AccessoryDefault.
 

Additional Inherited Members

- Protected Member Functions inherited from ACAPI::MEP::v1::ElementDefault
 ElementDefault (std::shared_ptr< Impl::IElementDefaultImpl > impl)
 Constructs an ElementDefault with the given element default implementation.
 
 Modifier (ElementDefault &parent)
 Constructs a Modifier with the given parent ElementDefault.
 
- 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.
 
- Protected Attributes inherited from ACAPI::v1::Object
std::shared_ptr< Impl::ObjectImplmImpl
 Impl object given by constructor.
 

Detailed Description

The AccessoryDefault contains the necessary non-geometric data for creating an Accessory element.

Since
Archicad 27
Example code snippet from Test / New MEP
Placement
{
auto ductAccessoryDefault = CreateAccessoryDefault (Domain::Ventilation);
if (ductAccessoryDefault.IsErr ())
return ductAccessoryDefault.UnwrapErr ().kind;
ACAPI::Result<UniqueID> accessoryId = ductAccessoryDefault->Place ({ 0.0, 13.0, 0.0 }, { { -1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 } }, GenerateAPIGuid ());
if (accessoryId.IsErr ())
return accessoryId.UnwrapErr ().kind;
ACAPI_WriteReport ("Ventilation Accessory placed successfully", false);
}
{
auto pipeAccessoryDefault = CreateAccessoryDefault (Domain::Piping);
if (pipeAccessoryDefault.IsErr ())
return pipeAccessoryDefault.UnwrapErr ().kind;
ACAPI::Result<UniqueID> accessoryId = pipeAccessoryDefault->Place ({ 10.0, 13.0, 0.0 }, { { -1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 } }, GenerateAPIGuid ());
if (accessoryId.IsErr ())
return accessoryId.UnwrapErr ().kind;
ACAPI_WriteReport ("Piping Accessory placed successfully", false);
}
friend Result< AccessoryDefault > CreateAccessoryDefault(Domain)
Creates an AccessoryDefault.
Definition: MEPAccessoryDefault.hpp:70
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_Guid GenerateAPIGuid()
Definition: API_Guid.hpp:230
void ACAPI_WriteReport(const GS::UniString &format, bool withDial,...)
Writes a report string into the Report Windowot into a custom alert window.

Member Function Documentation

◆ Place() [1/2]

Result< UniqueID > ACAPI::MEP::v1::AccessoryDefault::Place ( const API_Coord3D coordinate,
const Orientation orientation,
const std::optional< API_Guid > &  requiredId = std::nullopt 
) const

Places an Accessory element based on this 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
coordinateThe coordinate where the Accessory will be placed.
orientationThe orientation of the Accessory, which is based on a direction vector and a rotation vector.
requiredIdThe guid to be set for the Accessory - optional parameter
Returns
If executed with success, returns the newly placed Accessory's uniqueId, otherwise Error.

◆ Place() [2/2]

Result< UniqueID > ACAPI::MEP::v1::AccessoryDefault::Place ( const UniqueID portOrNodeId,
const std::optional< API_Guid > &  requiredId = std::nullopt 
) const

Places an Accessory element based on this Default and connects it with the provided Port or RoutingNode, if it is possible.

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
portOrNodeIdThe id of a Port or RoutingNode, which provides the placed Accessory's position and orientation.
requiredIdThe guid to be set for the Accessory - optional parameter
Returns
If executed with success, returns the newly placed Terminal's uniqueId, otherwise Error.

Friends And Related Symbol Documentation

◆ CreateAccessoryDefault

Result< AccessoryDefault > CreateAccessoryDefault ( Domain  domain)
friend

Creates an AccessoryDefault.

Parameters
domainThe Domain of the requested AccessoryDefault. It can be ventilation or piping.
Returns
If able, returns a copy of Archicad's current Default of the Accessory tool for the domain defined by the parameter, otherwise Error (for ex. if domain is cable carrier).