打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
The Building Coder: Forge Formats Python Script and IFC Open Shell

I went back to answering way too many questions inthe Revit API discussion forum yesterday.

However, two other interesting topics also cropped up when I finally let go of that pastime(娱乐), and I just finished a good book:

The Sellout by Paul Beatty

I just finishedreading The Selloutby Paul Beatty.

I struggled a bit initially before getting used to his style, then really deeply enjoyed this unique American satire(讽刺) on racism(种族主义).

It won the Man Booker Prize, and Beatty is now the first writer from the United States ever to be thus honoured.

It hits hard to caringly and lovingly reach into and explore some pretty deep and subtly hidden everyday truths.

It is sometimes also just funny.

Here is a metaphor(暗喻) I liked describing two men who don't quite fit in: "Like Nazis at a Ku Klux Klan rally, they were comfortable ideologically(思想上), but not in terms of corporate culture."

:-)

IFC Ids and Open Shell

Question: Where can I ask questions about general IFC related stuff?

I would like to hack together something to display IFC models in the browser.

To do that, the server is converting uploaded IFC files first to Collada, then to a JSON format used by three.js.

This conversion process is problematic(问题的) if the IFC IDs are not unique, which sometimes they are not.

I could burp(打嗝) out an error at the user, but I'd rather try to fix it silently if possible.

I've thought about 'fixing' the IFC file before conversion by simply searching for duplicated IFC IDs and creating new (unique) IDs for those elements.

Since I'm only doing this conversion for 3D display purposes, do you think that could work, or is it fundamentally flawed?

I'm basing this on the assumption that all IFC elements seem to be referred to by line number, not ID, so the specific ID doesn't really matter for my purposes, as long as it's unique.

Answer: I am not an IFC expert by any means, but here is a recent Autodesk University classan [IFC Technical Overview] presented by someone who is   :-)

I was heavily involved a long, long time ago.

Yes, the IFC id just has to be unique within the context of the IFC file itself, afaik.

[Q]: Are there any situations where several different IFC files cross reference each other and refer to their respective internal ids?

I recently summarised(概括) all I know aboutthe consistency of IFC GUID and UniqueId,including links to earlier discussions.

If the answer to [Q] is no, then you can assign any id you like, of course.

Even if the answer is yes, but no such cross-referencing occurs in your situation, you should still be able to go ahead.

Also, if you are getting all your elements from Revit BIM, you can use the Revit element UniqueId just as it is. It is guaranteed to be unique, and thus enables cross referencing between different files and models... unless the files contain copies of element that occur elsewhere as well, e.g., you copied the BIM and the elements contained within it, of course. That obviously leads to duplication(复制).

Regarding the three.js viewer:

You might want to discuss your question with the Revit IFC open source community.

You might also want tocontact Jon @jmirtsch Mirtschin, author ofthe GeomGym IFC library.

The IfcOpenShell project (GitHub) also looks very promising.

Response: I actually currently use IfcOpenShell to convert from IFC to DAE via IfcConvert.

After that I segment the DAE files so that each IFC storey(楼层)/space/etc. gets its own file based on information in the IFC model, parsed using Xbim.

That way, the clients can download only the storey/space they are interested in.Then I convert each storey/space DAE file to JSON, which is smaller and has much less memory requirements due to the browser not needing to parse an XML document (which it has to if loading the DAE file).

Answer: Cool. That sounds like a very useful workflow. Might come in handy in other contexts as well.

People just recently asked how to compress large BIM models for Forge. Your approach might help there too.

Other suggestions include:

  • Simplify the BIM model before translation. Reduce geometry complexity, remove overly detailed aspects.
  • Split the BIM RVT into separate files, e.g., by level or discipline, before submitting them for Forge translation. You can use the Forge aggregation(聚合) functionality to put them back together again at need.

Forge Formats Python Script

I just published the beginning of anew collection of Forge Python scripts,currently with a count of one:

py_forge_formats.pyimplements a Python wrapper around two basic RESTful Forge web service calls:

The result is prettified(美化) using the jprettyprint helper function.

The mainline ties it all together and presents the final result, which looks like this at the time of writing:

$ ./py_forge_formats.py9 Forge output formats:  dwg: f2d, f3d, rvt  fbx: f3d  ifc: rvt  iges: f3d, fbx, iam, ipt, wire  obj: asm, f3d, fbx, iam, ipt, neu, prt, sldasm, sldprt, step, stp, stpz,    wire, x_b, x_t, asm.NNN, neu.NNN, prt.NNN  step: f3d, fbx, iam, ipt, wire  stl: f3d, fbx, iam, ipt, wire  svf: 3dm, 3ds, asm, catpart, catproduct, cgr, collaboration, dae, dgn,    dlv3, dwf, dwfx, dwg, dwt, dxf, exp, f3d, fbx, g, gbxml, iam, idw,    ifc, ige, iges, igs, ipt, jt, max, model, neu, nwc, nwd, obj, pdf,    prt, rcp, rvt, sab, sat, session, skp, sldasm, sldprt, smb, smt,    ste, step, stl, stla, stlb, stp, stpz, wire, x_b, x_t, xas, xpr,    zip, asm.NNN, neu.NNN, prt.NNN  thumbnail: 3dm, 3ds, asm, catpart, catproduct, cgr, collaboration, dae, dgn,    dlv3, dwf, dwfx, dwg, dwt, dxf, exp, f3d, fbx, g, gbxml, iam, idw,    ifc, ige, iges, igs, ipt, jt, max, model, neu, nwc, nwd, obj, pdf,    prt, rcp, rvt, sab, sat, session, skp, sldasm, sldprt, smb, smt,    ste, step, stl, stla, stlb, stp, stpz, wire, x_b, x_t, xas, xpr,    zip, asm.NNN, neu.NNN, prt.NNN

This script replaces and improves on theprevious forgeauthand forgeformats Unixshell cURL scripts documented in the discussion ofthe cURL wrapper scripts to list Forge file formats.

For the sake of completeness(完整), those two scripts have been added to this repository as well.

Setup and Usage

Two aspects need to be prepared: Forge and Python.

Before you can make any use of the Forge web services, you will need to register an app and request the API client id and client secret for itat developer.autodesk.com> my apps.

These scripts assume that you have stored these credentials(证书) in the environment variables FORGE_CLIENT_ID and FORGE_CLIENT_SECRET.

Regarding the Python components:

Now you should be all set to run as shown above.

forge_authenticate_app

forge_formats

jprettyprint

Mainline

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【国外Top20】免费3D模型下载网站,设计师必藏!
0265 轻松记 for forge
IFC300(新)
SAI_IFC-环境和社会责任管理系统执行手册- 英文
常见的3D打印文件格式及常用的软件
【Unity3D】Unity3D Mecanim动画系统骨骼动画问题解决方法
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服