Open wtaisto opened 3 years ago
See these two questions from past: https://github.com/xBimTeam/XbimEssentials/issues/160, https://github.com/xBimTeam/XbimEssentials/issues/46
As you have already identified, IFC is primarily a semantic model of the building, not a straightforward scene graph. Geometry is just one of the characteristics used to describe a real world object. You can use spatial structure of (IfcSite, IfcBuilding) to reflect the composition. IfcBuilding can also have nested IfcBuildings if it makes sense in your case.
The complicated part is to align units, IFC versions and spatial placement in case your files are not well aligned at first place or use different conventions in how they structure the placement hierarchy,
Thanks so much for your response Martin. Luckily as of now all of my source content is coming out of the same system and uses shared conventions. I saw in my readings on the net that it's not uncommon to break up a larger building into sub-buildings, and I was thinking of trying an approach where I'd follow the IfcLocalPlacement->PlacementRelTo linkages of the source entities and make sure they all tie back to a IfcBuilding as their placement root, and then apply my transforms to that IfcBuilding.
One specific question on the use of the XbimInstanceHandleMap; is it proper usage, if I want to remap, for instance, all the IfcProject references in a source file into the combined IfcProject reference in the dest file, to pre-populate the Map as shown below, and then just pass the populated map to InsertCopy?
var map = new XbimInstanceHandleMap(srcModel, destModel);
var srcProject = srcModel.Instances.OfType<IfcProject>().Single();
map[new XbimInstanceHandle(srcProject)] = new XbimInstanceHandle(destProject);
Interesting! I never used it this way, but yes, this should work fine. Don't forget to check if both models use same length and angle units though.
I have prototypes working for the above approach, thanks for your feedback! The only piece I am struggling with is some way to get IFC's placement / geometric system to mirror geometry along an axis. It seems like the IfcAxis2Placement3D assumes a handedness to the coordinate system, as it is defined via supplying X and Z axis directions, and assumes that Y points in the right-handed positive cross product of X and Z. My application needs to be able to negate all the X values, i.e. reverse the direction of the X axis, but without flipping the directions of Y or Z. I was hoping to be able to achieve this mirroring effect purely via coordinate system transforms; is this not possible? Might I be able to get creative with IfcGridPlacement?
I know this is more of a "How does IFC work" question than "how does this API work", but any thoughts or suggestions would be appreciated. Thanks again!
You are right @wtaisto , IFC assumes right-handed orientation of the system. Your original question was about merging of IFC models into one, so all the data should already be in the right system I guess? There are 3D transformation operators in IFC which could be used for mirroring. But I don't think this is widely used so you may need to check other tools support for this feature.
I have as input a series of IFC files which each contain a piece of a building. For each file, I need to position its content in a combined IFC file, using a given positioning transform (translation, rotation, and a possible scale of -1 for a single dimension to mirror the content.)
I'm coming from the 3d graphics space, where we can nest 3d content arbitrarily in a scene graph, each node applying its own local transform for all children. Is there a comparable "grouping" structure in IFC? I'd like for the combined IFC file to ideally contain some element for each input file, and have all of that file's content be "inside" that element; essentially treat each input file as a somewhat self contained bag of content which just gets placed in the combined file at the supplied location and orientation.
I'm somewhat early in my learning of the IFC paradigm and wonder if anyone might have suggestions on which types of IFC entities I should be using to accomplish this? I've got code (largely) working which calls IfcStore.InsertCopy to merge the input files together, but am not sure what the best approach for the positioning would be. Any suggestions on high level approach, classes to be utilizing, and potential gotcha's would be greatly appreciated. I have scanned through all the sample code I've been able to find, but if someone knows of a sample that does something similar to this, a link would be greatly appreciated.
Thanks for the wonderful set of tools!