mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
This commit is contained in:
@@ -349,11 +349,13 @@ int main(int argc, char** argv) {
|
||||
"Specifies the cut section height for SVG 2D geometry.")
|
||||
("section-height-from-storeys", "Derives section height from storey elevation. Use --section-height to override default offset of 1")
|
||||
("use-element-names",
|
||||
"Use entity names instead of unique IDs for naming elements upon serialization. "
|
||||
"Use entity instance IfcRoot.Name instead of unique IDs for naming elements upon serialization. "
|
||||
"Applicable for OBJ, DAE, and SVG output.")
|
||||
("use-element-guids",
|
||||
"Use entity GUIDs instead of unique IDs for naming elements upon serialization. "
|
||||
"Use entity instance IfcRoot.GlobalId instead of unique IDs for naming elements upon serialization. "
|
||||
"Applicable for OBJ, DAE, and SVG output.")
|
||||
("use-element-numeric-ids", "Use the numeric step identifier (entity instance name) for naming elements upon serialization. "
|
||||
"Applicable for OBJ, DAE, and SVG output.")
|
||||
("use-material-names",
|
||||
"Use material names instead of unique IDs for naming materials upon serialization. "
|
||||
"Applicable for OBJ and DAE output.")
|
||||
@@ -426,6 +428,7 @@ int main(int argc, char** argv) {
|
||||
const bool layerset_first = vmap.count("layerset-first") != 0;
|
||||
const bool use_element_names = vmap.count("use-element-names") != 0;
|
||||
const bool use_element_guids = vmap.count("use-element-guids") != 0;
|
||||
const bool use_element_stepids = vmap.count("use-element-numeric-ids") != 0;
|
||||
const bool use_material_names = vmap.count("use-material-names") != 0;
|
||||
const bool use_element_types = vmap.count("use-element-types") != 0;
|
||||
const bool use_element_hierarchy = vmap.count("use-element-hierarchy") != 0;
|
||||
@@ -681,7 +684,8 @@ int main(int argc, char** argv) {
|
||||
|
||||
settings.set(SerializerSettings::USE_ELEMENT_NAMES, use_element_names);
|
||||
settings.set(SerializerSettings::USE_ELEMENT_GUIDS, use_element_guids);
|
||||
settings.set(SerializerSettings::USE_MATERIAL_NAMES, use_material_names);
|
||||
settings.set(SerializerSettings::USE_ELEMENT_STEPIDS, use_element_stepids);
|
||||
settings.set(SerializerSettings::USE_MATERIAL_NAMES, use_material_names);
|
||||
settings.set(SerializerSettings::USE_ELEMENT_TYPES, use_element_types);
|
||||
settings.set(SerializerSettings::USE_ELEMENT_HIERARCHY, use_element_hierarchy);
|
||||
settings.set_deflection_tolerance(deflection_tolerance);
|
||||
|
||||
@@ -50,8 +50,11 @@ public:
|
||||
/// Order the elements using their IfcBuildingStorey parent
|
||||
/// Applicable for DAE output
|
||||
USE_ELEMENT_HIERARCHY = 1 << (IfcGeom::IteratorSettings::NUM_SETTINGS + 5),
|
||||
/// Number of different setting flags.
|
||||
NUM_SETTINGS = 5
|
||||
/// Use step ids for naming elements.
|
||||
/// Applicable for OBJ, DAE, and SVG output.
|
||||
USE_ELEMENT_STEPIDS = 1 << (IfcGeom::IteratorSettings::NUM_SETTINGS + 6),
|
||||
/// Number of different setting flags.
|
||||
NUM_SETTINGS = 6
|
||||
};
|
||||
|
||||
SerializerSettings()
|
||||
@@ -82,7 +85,8 @@ public:
|
||||
{
|
||||
if (settings_.get(SerializerSettings::USE_ELEMENT_GUIDS)) return o->guid();
|
||||
if (settings_.get(SerializerSettings::USE_ELEMENT_NAMES)) return o->name();
|
||||
return o->unique_id();
|
||||
if (settings_.get(SerializerSettings::USE_ELEMENT_STEPIDS)) return "id-" + boost::lexical_cast<std::string>(o->id());
|
||||
return o->unique_id();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -806,6 +806,8 @@ std::string SvgSerializer::idElement(const IfcUtil::IfcBaseEntity* elem) {
|
||||
? static_cast<std::string>(*elem->get("GlobalId"))
|
||||
: ((settings().get(SerializerSettings::USE_ELEMENT_NAMES) && !elem->get("Name")->isNull()))
|
||||
? static_cast<std::string>(*elem->get("Name"))
|
||||
: (settings().get(SerializerSettings::USE_ELEMENT_STEPIDS))
|
||||
? ("id-" + boost::lexical_cast<std::string>(elem->data().id()))
|
||||
: IfcParse::IfcGlobalId(*elem->get("GlobalId")).formatted());
|
||||
return type + "-" + name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user