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

The ElementDefault contains the necessary non-geometric data for creating a MEP element. More...

#include <MEPElementDefault.hpp>

Inheritance diagram for ACAPI::MEP::v1::ElementDefault:
ACAPI::v1::ElementDefault ACAPI::v1::Object ACAPI::MEP::v1::AccessoryDefault ACAPI::MEP::v1::BendDefault ACAPI::MEP::v1::BranchDefault ACAPI::MEP::v1::EquipmentDefault ACAPI::MEP::v1::FittingDefault ACAPI::MEP::v1::FlexibleSegmentDefault ACAPI::MEP::v1::RigidSegmentDefault ACAPI::MEP::v1::TakeOffDefault ACAPI::MEP::v1::TerminalDefault ACAPI::MEP::v1::TransitionDefault ACAPI::MEP::v2::TransitionDefault

Public Member Functions

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.
 

Protected Member Functions

 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.
 

Friends

class ACAPI::Impl::ObjectCreator
 

Additional Inherited Members

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

Detailed Description

The ElementDefault contains the necessary non-geometric data for creating a MEP element.

Since
Archicad 27
Example code snippets from Test / New MEP
Getters
auto ductBranchDefault = CreateBranchDefault (Domain::Ventilation);
if (ductBranchDefault.IsErr ())
return ductBranchDefault.UnwrapErr ().kind;
WriteElementDefaultDetails (*ductBranchDefault);
auto pipeBranchDefault = CreateBranchDefault (Domain::Piping);
if (pipeBranchDefault.IsErr ())
return pipeBranchDefault.UnwrapErr ().kind;
WriteElementDefaultDetails (*pipeBranchDefault);
auto cableCarrierBranchDefault = CreateBranchDefault (Domain::CableCarrier);
if (cableCarrierBranchDefault.IsErr ())
return cableCarrierBranchDefault.UnwrapErr ().kind;
WriteElementDefaultDetails (*cableCarrierBranchDefault);
Result< BranchDefault > CreateBranchDefault(Domain domain)
Creates a BranchDefault.
Definition: MEPBranchDefault.hpp:43
void WriteElementDefaultDetails (const ElementDefault& mepElemDefault)
{
Reporter elementDefaultReporter;
elementDefaultReporter.Add ("Domain of default", mepElemDefault.GetDomain ());
uint32_t portCount = mepElemDefault.GetPortCount ();
for (uint32_t portIdx = 0; portIdx < portCount; portIdx++) {
elementDefaultReporter.SetTabCount (1);
ACAPI::Result<VentilationPortDefault> ventilationPortDefault = mepElemDefault.GetVentilationPortDefault (portIdx);
if (ventilationPortDefault.IsOk ()) {
elementDefaultReporter.Add ("Port name", ventilationPortDefault->GetName ());
elementDefaultReporter.SetTabCount (2);
elementDefaultReporter.Add ("Domain", ventilationPortDefault->GetDomain ());
elementDefaultReporter.Add ("Width", ventilationPortDefault->GetWidth ());
elementDefaultReporter.Add ("Height", ventilationPortDefault->GetHeight ());
elementDefaultReporter.Add ("Shape", ventilationPortDefault->GetShape ());
elementDefaultReporter.Add ("MEPSystem", ventilationPortDefault->GetMEPSystem ());
elementDefaultReporter.Add ("WallThickness", ventilationPortDefault->GetWallThickness ());
elementDefaultReporter.Add ("FlowDirection", ventilationPortDefault->GetFlowDirection ());
} else {
ACAPI::Result<PipingPortDefault> pipingPortDefault = mepElemDefault.GetPipingPortDefault (portIdx);
if (pipingPortDefault.IsOk ()) {
elementDefaultReporter.Add ("Port name", pipingPortDefault->GetName ());
elementDefaultReporter.SetTabCount (2);
elementDefaultReporter.Add ("Domain", pipingPortDefault->GetDomain ());
elementDefaultReporter.Add ("Diameter", pipingPortDefault->GetDiameter ());
elementDefaultReporter.Add ("Shape", pipingPortDefault->GetShape ());
elementDefaultReporter.Add ("MEPSystem", pipingPortDefault->GetMEPSystem ());
elementDefaultReporter.Add ("WallThickness", pipingPortDefault->GetWallThickness ());
elementDefaultReporter.Add ("FlowDirection", pipingPortDefault->GetFlowDirection ());
} else {
ACAPI::Result<CableCarrierPortDefault> cableCarrierPortDefault = mepElemDefault.GetCableCarrierPortDefault (portIdx);
if (cableCarrierPortDefault.IsOk ()) {
elementDefaultReporter.Add ("Port name", cableCarrierPortDefault->GetName ());
elementDefaultReporter.SetTabCount (2);
elementDefaultReporter.Add ("Domain", cableCarrierPortDefault->GetDomain ());
elementDefaultReporter.Add ("Width", cableCarrierPortDefault->GetWidth ());
elementDefaultReporter.Add ("Height", cableCarrierPortDefault->GetHeight ());
elementDefaultReporter.Add ("Shape", cableCarrierPortDefault->GetShape ());
elementDefaultReporter.Add ("MEPSystem", cableCarrierPortDefault->GetMEPSystem ());
}
}
}
}
elementDefaultReporter.SetTabCount (0);
std::optional<double> insulation = mepElemDefault.GetInsulationThickness ();
insulation.has_value () ? elementDefaultReporter.Add ("Insulation thickness", *insulation) : elementDefaultReporter.Add ("Has no insulation");
elementDefaultReporter.Write ();
}
The ElementDefault contains the necessary non-geometric data for creating a MEP element.
Definition: MEPElementDefault.hpp:36
Result< VentilationPortDefault > GetVentilationPortDefault(uint32_t portIndex) const
std::optional< double > GetInsulationThickness() const
Result< PipingPortDefault > GetPipingPortDefault(uint32_t portIndex) const
Result< CableCarrierPortDefault > GetCableCarrierPortDefault(uint32_t portIndex) const
Result is the standard return type of API functions.
Definition: Result.hpp:845
bool IsOk() const
Definition: Result.hpp:940

Constructor & Destructor Documentation

◆ ElementDefault()

ACAPI::MEP::v1::ElementDefault::ElementDefault ( std::shared_ptr< Impl::IElementDefaultImpl >  impl)
protected

Constructs an ElementDefault with the given element default implementation.

Parameters
implThe element default implementation.

Member Function Documentation

◆ GetCableCarrierPortDefault()

Result< CableCarrierPortDefault > ACAPI::MEP::v1::ElementDefault::GetCableCarrierPortDefault ( uint32_t  portIndex) const
Parameters
portIndexZero-based index of Ports.
Returns
Returns an error if the index is out of range, or the corresponding Port is not of CableCarrier domain.

◆ GetDomain()

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

◆ GetDomainOfPort()

Result< Domain > ACAPI::MEP::v1::ElementDefault::GetDomainOfPort ( uint32_t  portIndex) const
Parameters
portIndexZero-based index of Ports.
Returns
Returns an error if the index is out of range, otherwise the domain of the given Port.

◆ GetInsulationThickness()

std::optional< double > ACAPI::MEP::v1::ElementDefault::GetInsulationThickness ( ) const
Returns
Returns the insulation thickness if the ElementDefault has insulation, otherwise std::nullopt. ElementDefaults of cable carrier domain cannot have insulation.

◆ GetObjectId()

API_Guid ACAPI::MEP::v1::ElementDefault::GetObjectId ( ) const
Returns
Returns the main GUID of the referenced Library Part.

◆ GetPipingPortDefault()

Result< PipingPortDefault > ACAPI::MEP::v1::ElementDefault::GetPipingPortDefault ( uint32_t  portIndex) const
Parameters
portIndexZero-based index of Ports.
Returns
Returns an error if the index is out of range, or the corresponding Port is not of Piping domain.

◆ GetPortCount()

uint32_t ACAPI::MEP::v1::ElementDefault::GetPortCount ( ) const
Returns
Returns the number of ports.

◆ GetVentilationPortDefault()

Result< VentilationPortDefault > ACAPI::MEP::v1::ElementDefault::GetVentilationPortDefault ( uint32_t  portIndex) const
Parameters
portIndexZero-based index of Ports.
Returns
Returns an error if the index is out of range, or the corresponding Port is not of Ventilation domain.

◆ Modifier()

ACAPI::MEP::v1::ElementDefault::Modifier ( ElementDefault parent)
protected

Constructs a Modifier with the given parent ElementDefault.

Parameters
parentThe parent ElementDefault.

◆ Modify()

template<class ModifierFunc >
Result< void > ACAPI::MEP::v1::ElementDefault::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.

◆ SetInsulationThickness()

Result< void > ACAPI::MEP::v1::ElementDefault::SetInsulationThickness ( double  insulationThickness)

Sets the thickness of insulation on the ElementDefault.

Parameters
insulationThicknessThe value to be set.
Returns
Returns an error if the Element is of cable carrier domain, otherwise nothing.

◆ SetObjectId()

void ACAPI::MEP::v1::ElementDefault::SetObjectId ( const API_Guid libraryPartId)

Sets the referenced library part of the ElementDefault.

Parameters
libraryPartIdThe main GUID of the library part.