MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / process_pset

Function process_pset

src/examples/IfcParseExamples.cpp:117–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115
116template <typename Schema, typename T>
117void process_pset(element_properties& props, const T* inst) {
118 // Process an individual Property or Quantity set.
119 if (auto pset = inst->template as<typename Schema::IfcPropertySet>()) {
120 if (!pset->Name()) {
121 return;
122 }
123 auto ps = pset->HasProperties();
124 for (auto it = ps->begin(); it != ps->end(); ++it) {
125 auto& p = *it;
126 if (auto singleval = p->template as<typename Schema::IfcPropertySingleValue>()) {
127 std::string propname, propvalue;
128 if constexpr (is_ifc4_or_higher<Schema>::value) {
129 if (!singleval->Name()) {
130 continue;
131 }
132 propname = *singleval->Name();
133 }
134 if constexpr (!is_ifc4_or_higher<Schema>::value) {
135 propname = singleval->Name();
136 }
137 if (!singleval->NominalValue()) {
138 propvalue = "-";
139 } else {
140 props[*pset->Name()][propname] = format_string(singleval->NominalValue()->template as<IfcUtil::IfcBaseClass>()->get_attribute_value(0));
141 }
142 }
143 }
144 }
145 if (auto qset = inst->template as<typename Schema::IfcElementQuantity>()) {
146 if (!qset->Name()) {
147 return;
148 }
149 auto qs = qset->Quantities();
150 for (auto it = qs->begin(); it != qs->end(); ++it) {
151 auto& q = *it;
152 if (q->template as<typename Schema::IfcPhysicalSimpleQuantity>() && q->get_attribute_value(3).type() == IfcUtil::Argument_DOUBLE) {
153 double v = q->get_attribute_value(3);
154 props[*qset->Name()][q->Name()] = std::to_string(v);
155 }
156 }
157 }
158 if constexpr (is_ifc4_or_higher<Schema>::value) {
159 if (auto extprops = inst->template as<typename Schema::IfcExtendedProperties>()) {
160 // @todo
161 }
162 }
163}
164
165template <typename Schema>
166void get_psets_s(element_properties& props, const typename Schema::IfcObjectDefinition* inst) {

Callers 1

load_fileMethod · 0.85

Calls 7

format_stringFunction · 0.85
to_stringFunction · 0.85
NameMethod · 0.80
get_attribute_valueMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected