Title: a bug about to import ifc geometry to opencascade · Issue #807 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: a bug about to import ifc geometry to opencascade · Issue #807 · IfcOpenShell/IfcOpenShell
X Title: a bug about to import ifc geometry to opencascade · Issue #807 · IfcOpenShell/IfcOpenShell
Description: I develop a very lightweight ifc viewer by opencascade and glfw. I find out not every ifc2X3 file can be read properly. This is my project : https://github.com/caadxyz/ifcOcctViewer In the main.cpp , I try two different approach to impor...
Open Graph Description: I develop a very lightweight ifc viewer by opencascade and glfw. I find out not every ifc2X3 file can be read properly. This is my project : https://github.com/caadxyz/ifcOcctViewer In the main.cpp...
X Description: I develop a very lightweight ifc viewer by opencascade and glfw. I find out not every ifc2X3 file can be read properly. This is my project : https://github.com/caadxyz/ifcOcctViewer In the main.cpp...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/807
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"a bug about to import ifc geometry to opencascade ","articleBody":"I develop a very lightweight ifc viewer by opencascade and glfw.\r\n\r\nI find out not every ifc2X3 file can be read properly.\r\nThis is my project : https://github.com/caadxyz/ifcOcctViewer \r\n\r\nIn the main.cpp , I try two different approach to importing ifc file. Both fail in some ifc files, some work will. \r\nlike the example file IfcOpenHouse.ifc.\r\n\r\nthe code below show where maybe the bug is: \r\n\r\nI guess the bug is from this function `create_brep_for_representation_and_product\u003creal_t>` from ifcOpenSHell 0.5 project `src/ifcgeom/IfcGeomFunctions.cpp`\r\n\r\n```\r\n#include \"ifcgeom/IfcGeomIterator.h\"\r\n#include \"ifcgeom/IfcGeomRenderStyles.h\"\r\n#include \"ifcparse/utils.h\"\r\n#include \u003cStandard_Version.hxx>\r\n#include \u003cTopoDS_ListOfShape.hxx>\r\n#include \"GlfwOcctView.h\"\r\ntypedef double real_t;\r\ntypedef std::string path_t;\r\nstatic std::ostream& cout_ = std::cout;\r\nstatic std::ostream& cerr_ = std::cerr;\r\n\r\nint main(int argc, char** argv) {\r\n\tif ( argc != 2 ) {\r\n cout_ \u003c\u003c \"Usage: ifcviewer \u003cinput.ifc>\\n\"\r\n \u003c\u003c \"\\n\"\r\n \u003c\u003c \"Converts the geometry in an IFC file into glfw view\\n\";\r\n cout_ \u003c\u003c std::endl;\r\n\t\treturn 1;\r\n\t}\r\n\tIfcParse::IfcFile ifc_file;\r\n\tif ( ! ifc_file.Init(argv[1]) ) {\r\n\t\tstd::cout \u003c\u003c \"Unable to parse .ifc file\" \u003c\u003c std::endl;\r\n\t\treturn 1;\r\n\t}\r\n TopoDS_ListOfShape L;\r\n IfcGeom::IteratorSettings settings;\r\n std::vector\u003cIfcGeom::filter_t> filter_funcs;\r\n std::set\u003cstd::string> entities;\r\n entities.insert(\"IfcSpace\");\r\n entities.insert(\"IfcOpeningElement\");\r\n IfcGeom::entity_filter entity_filter;\r\n entity_filter.populate(entities);\r\n filter_funcs.push_back(entity_filter); \r\n settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true);\r\n\r\n IfcSchema::IfcProduct::list::ptr products = ifc_file.entitiesByType\u003cIfcSchema::IfcProduct>();\r\n\tstd::cout \u003c\u003c \"Found \" \u003c\u003c products->size() \u003c\u003c \" products in \" \u003c\u003c argv[1] \u003c\u003c \":\" \u003c\u003c std::endl;\r\n\tfor ( IfcSchema::IfcProduct::list::it it = products->begin(); it != products->end(); ++ it ) {\r\n\t\tconst IfcSchema::IfcProduct* product = *it;\r\n if (product->is(IfcSchema::Type::FromString(\"IFCOPENINGELEMENT\"))) continue;\r\n if (product->hasRepresentation())\r\n {\r\n IfcGeom::Kernel kernel;\r\n IfcSchema::IfcProductRepresentation* prodrep = product->Representation();\r\n\t\t\tIfcSchema::IfcRepresentation::list::ptr reps = prodrep->Representations();\r\n for (IfcSchema::IfcRepresentation::list::it it = reps->begin(); it != reps->end(); ++it) {\r\n IfcSchema::IfcRepresentation* rep = *it;\r\n if (!rep->hasRepresentationIdentifier()) {\r\n continue;\r\n }\r\n\r\n \r\n //todo: need concern about finding a representation within the 'Model' or 'Plan' context\r\n if (rep->RepresentationIdentifier() == \"Body\") {\r\n\t\t //std::cout \u003c\u003c \"Body\" \u003c\u003c std::endl;\r\n //todo : create_brep_for_representation_and_product\u003creal_t> need debug\r\n //To refer to the version of ifcopenshell 0.6, may there be a solution? Maybe not\r\n //ifcgeom/IfcGeomFunctions.cpp\r\n IfcGeom::BRepElement\u003creal_t>* o = kernel.create_brep_for_representation_and_product\u003creal_t>(settings, \r\n rep, (IfcSchema::IfcProduct*)product);\r\n for (IfcGeom::IfcRepresentationShapeItems::const_iterator it = o->geometry().begin(); it != o->geometry().end(); ++ it) {\r\n gp_GTrsf gtrsf = it->Placement();\r\n const gp_Trsf& o_trsf = o->transformation().data();\r\n gtrsf.PreMultiply(o_trsf);\r\n if (o->geometry().settings().get(IfcGeom::IteratorSettings::CONVERT_BACK_UNITS)) {\r\n gp_Trsf scale;\r\n scale.SetScaleFactor(1.0 / o->geometry().settings().unit_magnitude());\r\n gtrsf.PreMultiply(scale);\r\n }\r\n const TopoDS_Shape& s = it->Shape();\r\n const TopoDS_Shape moved_shape = IfcGeom::Kernel::apply_transformation(s, gtrsf);\r\n L.Append(moved_shape);\r\n }\r\n }\r\n }\r\n\t\t std::cout \u003c\u003c product->entity->toString() \u003c\u003c std::endl;\r\n }\r\n }\r\n\r\n /*\r\n IfcGeom::Iterator\u003creal_t> context_iterator(settings, &ifc_file, filter_funcs);\r\n if (!context_iterator.initialize()) {\r\n cerr_ \u003c\u003c \"No geometrical entities found\" \u003c\u003c std::endl;\r\n return EXIT_FAILURE;\r\n }\r\n cout_ \u003c\u003c \"Creating geometry...\" \u003c\u003c std::endl;\r\n\tsize_t num_created = 0;\r\n\tdo {\r\n IfcGeom::Element\u003creal_t> *geom_object = context_iterator.get();\r\n const IfcGeom::BRepElement\u003creal_t>* o = static_cast\u003cconst IfcGeom::BRepElement\u003creal_t>*>(geom_object);\r\n for (IfcGeom::IfcRepresentationShapeItems::const_iterator it = o->geometry().begin(); it != o->geometry().end(); ++ it) {\r\n gp_GTrsf gtrsf = it->Placement();\r\n const gp_Trsf& o_trsf = o->transformation().data();\r\n gtrsf.PreMultiply(o_trsf);\r\n if (o->geometry().settings().get(IfcGeom::IteratorSettings::CONVERT_BACK_UNITS)) {\r\n gp_Trsf scale;\r\n scale.SetScaleFactor(1.0 / o->geometry().settings().unit_magnitude());\r\n gtrsf.PreMultiply(scale);\r\n }\r\n const TopoDS_Shape& s = it->Shape();\r\n const TopoDS_Shape moved_shape = IfcGeom::Kernel::apply_transformation(s, gtrsf);\r\n L.Append(moved_shape);\r\n }\r\n } while (++num_created, context_iterator.next());\r\n cout_ \u003c\u003c \"Done creating geometry\" \u003c\u003c std::endl;\r\n */\r\n\r\n GlfwOcctView anApp(L);\r\n try\r\n {\r\n anApp.run();\r\n }\r\n catch (const std::runtime_error& theError)\r\n {\r\n cerr_ \u003c\u003c theError.what() \u003c\u003c std::endl;\r\n return EXIT_FAILURE;\r\n }\r\n}\r\n```","author":{"url":"https://github.com/mahaidong","@type":"Person","name":"mahaidong"},"datePublished":"2020-03-07T03:21:42Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/807"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:79df8c2f-8c70-0c93-5f79-5170e6e23ede |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D6C8:1FA32B:754F46:A09E99:6B047997 |
| html-safe-nonce | d6a7ab4c1bf99dbe55e643bfea6af677703fe5ce625a10c5e56d00b03a592407 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkM4OjFGQTMyQjo3NTRGNDY6QTA5RTk5OjZCMDQ3OTk3IiwidmlzaXRvcl9pZCI6IjE4NjQ1Nzk1ODcxNDE1NjQ4MjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6cca26c70ffbc028239cf94657e5912f795be4822e872291654d4ff89779abb2 |
| hovercard-subject-tag | issue:577269036 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IfcOpenShell/IfcOpenShell/807/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8c331b54f1f4e2c4c6114cdc47c6f2ddc1ac041e72086d4b85d258d77425015c/IfcOpenShell/IfcOpenShell/issues/807 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8c331b54f1f4e2c4c6114cdc47c6f2ddc1ac041e72086d4b85d258d77425015c/IfcOpenShell/IfcOpenShell/issues/807 |
| og:image:alt | I develop a very lightweight ifc viewer by opencascade and glfw. I find out not every ifc2X3 file can be read properly. This is my project : https://github.com/caadxyz/ifcOcctViewer In the main.cpp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mahaidong |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9c099f1b85def81ca352464c276510dfef32deaf3c305404e65b8d270284a58b |
| turbo-cache-control | no-preview |
| go-import | github.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git |
| octolytics-dimension-user_id | 13692563 |
| octolytics-dimension-user_login | IfcOpenShell |
| octolytics-dimension-repository_id | 40473201 |
| octolytics-dimension-repository_nwo | IfcOpenShell/IfcOpenShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 40473201 |
| octolytics-dimension-repository_network_root_nwo | IfcOpenShell/IfcOpenShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cf73f57448d52b3a7b619195e182b33d3b3454ca |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width