Menu

How does generating C++ code from EXPRESS files work?

Rick
2021-04-11
2021-06-23
  • Rick

    Rick - 2021-04-11

    Looking at the Ifc4x1.h/.cpp and other files, I see that they are generated from a python script that reads EXP files.

    Where is the python script? How does this process work?

     
  • Rick

    Rick - 2021-06-23

    Thomas - I'm trying to generate parsing code for the IFC4x3 RC3 and RC4 specification. The express_parser.py script is producing errors as shown below. I've copied the EXP file into the ...\express folder so I don't think it's an input\path issue. Any suggestions?

    I've verified I'm using python 3.9.0 and pyparsing is installed (import pyparsing does not generate errors)

    PS F:\IfcOpenShell\src\ifcopenshell-python\ifcopenshell\express> python express_parser.py IFC4x3_RC3.exp header implementation schema_class definitions
    Traceback (most recent call last):
      File "F:\IfcOpenShell\src\ifcopenshell-python\ifcopenshell\express\express_parser.py", line 483, in <module>
        m = parse(sys.argv[1])
      File "F:\IfcOpenShell\src\ifcopenshell-python\ifcopenshell\express\express_parser.py", line 474, in parse
        ast = syntax.parseFile(fn)
      File "F:\Python\Python39\lib\site-packages\pyparsing.py", line 2585, in parseFile
        raise exc
      File "F:\Python\Python39\lib\site-packages\pyparsing.py", line 2969, in parseImpl
        raise ParseException(instring, loc, self.errmsg, self)
    pyparsing.ParseException: Expected "schema", found '<'  (at char 6), (line:7, col:1)
    PS F:\IfcOpenShell\src\ifcopenshell-python\ifcopenshell\express>
    
     
  • Thomas Krijnen

    Thomas Krijnen - 2021-06-23
    found '<'  (at char 6), (line:7, col:1)
    

    Suggests some pretty significant schema error. Are you sure you're parsing the actual express text file and not something completely else, let's say HTML? Can you copy the .exp you're parsing?

     
  • Rick

    Rick - 2021-06-23

    The problem was the express file. It copied to my computer as HTML. Sorry to waste your time - I didn't think to check that.

    I got a file from bSI and now the code generate is working.

    For the next step, should I take the Ifc4x3_rc3.h/cpp and other generated files, move them to the IfcParser folder, add them to the VisualStudio project and build?

     

Log in to post a comment.