在IFC中的绝对壁位置

Absolute wall positions in IFC

本文关键字:位置 IFC      更新时间:2023-10-16

因为我想将窗户与墙壁关联,所以我试图使用ifcopenshell找到墙的端点。

#include <ifcgeom/IfcGeom.h>
#include <ifcparse/IfcFile.h>
using namespace Ifc2x3;
using namespace IfcSchema;
using namespace IfcParse;
using namespace IfcUtil;
using namespace IfcGeom;
std::string tostr(gp_XYZ a) {
  std::stringstream ss;
  ss << a.X() << "," << a.Y() << "," << a.Z();
  return ss.str();
}
int main(int argc, char** argv) {
  IfcFile file;
  if (!file.Init(argc > 1 ? argv[1] : "windows connected to walls Archicad.ifc")) abort();
  Kernel k;
  gp_Pnt start;
  gp_Pnt end;
  auto list = file.entitiesByType<IfcWall>();
  for ( auto it = list->begin(); it != list->end(); ++it) {
    auto w1 = *it;
    std::cout << "wall " << w1->entity->id() << std::endl;
    bool suc = k.find_wall_end_points(w1, start, end);
    std::cout << suc << std::endl;
    std::cout << tostr(start.XYZ()) << std::endl;
    std::cout << tostr(end.XYZ()) << std::endl;
  }
}

目前,这将产生10.1596,0,09.08038,0,0作为两个墙壁的端点,而0作为两者的起点。这意味着它们是平行的。但是,当我在ArchICAD中打开IFC文件时,它们是正交的。文件中甚至有一个IFC标签,指定一个墙连接到另一堵墙/Atstart/Atend。如何得出正确的坐标?

编译命令行:g++ -I/usr/include/oce wallpoints.cpp -l IfcGeom -l IfcParse $(for i in $(cd /usr/lib/x86_64-linux-gnu/; ls libTK*.so | cut -d. -f1 | cut -c4-); do echo "-l $i"; done) $(icu-config --ldflags) -ggdb3

IFC文件:https://hushfile.it/592c22c69af2a #awrpri2o2o3ecduamp_pijnmcav3bwvwr30tfrazqj

如标准中所述,位置是相对的,因此我必须用几个矩阵将其倍增。