[IFC] import and merge

edited December 2022 in General

Good morning all

I am currently having problems importing IFC2X3 from civil 3D into blender,
I have this error message

i tried to change the applcation name in the code of the ifc file, badly it didn't work
if you have any other idea?
I have ifc's that come from multiple sources.
I must must assemble with you advice?
I intended to create a box on each ifc to have a reference object.

thanks in advance

Tagged:
«1

Comments

  • This bug should've been fixed, see: https://github.com/IfcOpenShell/IfcOpenShell/issues/1313

    However, for merging IFCs, I recommend using the IfcPatch MergeProject recipe instead of importing into a single file then exporting. That is the more correct way of doing it.

  • edited July 2021

    Hello,
    and how is the procedure? on win10 :-(
    I open an IFC with BlenderBIM (2.93 and 210605)

    then I go to the IFC Merge Tab. Choose the MergeProject recipe.
    Input IFC is the path to IFC1
    Output IFC the path to the result IFC3 ? (or is it the IFC2 file in which IFC1 is merged?)
    Arguments??
    Differently: open IFC1, IFC2 as Input, xx as output.. arguments : nothing
    Python: Traceback (most recent call last):
    File "C:\Users\alberts\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\bim\module\patch\operator.py", line 44, in execute
    ifcpatch.execute(
    File "C:\Users\alberts\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\libs\site\packages\ifcpatch__init__.py", line 19, in execute
    patcher.patch()
    File "C:\Users\alberts\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\libs\site\packages\ifcpatch\recipes\MergeProject.py", line 12, in patch
    source = ifcopenshell.open(self.args[0])
    IndexError: list index out of range

    location: :-1

    Where to find help? documentation?
    Lukas

  • edited July 2021

    @lukas the usability and (completely non-existent) documentation around IfcPatch needs to be improved. Would really love help on this :)

    Merge effectively does IFC1 + IFC2 = IFC3. The Input IFC is the path to IFC1. In the arguments you specify a JSON encoded string path to IFC2 (e.g. ["/path/to/ifc2.ifc"]). Then the output IFC is the path to IFC3. The error you see is because it is looking for the IFC2 argument which doesn't exist.

  • Sorry for troubling you..
    I first open IFC1 with BlenderBIM-add-on. I type IFC1 in the Input Patch (select the file)
    Then I select the output file (some empty existing txt-file renamed as .ifc)
    And then comes the argument in json format.. (on win10?).. ["C:\users\lalberts\Desktop\IFC2.ifc"] did not work.
    json.decoder.JSONDecodeError: Invalid \escape on line1 column 5 (char 4) (that 's the \ for the win10 path?)
    so I replaced the "\" by "/" ... now something is running: bpy.context.scene.BIMKPatchProperties.ifc_pages_args= "[\"C:/Users/alberts/Desktop/IFC3.ifc\"]"
    but nothing is merged?
    now: bpy.context.scene.BIMKPatchProperties.ifc_pages_args=" [\"C://Users/alberts/Desktop/IFC3.ifc\"]"
    using ["C://Users/alberts/Desktop/IFC3.ifc"] gave an error: RuntTImeError: Instance #36 not found
    location: : -1
    going to lines 44, 19, 17, 46, 19, 46, 14, 196, 111, 99, 1498 and fails..

    win10 is a problem.. try my linux laptop later.
    Lukas

  • I'm not sure what BIMKPatchProperties are, nor ifc_pages_args. They do not seem to be part of the BlenderBIM Add-on. Are you perhaps writing your own script? Feel free to catch me online on the OSArch chat and let's screenshare.

  • edited July 2021

    No, I am not able to code anything.. (this K is a typo mistake from my side..sorry)
    of course one does NOT see the merged process without opening the ifc3.ifc file :-) .. too bad.. so
    it worked once, but need to redo it.. seems I need to restart Blender between failed attempts..
    replacing \ by / , it should be ["C://path/to/IFC2.ifc"] in win10. (path without empty spaces in the name?)
    Thanks
    Lukas

    MoultMohamedElmasri
  • Glad you got it working :) Yes, the file paths on Windows are always a bit annoying to deal with.

  • I merged a 'revit'.ifc with a 'dds-cad'.ifc. Seems like only BlenderBIM/IfcOpenShell can manage this.
    How can we gratify You to have started this here.. wonderful.
    Take care.. do not overwork yourself :-)

    MoultbrunopostleAldo
  • Hi Moult,
    Sorry to dig up an older thread, but I seem to have trouble when testing the MergeProjects in BlenderBIM.
    I've set up two test IFC files (IFC_01 and IFC_02) and prepared a dummy IFC file to merge into (IFC_MERGE). With these file I've defined all the input fields as discussed in this thread:

    But when I run IFCPatch, I get an error and nothing really is processed with IFCPatch:

    Any idea what I'm doing wrong and how to fix it?
    Thank you!

  • If you are on windows do all forward slashes in all the fields...https://wiki.osarch.org/index.php?title=BlenderBIM_Add-on/IFC_Patch_Recipes
    Also, i don't think you need double forward slashes.

  • edited October 2022

    @theoryshaw said:
    If you are on windows do all forward slashes in all the fields...https://wiki.osarch.org/index.php?title=BlenderBIM_Add-on/IFC_Patch_Recipes
    Also, i don't think you need double forward slashes.

    The same thing still happens with these inputs:

  • Can you try to merge (2) simple, trouble-shooting IFC files?... just to make sure it's not the file(s).

  • also, are you on windows?

  • Yes, I'm on Windows. I tries with backslashes and it doesn't work as it can't even parse the input parameters. With forward slashes it still doesn't work, but the parameters aren't the issue, parsing IFC SPF header is.


    I'm appending both simple test files created from Revit (01 - four walls, 02 - slab).

  • edited October 2022

    i saw that both of your model are IFC2x3. Try upgrading it with BlenderBIM first to IFC4.

    and try afterwards with the merge recipe.

    if the file are exported from revit, why did you not export it to IFC4?

  • edited October 2022

    This example should help

  • @Martin156131 said:
    if the file are exported from revit, why did you not export it to IFC4?

    OK, I'll try with IFC4 upgrade and test it out.
    To answer why IFC2x3 is still used. The sad truth is that some software developers (especially for infrastructure modelling) still haven't upgrade to IFC4 and it's thus impossible to properly collaborate over IFC4 models since they can't export them. I know that there are some ways of going around this issue (you just mentioned one), but unfortunately for BIM coordinators you have to take into consideration the "weakest link" and find the common denominator that everybody can successfully work with. So IFC2x3 it still is.

  • edited October 2022

    I now tried with proper paths (double backslashes) for my original files and I got a new error:

    Checking into more detail, I figured that the file being appended is missing line #2810:

    This should reference to a property in user defined property set that just isn't there. I don't know why this happens as it's also a pure Revit IFC2x3 export and the file was not manipulated in any way whatsoever. I'll try with some other files and see the result...

    EDIT1:
    I've tried with other IFC2x3 files and only the appending file is the issue which does makes sense.
    The script also works fine if there are no "missing lines" referenced as described above. I know this is not proper handling of IFC structure, but is there a possibility for the recipe to ignore missing lines?

    EDIT2:
    Testing with multiple IFCs in arguments' list also doesn't work. The script only takes the [0] element in list and ignores all the rest. If that's the required behaviour, then there's no problem. But if merging multiple (more than 2) IFCs is the goal, than this would need to be upgraded. I know it sounds demanding for a free tool, but if you want to develop it as far as possible, these are possible options. ;)

  • @jure_cesnik said:
    To answer why IFC2x3 is still used. The sad truth is that some software developers (especially for infrastructure modelling) still haven't upgrade to IFC4 and it's thus impossible to properly collaborate over IFC4 models since they can't export them. I know that there are some ways of going around this issue (you just mentioned one), but unfortunately for BIM coordinators you have to take into consideration the "weakest link" and find the common denominator that everybody can successfully work with. So IFC2x3 it still is.

    Can't you in a CDE that is out there in the market, federate different IFC's that have different IFC Schemas (IFC4 or IFC2x3)?

  • This seemed to work on my side...
    Looks like you need to 'escape' the backslashes...

    Ace
  • @Martin156131 said:
    Can't you in a CDE that is out there in the market, federate different IFC's that have different IFC Schemas (IFC4 or IFC2x3)?

    Yeah that's definitely a possibility, but sometimes clients demand a very specific version of the IFC standard and then you, as a designer, have to comply with that. I really wish that software vendors would integrate the latest versions ASAP and that project owners would have educated and well-versed BIM personnel, but real-life experience has provided us with proof of the opposite. So for better or for worse IFC2x3 isn't going away anytime soon...

    Martin156131
  • When i merge, this happens:
    Looks like a scaling problem... If i import the ifc files seperatly in a blender project, no problems.

  • edited November 2022

    One file might be in mm, and the other in meters?
    when you import the ifc files individually, and go to the following, are the units different?

    If that's the case, not sure how to convert a file that's in meters to millimeters or vice versa.

  • Units are the same.. But when i import them individually so 1 blender file and i import both ifc's into that project they are perfect alligned and scaled. But i wanted to use the IfcPatch since it looks like a more elegant way to do it, but then one model is scaled for some reason..

  • I ended up mergin the files with another (commercial) tool SimpleBIM and it seemed to work fine. So I am still convinced that the patch has a bug in it tbh...

  • can you share ifc files, or a parred down version of them?

    1. so the file with out the spaces and 2. just the spaces
Sign In or Register to comment.