IfcConvert enhancements#42
Conversation
…pfStream ctor. Bug surfaced due to recent memory leak fix.
…. Remove C++-specific getters and setters and use the same set() and get() functions in in both C++ and Python. Enhance output of IfcConvert, especially in error situations (spamming a hundred lines of options always hides the original error message), utilize Boost's foreach macro to provide cleaner iteration code.
…lement-names. Add explicit --use-material-names for controlling material naming.
| } | ||
| return id; | ||
| /// @todo Very simple impl. Assumes that input vertices and normals match 1:1. | ||
| static std::vector<real_t> box_project_uvs(const std::vector<real_t> &vertices, const std::vector<real_t> &normals) |
There was a problem hiding this comment.
Nice. Ideally this would be moved to IfcGeom::Representation::Triangulation and uvs added as member vector. Then it would be trivial to re-use this for obj/blender/max/etc.
There was a problem hiding this comment.
Sure, I had a plan to move this somewhere for reuse, wasn't just sure to what class/file. I should also have a "proper" (takes in face indices as a parameter) version of this function lying around somewhere.
|
Nice. Just a few in-line comments. |
|
BTW in SVG the elements are named currently like this: Was thinking that maybe the "product" prefix could be dropped in order to have consistent naming in all formats? |
…nclude --names "Wall Compound*"
|
Well, I assume nobody really cares, but XML identifiers are not supposed to start with a number [1]. This is the reason for the |
|
I see, in that case some kind of prefix could be justified for XML output's sake. BTW was thinking to change the default behavior of overwriting output file always to fail instead and having a |
|
|
Aye, prompt sounds good. |
|
Just a status update: I have been looking into writing UVs for OBJ which turned out to be not 100% trivial task on my spare time but I should able to figure out by looking some existing exporters for pointers. |
|
Ok, let me know where I can assist. |
…ent writing of UVs for OBJ output.
|
OK. Could you give a few pointers how you would like the scene bounding box to be precomputed? Should this occur in IfcGeom::Iterator::initialize()? |
|
I think that would be a good place. Question also is what products to include. If only including products that will be emitted, you have the risk of users processing types separately being unable to overlay their models geometrically. So, I'm guessing something like this would work: |
|
Is it possible to get a reliable IfcBoundingBox for a product? |
…ment --center-model for OBJ.
|
Some models contain explicit BoundingBox representations for products. For most other representations it can potentially be straightforward to compute them, without too much computation, except for things like boolean operands where computing the boundingbox is basically equivalent to the actual geometry processing. If the goal is mostly to workaround issues like #8 and maximizing floating point precision it shouldn't really matter whether to use the bounding box or placement origin. Most of these cases come from a very large translation at the IfcSite or IfcBuilding level. For example in the case of #8 . If this offset would be introduced within the geometries the model would be seriously flawed. From that point of view an alternative way of alleviating this problem would be an option to ignore Site and Building-level placements. That is also quickly to implement and might even work more predictably to users. |
|
fyi, I am also opening a pull request #47. I will wait with merging as our PRs will conflict. It contains some performance improvements that I guess are also of interest to you. Most notably in collada files, geometrical instances (IfcMappedItems) can now re-use the same geometry definition. Also, it seems that this caching is not doing us any good. Would appreciate a second eye testing this. |
|
Great, those improvements sound good for us. This PR should be now ready to go. |
|
Or, I could try squeezing in the --yes/-y switch and/or temporary output file if we're not in a hurry. |
…irmation for overwriting. Overwriting can be forced with -y/--yes
|
Added usage of temporary file and file overwrite switch. Let me know what you think. |
| ColladaExporter(const std::string& scene_name, const std::string& fn, ColladaSerializer *_serializer) | ||
| : filename(fn.c_str()) | ||
| , stream(filename) | ||
| /// @todo We could use the double precision feature here, but it seems to bloat the output file quite a bit |
There was a problem hiding this comment.
Ow, I didn't know about this bool doublePrecision = false argument! Well, we should probably check here if these trailing 9s can somehow be traced back to something in the IFC file, or whether it is something produced inside IfcConvert.
I traced opencollada's double writing all the way to some formatting library:
https://github.com/KhronosGroup/OpenCOLLADA/blob/f4b31b4327b0eaaf539f57c618c39be83331aebd/common/libftoa/src/Commondtoa.cpp
9s could also be an artefact of that.
There was a problem hiding this comment.
On first sight, it seems to me though we should enable this.
There was a problem hiding this comment.
Yeah, looking the numbers a bit more closely, if doublePrecision = true is used, the values in DAE seem to be closer to what they are in IFC.
|
This can be merged, if deemed OK. However, I also started looking into "include/exclude with children" functionality as an acute need emerged for that (complex model with many buildings but I only need geometry for one or two storeys and without --weld-vertices (I'm using --generate-uvs) he DAE is too big (almost 500 MB) for importers). |
|
If you don't mind I would like to go ahead and merge. Please create a new PR when ready. Thanks for your great work. PS: Don't forget to test the file on my feature branch #47 as I'm sure the geometry instancing will cut a great deal from your DAE file. |
|
OK, great. I already have a working version of |
| } | ||
|
|
||
| foreach(const boost::regex& r, names_to_include_or_exclude) { | ||
| if (boost::regex_match((*jt)->Name(), r)) { |
There was a problem hiding this comment.
Ah, fyi, when merging my own PR I found one small oversight. Name is an optional attribute so its existence to be checked with hasName() first. This should be urgently addressed on a schema level in 0.6 so that optional attributes are of type boost::optional<T> (#50).
Sounds good. I think it's descriptive enough. I'm not sure at this point what is easier to implement in terms of
I am fine with the way it is, but am also open to changing it. One last remark, if you try the feature branch mentioned above, be sure to checkout |
|
I'm quite busy with a project but I should have some time for testing on Thursday. |
Both PR #7798 (ManualDrawingReference) and PR #8083 (parametric_dimensions) independently added properties after entry #33 in Psets_BBIM_Annotation.ifc and new BoolProperty declarations after `type_name` in prop.py and workspace.py UI rows at the same locations. Resolution: keep #8083's IDs (#34-#40) unchanged, renumber #7798's IsManualDrawingReference and IsDocumentReference entries to #41 and #42, update EPset_Annotation reference list accordingly, keep both UI rows, and combine hotkey_S_A to use #8083's parametric-dimension routing with #7798's "INVOKE_DEFAULT" argument for add_annotation.
Both PR #7965 (inset_section_endpoints) and PR #8083 (parametric_dimensions) independently added properties after entry #33 in Psets_BBIM_Annotation.ifc and new BoolProperty declarations after `type_name` in prop.py and workspace.py UI rows at the same locations. Resolution: keep #8083's IDs (#34-#40) unchanged, renumber #7965's IsManualDrawingReference and IsDocumentReference entries to #41 and #42, update EPset_Annotation reference list accordingly, keep both UI rows, and combine hotkey_S_A to use #8083's parametric-dimension routing with #7965's "INVOKE_DEFAULT" argument for add_annotation.
Features discussed in #20. Opening up for an initial review, couple more commits pending.