BlenderBIM crashing when loading IFC file

I'm managed to generate and IFC file that crashes BlenderBIM. I know the problem is with the file and not BB. I just can't figure out what I'm doing wrong. The error report and file are attached if anyone wants to take a look. Thanks.

Comments

  • This file also crashes Open IFC Viewer 24.7

  • We don't yet support IfcAxis2PlacementLinear which is new in IFC4X3. Could you help write a Python implementation of it?

  • I can try to help, but not sure where to begin. My Python is pretty rusty as I work mostly in C++ - I've recently been in contact with Thomas from IfcOpenShell and the guy who was writing the alignment stuff in python. We are going to collaborate a porting the alignment code to C++. Addressing IfcAxis2PlacementLinear in that work seems logical to me.

    In the meantime, can you point me to a viewer or other tool that might help me figure out if I'm remotely close to generating the correct IFC for AbRV?

    theoryshaw
  • Addressing IfcAxis2PlacementLinear in that work seems logical to me.

    Sort of. Right now, especially for objects with no geometry but with an object placement, there are pure Python implementations to get the placement matrixes which are currently only implementing local placements (i.e. no grid placements, definitely no linear placements): https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/ifcopenshell-python/ifcopenshell/util/placement.py#L49

    The best scenario would be to have the C++ implementation of it updated to 1) handle all placement types, including linear placements and 2) exposed to Python so that we don't need to do the work twice. Otherwise we'd need to rewrite it in Python which is a shame.

    Ping @aothms

    I'm not sure of a viewer that might help, sorry.

  • It seems like the tricky part is implementing something for IfcPointByDistance. Once that is resolved to a point, IfcAxis2PlacementLinear is equal to IfcAxis2Placement3d. A subset of the curve types for IfcPointByDistance are the same curves as an alignment would use.

    I’m willing to attempt this project but I’ll need some guidance to get started

  • That makes sense, I think @aothms might know the best way to proceed.

  • I had to change my code to generate a straight, flat bridge using IfcLocalPlacement and IfcExtrudedAreaSolid to get a graphical representation
    Starting with baby steps :)

    theoryshawMoultAceemiliotasso
  • edited May 8

    It took a fair bit of work, but I've got a very simple IFC 4x3 ADD2 bridge model in blenderbim using IfcOpenShell v0.8.0. The model uses IfcLinearPlacement, IfcSectionSolidHorizontal, and other alignment related entities.

    theoryshawMoultJohnatomkarincabrunopostlesteverugi
  • edited 7:51AM

    Hi @Rick_Brice :

    It took a fair bit of work, but I've got a very simple IFC 4x3 ADD2 bridge model in blenderbim using IfcOpenShell v0.8.0. The model uses IfcLinearPlacement, IfcSectionSolidHorizontal, and other alignment related entities.

    Awesome stuff, would you care to share the procedure, if possible?
    my colleague created a Python script to automate culvert construction based on parameters (BBIM) and would love to know more of your work
    thanks

  • @Rick_Brice said:
    I'm managed to generate and IFC file that crashes BlenderBIM. I know the problem is with the file and not BB. I just can't figure out what I'm doing wrong. The error report and file are attached if anyone wants to take a look. Thanks.

    Btw is there some issue with PGSuperExport.ifc?
    Seems to still fail (now with a segfault) on v0.8.0 branch:

    import ifcopenshell
    import ifcopenshell.util.placement
    
    ifc_file = ifcopenshell.open(r"PGSuperExport.ifc")
    # #593=IfcAxis2PlacementLinear(#590,#591,#592)
    placement = ifc_file.by_id(593)
    ifcopenshell.util.placement.get_axis2placement(placement)
    print("Never printed because of segfault")
    
  • Not surprising - the file attached to the earlier post had errors. I've since corrected them. Here is a new file.

    Not sure if the error is in the C++ code or the Python code for IFCOS

    import ifcopenshell
    import ifcopenshell.util.placement
    ifc_file = ifcopenshell.open(r"PGSuperExport.ifc")
    placement = ifc_file.by_id(887)
    print(placement)
    #887=IfcLinearPlacement($,#886,$)
    ifcopenshell.util.placement.get_axis2placement(placement)
    Traceback (most recent call last):
      File "<pyshell#5>", line 1, in <module>
        ifcopenshell.util.placement.get_axis2placement(placement)
      File "F:\Python\Python311\Lib\site-packages\ifcopenshell\util\placement.py", line 93, in get_axis2placement
        return a2p(o, z, x)
    UnboundLocalError: cannot access local variable 'o' where it is not associated with a value
    
  • @Rick_Brice said:
    Not sure if the error is in the C++ code or the Python code for IFCOS

    get_axis2placement is expecting IfcAxis2PlacementLinear, not IfcLinearPlacement. Or you can use get_local_placement that works with IfcLinearPlacement. Either way, new file indeed seems to work fine on v0.8.0

    import ifcopenshell
    import ifcopenshell.util.placement
    ifc_file = ifcopenshell.open(r"PGSuperExport.ifc")
    placement = ifc_file.by_id(886)
    print(placement)
    #886=IFCAXIS2PLACEMENTLINEAR(#883,#884,#885);
    print(ifcopenshell.util.placement.get_axis2placement(placement))
    # [[ 1.     -0.     -0.      0.3048]
    #  [ 0.      1.     -0.      0.    ]
    #  [ 0.      0.      1.      0.    ]
    #  [ 0.      0.      0.      1.    ]]
    # finished
    print('finished')
    
  • sweet!
    By bad - I'm still kind of new to all of this.

Sign In or Register to comment.