mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Update ifcviewer to compile with datamodel refactor
This commit is contained in:
@@ -94,7 +94,7 @@ std::vector<ElementInfo> GeometryStreamer::drainElements() {
|
||||
|
||||
void GeometryStreamer::run(const std::string& path, int num_threads) {
|
||||
try {
|
||||
ifc_file_ = std::make_unique<IfcParse::IfcFile>(path);
|
||||
ifc_file_ = std::make_unique<ifcopenshell::file>(path);
|
||||
} catch (const std::exception& e) {
|
||||
emit errorOccurred(QString("Failed to parse IFC file: %1").arg(e.what()));
|
||||
return;
|
||||
@@ -112,7 +112,7 @@ void GeometryStreamer::run(const std::string& path, int num_threads) {
|
||||
auto kernel = ifcopenshell::geometry::kernels::construct(
|
||||
ifc_file_.get(), geometry_library, settings);
|
||||
iterator = std::make_unique<IfcGeom::Iterator>(
|
||||
std::move(kernel), settings, ifc_file_.get(), std::vector<IfcGeom::filter_t>(), num_threads);
|
||||
std::move(kernel), settings, ifc_file_.get(), std::vector<ifcopenshell::geometry::filter_t>(), num_threads);
|
||||
} catch (const std::exception& e) {
|
||||
emit errorOccurred(QString("Failed to create geometry iterator: %1").arg(e.what()));
|
||||
return;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <mutex>
|
||||
#include <deque>
|
||||
|
||||
#include "../ifcparse/IfcFile.h"
|
||||
#include "../ifcparse/file.h"
|
||||
#include "../ifcgeom/Iterator.h"
|
||||
|
||||
#include "ViewportWindow.h"
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
bool isRunning() const { return running_.load(); }
|
||||
int progress() const { return progress_.load(); }
|
||||
|
||||
IfcParse::IfcFile* ifcFile() const { return ifc_file_.get(); }
|
||||
ifcopenshell::file* ifcFile() const { return ifc_file_.get(); }
|
||||
|
||||
// Thread-safe access to discovered elements
|
||||
std::vector<ElementInfo> drainElements();
|
||||
@@ -73,7 +73,7 @@ private:
|
||||
|
||||
UploadChunk convertElement(const IfcGeom::TriangulationElement* elem, uint32_t object_id);
|
||||
|
||||
std::unique_ptr<IfcParse::IfcFile> ifc_file_;
|
||||
std::unique_ptr<ifcopenshell::file> ifc_file_;
|
||||
std::unique_ptr<QThread> worker_thread_;
|
||||
std::atomic<bool> running_{false};
|
||||
std::atomic<bool> cancel_requested_{false};
|
||||
|
||||
@@ -244,23 +244,23 @@ void MainWindow::populateProperties(uint32_t object_id) {
|
||||
auto* file = streamer_->ifcFile();
|
||||
if (!file) return;
|
||||
|
||||
auto* product = file->instance_by_id(info.ifc_id);
|
||||
auto product = file->instance_by_id(info.ifc_id);
|
||||
if (!product) return;
|
||||
|
||||
// Show all direct attributes
|
||||
auto& decl = product->declaration();
|
||||
auto& decl = product.declaration();
|
||||
if (auto* entity = decl.as_entity()) {
|
||||
for (size_t i = 0; i < entity->attribute_count(); ++i) {
|
||||
auto* attr = entity->attribute_by_index(i);
|
||||
try {
|
||||
auto val = product->get_attribute_value(i);
|
||||
auto val = product.get_attribute_value(i);
|
||||
if (!val.isNull()) {
|
||||
std::string str_val;
|
||||
try {
|
||||
str_val = static_cast<std::string>(val);
|
||||
} catch (...) {
|
||||
// Not a string-convertible attribute (entity ref, aggregate, etc.)
|
||||
str_val = "<" + std::string(IfcUtil::ArgumentTypeToString(val.type())) + ">";
|
||||
str_val = "<" + std::string(ifcopenshell::argument_type_to_string(val.type())) + ">";
|
||||
}
|
||||
addRow(QString::fromStdString(attr->name()), QString::fromStdString(str_val));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user