Menu

Developerversio for Windows

2015-07-27
2016-03-10
1 2 3 4 > >> (Page 1 of 4)
  • berndhahnebach

    berndhahnebach - 2015-07-27

    Hi Thomas,

    In addition to self compiled Linux version of ifcopenshell I've started to use the 0.5.0 windows binary provided here (https://sourceforge.net/projects/ifcopenshell/files/0.5.0-preview1/) to import and export ifc into FreeCAD. The provided binary is from 27th of February 2015. Would it be possible to provide an more up to date snapshot for windwos?

    kind regards bernd.

    BTW: Import and Export into FreeCAD does really work well !!!

     

    Last edit: berndhahnebach 2015-07-27
  • Thomas Krijnen

    Thomas Krijnen - 2015-07-28

    Hi Bernd,

    Glad to hear that things work well in FreeCAD, that is for 99% due to the great work by the FreeCAD developers and Yorik van Havre in particular.

    The recent IfcOpenShell developments mostly affect things that would be unrelated to the im/exporter in FreeCAD. Is there something in particular you are missing from the latest released binary? The time required to build and test a new binary release is really quite substantial. Also note that IfcOpenShell strives to be a software library targeted at developers, who preferably are able to do their own compilation.

    Kind regards,
    Thomas

     
    • berndhahnebach

      berndhahnebach - 2015-07-29

      Hi Thomas,

      thanks for your answer. May be some more informations …

      Yorik and myselelf (probably the only ones who have been using the FreeCAD ifc im- and export for really working with it) have only self compiled ifcopenshell used on linux. I started to use the 0.5.0 binary on windwos and run into a few windwos only problems we are currently fixing. We have started to add ifcopenshell to the developer snapshot version of FreeCAD on windows (https://github.com/FreeCAD/FreeCAD/releases/tag/0.16-pre). Since noone off us uses Windows as developing plattform for all this the pre 0.5.0 binary from sourceforge is used. That was the reason I've been asking.

      Mhh I may should start compiling on windows.

      Am I right?
      - Only ifcopenshel 0.5 includes the python wrapper.
      - The official home of 0.5.0 still is your github at https://github.com/aothms/IfcOpenShell
      - the svn here on sourceforge does not include the python wrapper (0.4.0rc2)

      I'm gone start doing what I have been avoiding for almost 15 years :-) Compiling on windows :-)

      kind regards and many thanks for this wonderful piece off software thomas

      cheers bernd

       

      Last edit: berndhahnebach 2015-07-29
  • Stinkfist

    Stinkfist - 2015-07-29

    Hi,

    For effortless IfcOpenShell development on Windows + Visual Studio you might be interested in the build scripts I have cooked up here: https://github.com/Tridify/IfcOpenShell

    In a nutshell, this is all that is needed to have everything set up (assuming that the prerequisites are met):

    git clone https://github.com/Tridify/IfcOpenShell.git
    cd oce\win
    build-deps.cmd
    run-cmake.bat
    copy-runtime-deps.bat
    ..\build-vs2013-x64\IfcOpenShell.sln

     

    Last edit: Stinkfist 2015-07-29
  • berndhahnebach

    berndhahnebach - 2015-07-30

    @stink fist
    wow thanks for sharing!

    • installed git and cmake and VS Express 2015
    • run your build script
    • download and compile for Boost and ICU works fine :-)
    • at cmake of collada and on oce-win I get following error:

    The CXX compiler identification is unknown
    CMake Error at CMakeLists.txt
    No CMAKE_CXX_COMPILER could be found

    I searched the internet for quite a while and found some things to do but noone solved it. CMake just dos not find my pretty new installed compiler :-( Mhh just downloading an iso of VS Express 2013 but this takes 6h. We'll see ...

     

    Last edit: berndhahnebach 2015-07-30
  • Stinkfist

    Stinkfist - 2015-07-30

    Unfortunately VS 2015 doesn't work currently as there are problems with the dependencies. I have made issues/pull requests to OpenCOLLADA and oce-win-bundle to fix these and plan to to one for Open CASCADE too in the near future. So for now I'd recommend using Visual Studio 2013 Community Edition (no need to install the limited Express edition if you are a hobbyist/home user). I've enhanced the script now to show an error if VS 2015 is used.

    If getting the fixes in to the official repos seems to take too long, I'll switch the build script to use the Tridify's forked versions of the dependencies.

    Also, just making sure, remember to run the script in the Visual Studio command prompt so that the VS environment variables are set. For e.g. VS 2013 this can be achieved by finding the "VS2013 x64 Native Tools Command Prompt" shortcut from the "Visual Studio Tools" shortcut folder in Start Menu.

     

    Last edit: Stinkfist 2015-07-30
  • berndhahnebach

    berndhahnebach - 2015-07-31

    Thanks again, I'm a few steps further ... :-)
    installed VS2013
    build-deps.cmd --> ok
    run-cmake.bat --> ok
    copy-runtime-deps.bat --> ok

    ..\build-vs2013-x64\IfcOpenShell.sln

    --> the gui of VS2013 will be opened --> F7 starts building process --> errors occured --> :-(
    70 of them they all are similar, mhh no text it only copys one line ...

    Error 1 error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in ColladaSerializer.obj C:\Users\bhb\Desktop\ifcopenshell\ifcopenshell-code\build-vs2013-x64\OpenCOLLADABaseUtils.lib(COLLADABUURI.obj) IfcConvert

    I could live without collada ...

     

    Last edit: berndhahnebach 2015-07-31
  • Stinkfist

    Stinkfist - 2015-07-31

    By default the scripts build the CMake-based dependencies using the RelWithDebInfo build configuration. For some reason solutions created by CMake default to Debug build when opened for the first time so switch to RelWithDebInfo when the IfcOpenShell.sln has opened and everything should build fine.

     

    Last edit: Stinkfist 2015-07-31
  • berndhahnebach

    berndhahnebach - 2015-07-31

    :-)

     
  • berndhahnebach

    berndhahnebach - 2015-08-05

    If it is in the regard of coding I'm still a newbie in the windows world and have to learn a lot ...

    Checked the version of ifcopenshell by IfcConvert

    C:\Users\bhb\Desktop\ifcopenshell\ifcopenshell-code\build-vs2013-x64\RelWithDebInfo>ifcconvert.exe --version
    IfcOpenShell IfcConvert 0.5.0-dev
    

    Compiled ifcopenshell with python 2.7.8 by changing the pythonverson in build script. It seams to have worked or not because I was not able to import ifcopenshell

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Python 2.7.8 (default, Nov 17 2014, 20:37:05) [MSC v.1800 64 bit (AMD64)] on win32
    Type 'help', 'copyright', 'credits' or 'license' for more information.

    import sys
    path = 'C:\Users\bhb\Desktop\ifcopenshell\ifcopenshell-code\build-vs2013-x64'
    sys.path.append(path)
    path = 'C:\Users\bhb\Desktop\ifcopenshell\ifcopenshell-code\build-vs2013-x64\'
    sys.path.append(path)
    path = 'C:\Users\bhb\Desktop\ifcopenshell\ifcopenshell-code\build-vs2013-x64\ifcwrap'
    sys.path.append(path)
    path = 'C:\Users\bhb\Desktop\ifcopenshell\ifcopenshell-code\build-vs2013-x64\ifcwrap\'

    import ifcopenshell
    Traceback (most recent call last):
    File "<input>", line 1, in <module>
    ImportError: No module named ifcopenshell

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    May I have used the wrong directory? How do I know if the python module of ifcopenshell has been build successfull ?

    Bernd

     

    Last edit: berndhahnebach 2015-08-05
  • Thomas Krijnen

    Thomas Krijnen - 2015-08-05

    Hi,

    Well, the binary part of the wrapper, called _ ifcopenshell _ wrapper . pyd has probably been built. But it requires some additional files to have the actual importable ifcopenshell module ready.

    The folder structure looks like this:

    • ifcopenshell/
      • _ init _ . py [1]
      • _ ifcopenshell _ wrapper . pyd [2]
      • guid . py [1]
      • ifcopenshell _ wrapper . py [3]
      • geom/
        • _ init _ . py [1]
        • occ_utils . py [1]

    [1] from the repository: https://sourceforge.net/p/ifcopenshell/svn/HEAD/tree/trunk/src/ifcopenshell-python/ifcopenshell/
    [2] built by the MSVC project
    [3] generated by SWIG, on Windows, probably in ./src/ifcwrap/

    Kind regards,
    Thomas

     

    Last edit: Thomas Krijnen 2015-08-05
  • berndhahnebach

    berndhahnebach - 2015-08-05

    Wow Thomas thanks for the fast anser. It works, but I have to do further investigation because ...

    Python 2.7.8 (default, Nov 17 2014, 20:37:05) [MSC v.1800 64 bit (AMD64)] on win32
    Type 'help', 'copyright', 'credits' or 'license' for more information.
    >>> 
    >>> import sys
    >>> path = 'C:\\Users\\bhb\\Desktop\\ifcopenshell\\ifcopenshell_for_freecad\\'
    >>> sys.path.append(path)
    >>> import ifcopenshell
    Traceback (most recent call last):
      File "<input>", line 1, in <module>
      File "C:\Users\bhb\Desktop\ifcopenshell\ifcopenshell_for_freecad\ifcopenshell\__init__.py", line 41, in <module>
        raise ImportError("IfcOpenShell not built for '%s'" % python_distribution)
    ImportError: IfcOpenShell not built for 'windows\64bit\python2.7'
    >>> 
    

    But this does not happen today ... :-)

    EDIT: I'm gone try to install 32bit python, test and report back tomorow. But even if it works I would like to know how to cook a 64 bit ifcopenshell? BTW it says everywhere 64bit in build directory ?!? Mhh further investigation is really needed ...

    EDIT2:
    the compiled python-wrapper is 64bit

    C:\>cd C:\Users\bhb\Desktop\ifcopenshell\ifcopenshell_for_freecad\ifcopenshell
    C:\Users\bhb\Desktop\ifcopenshell\ifcopenshell_for_freecad\ifcopenshell>dumpbin /headers _ifcopenshell_wrapper.pyd | findstr "machine"
                8664 machine (x64)
    

    more investigation if it really was compiled with python 2.7 ...

     

    Last edit: berndhahnebach 2015-08-06
  • Stinkfist

    Stinkfist - 2015-08-06

    berndhahnebach, if you build using my build scripts and did not provide any parameters to the build scripts, you should have 64-bit build at your hand. For accessing IfcOpenShell from Python, I have actually not tried that myself yet, but I have simply tested that the _ ifcopenshell _ wrapper builds OK and SWIG stuff works.

     
  • Thomas Krijnen

    Thomas Krijnen - 2015-08-06

    When the binary module is imported, all exceptions are caught and a more generic ImportException is thrown. This is nice for end-users so they get a hopefully more understandable error message, but in this case it probably obscures the real problem.

    What you can try is in ./ifcopenshell/--init--.py replace

    try:
        from . import ifcopenshell_wrapper
    except:
        raise ImportError("IfcOpenShell not built for '%s'" % python_distribution)
    

    with simply

    from . import ifcopenshell_wrapper
    

    so that you can see the underlying exception Python throws.

    One quick note though: if I'm not mistaken Python 2.7.8 is built with MSVC 2008 and a specific service pack / security update. For best compatibility it is best to stick to the exact same compiler version so that the executable and binary module use the same runtime library. That said, I still haven't really figured out yet how to deal with this in the case of the binary releases of IfcOpenShell itself.

    Hope that helps,

    Kind regards,
    Thomas

     

    Last edit: Thomas Krijnen 2015-08-06
  • berndhahnebach

    berndhahnebach - 2015-08-06

    Thank you guys. OK, I'm trying to get it run with python 3.4 first ...

    • reinstalled python 3.4 64 bit for windows
    • full new rebuild including git clone ifcopenshell with python 3.4

    • tested IfcConvert.exe
      --> is 64bit --> ok
      --> convert an ifc to obj and load the obj in blender --> ok

    • copied folder ifcopenshell from source:
      --> from myifcoscodedir\src\ifcopenshell-python\ifcopenshell

    • copied _ifcopenshell_wrapper.pyd
      --> from myifcoscodedir\build-vs2013-x64\ifcwrap\RelWithDebInfo

    • checked if _ifcopenshell_wrapper.pyd is 64bit
      --> io

    • copied ifcopenshell_wrapper.py
      --> from myifcoscodedir\build-vs2013-x64\ifcwrap

    open python 3.4 konsole

    Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
    Type "copyright", "credits" or "license()" for more information.
    >>> import sys
    >>> path = 'C:\\Users\\bhb\\Desktop\ifcos\\ifcopenshell--python34--module\\'
    >>> sys.path.append(path)
    >>> import ifcopenshell
    
    Traceback (most recent call last):
      File "C:\Users\bhb\Desktop\ifcos\ifcopenshell--python34--module\ifcopenshell\__init__.py", line 40, in <module>
        from . import ifcopenshell_wrapper
      File "C:\Users\bhb\Desktop\ifcos\ifcopenshell--python34--module\ifcopenshell\ifcopenshell_wrapper.py", line 28, in <module>
        _ifcopenshell_wrapper = swig_import_helper()
      File "C:\Users\bhb\Desktop\ifcos\ifcopenshell--python34--module\ifcopenshell\ifcopenshell_wrapper.py", line 24, in swig_import_helper
        _mod = imp.load_module('_ifcopenshell_wrapper', fp, pathname, description)
      File "C:\Program Files\Python34\lib\imp.py", line 243, in load_module
        return load_dynamic(name, filename, file)
    ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<pyshell#3>", line 1, in <module>
        import ifcopenshell
      File "C:\Users\bhb\Desktop\ifcos\ifcopenshell--python34--module\ifcopenshell\__init__.py", line 42, in <module>
        raise ImportError("IfcOpenShell not built for '%s'" % python_distribution)
    ImportError: IfcOpenShell not built for 'windows\64bit\python3.4'
    >>> 
    

    change --init--.py as suggestet by thomas

    >>> import ifcopenshell
    Traceback (most recent call last):
      File "<pyshell#6>", line 1, in <module>
        import ifcopenshell
      File "C:\Users\bhb\Desktop\ifcos\ifcopenshell--python34--module\ifcopenshell\__init__.py", line 29, in <module>
        from . import guid
    ImportError: cannot import name 'guid'
    >>> 
    
     

    Last edit: berndhahnebach 2015-08-06
  • Stinkfist

    Stinkfist - 2015-08-06

    Hey BTW try building the INSTALL project in the solution (right-click INSTALL -> Project Only -> Build Only Install). It seems to copy the needed files for Python usage:

    1> -- Installing: C:/Program Files/Emscripten/python/2.7.5.3_64bit/Lib/site-packages/ifcopenshell/ifcopenshell_wrapper.py
    1> -- Up-to-date: C:/Program Files/Emscripten/python/2.7.5.3_64bit/Lib/site-packages/ifcopenshell/init.py
    1> -- Up-to-date: C:/Program Files/Emscripten/python/2.7.5.3_64bit/Lib/site-packages/ifcopenshell/guid.py
    1> -- Up-to-date: C:/Program Files/Emscripten/python/2.7.5.3_64bit/Lib/site-packages/ifcopenshell/geom/init.py
    1> -- Installing: C:/Program Files/Emscripten/python/2.7.5.3_64bit/Lib/site-packages/ifcopenshell/_ifcopenshell_wrapper.pyd

    Note that, as you can see, for me it copied the files to the wrong location as I happened to have another Python installation around (came with Emscripten SDK).

    However, copying the files to the proper Python 3 location and testing then I get the exactly the same errors as you do.

     

    Last edit: Stinkfist 2015-08-06
  • Thomas Krijnen

    Thomas Krijnen - 2015-08-06

    Does the same error occur when importing the files distributed from: http://ifcopenshell.org/python.html ? If not, can you check what's the difference?

    I don't fully understand though, I would expect the first exception from 3.4's exception chain to be the same as the exception after altering --init--.py.

    In addition, the "DLL load failed" error makes me think, if you are sure this binary module is there. One thing that could be going on is that Python thinks you are building a debug library, after all, you said your configuration is RelWithDebInfo. I'm not sure which preprocessor directives are set because of that, but if Python thinks you are doing a debug build, it might postfix the internal library name with a _ d. Maybe you try building with a vanilla Release configuration?

    Btw, Stinkfist, thanks for sharing your work on the build script, that seems to be really nice. Have you ever tried building from the command line, i.e without the MSVC IDE being open. Maybe with this NMAKE tool that ships with MSVC?

    Kind regards,
    Thomas

     
  • Stinkfist

    Stinkfist - 2015-08-06

    CMake's RelWithDebInfo configuration is pretty much same as Release with the exception that it does not use as aggressive function inlining and generates debug info.

    Thomas: building on command-line is trivial by using MSBuild, that's what the build script does also.

     

    Last edit: Stinkfist 2015-08-06
  • berndhahnebach

    berndhahnebach - 2015-08-07

    It works with the modules downloaded from http://www.ifcopenshell.org/python.html

    in a new opened Python34 Shell:

    Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
    Type "copyright", "credits" or "license()" for more information.
    >>> import sys
    >>> sys.path.append('C:\\Users\\bhb\\Desktop\\ifcos\\py34_module_download\\')
    >>> import ifcopenshell
    >>> f = ifcopenshell.open('C:\\Users\\bhb\\Desktop\\ifcos\\mywall.ifc')
    >>> f.by_type('IfcWall')
    [#147=IfcWallStandardCase('37FmveoPzC1OD1MWL$hvsD',#4,' ',$,$,#67,#69,$)]
    >>> 
    

    in a new opened Python27 Shell:

    Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
    Type "copyright", "credits" or "license()" for more information.
    >>> import sys
    >>> sys.path.append('C:\\Users\\bhb\\Desktop\\ifcos\\py27_module_download\\')
    >>> import ifcopenshell
    >>> f = ifcopenshell.open('C:\\Users\\bhb\\Desktop\\ifcos\\mywall.ifc')
    >>> f.by_type('IfcWall')
    [#147=IfcWallStandardCase('37FmveoPzC1OD1MWL$hvsD',#4,' ',$,$,#67,#69,$)]
    >>> 
    

    regarding editing --init--.py ...

    It does not matter which version is taken. It just has a different error message when try to import ifcopenshell a second time.

     

    Last edit: berndhahnebach 2015-08-07
  • berndhahnebach

    berndhahnebach - 2015-08-07
    • used Release build in MS VisualStudio copied the -ifcopenshell-wrapper.pyd
    • as I wrote in the last post it makes no difference in the erromessage if the --init--.py is edited or not. It is a matter of how often import ifcopenshell is done in python shell.
    • attached the output
    Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
    Type "copyright", "credits" or "license()" for more information.
    >>> import sys
    >>> sys.path.append('C:\\Users\\bhb\\Desktop\\ifcos\\py34_module_build\\')
    >>> 
    

    try to import for the first time

    >>> import ifcopenshell
    Traceback (most recent call last):
      File "C:\Users\bhb\Desktop\ifcos\py34_module_build\ifcopenshell\__init__.py", line 39, in <module>
        from . import ifcopenshell_wrapper
      File "C:\Users\bhb\Desktop\ifcos\py34_module_build\ifcopenshell\ifcopenshell_wrapper.py", line 28, in <module>
        _ifcopenshell_wrapper = swig_import_helper()
      File "C:\Users\bhb\Desktop\ifcos\py34_module_build\ifcopenshell\ifcopenshell_wrapper.py", line 24, in swig_import_helper
        _mod = imp.load_module('_ifcopenshell_wrapper', fp, pathname, description)
      File "C:\Program Files\Python34\lib\imp.py", line 243, in load_module
        return load_dynamic(name, filename, file)
        ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "<pyshell#2>", line 1, in <module>
        import ifcopenshell
      File "C:\Users\bhb\Desktop\ifcos\py34_module_build\ifcopenshell\__init__.py", line 41, in <module>
        raise ImportError("IfcOpenShell not built for '%s'" % python_distribution)
    ImportError: IfcOpenShell not built for 'windows\64bit\python3.4'
    >>> 
    >>> 
    

    try to import another two times to show the other error messages

    >>> import ifcopenshell
    Traceback (most recent call last):
      File "<pyshell#4>", line 1, in <module>
        import ifcopenshell
      File "C:\Users\bhb\Desktop\ifcos\py34_module_build\ifcopenshell\__init__.py", line 29, in <module>
        from . import guid
    ImportError: cannot import name 'guid'
    >>> 
    >>> 
    >>> import ifcopenshell
    Traceback (most recent call last):
      File "<pyshell#5>", line 1, in <module>
        import ifcopenshell
      File "C:\Users\bhb\Desktop\ifcos\py34_module_build\ifcopenshell\__init__.py", line 29, in <module>
        from . import guid
    ImportError: cannot import name 'guid'
    >>>
    >>> 
    

    dozens of edits to get the highlighting ... Mhh, I feel a bit headless now ...

     

    Last edit: berndhahnebach 2015-08-07
  • Thomas Krijnen

    Thomas Krijnen - 2015-08-10

    Hi,

    Maybe just ZIP everything up and send it over so that I can have a look?

    Kind regards,
    Thomas

     
  • berndhahnebach

    berndhahnebach - 2015-08-10

    here we are ...

    buildtyp: release
    wordsize: 64
    python: 3.4

     
  • Thomas Krijnen

    Thomas Krijnen - 2015-08-10

    Hi,

    Seeing the size of the attachment made me realize an additional problem, which I overlooked because I am so used to doing static builds.

    You're -ifcopenshell-wrapper.pyd depends on other dlls that 1) either need to be located in the same folder 2) need to be accessible from a directory included in your PATH.

    Depending on your build options, this includes 1) IfcParse.dll IfcGeom.dll (judging by the size of your binary these are statically linked in already and do not need to be copied) 2) the set of Open Cascade dlls, such as (lib)TKernel.dll. 3) maybe even the c++ runtime msvcrxxx.dll and friends

    So copy those dlls over or do a static build of Open Cascade, which will take some time to rebuild, copying the dlls is quicker ;)

    Hope that helps,

    Kind regards,
    Thomas

     
  • berndhahnebach

    berndhahnebach - 2015-08-10

    :-) Here we are ... Thanks thomas and stinkfist !!!

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
    Type "copyright", "credits" or "license()" for more information.

    import sys
    sys.path.append('C:\Users\bhb\Desktop\upload-ifcos\')
    import ifcopenshell
    f = ifcopenshell.open('C:\Users\bhb\Desktop\ifcos\mywall.ifc')
    f.by_type('IfcWall')
    [#147=IfcWallStandardCase('37FmveoPzC1OD1MWL$hvsD',#4,' ',$,$,#67,#69,$)]

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    copied all dlls the build made. I'll check which ones are really needed and post these ones later on.

     
1 2 3 4 > >> (Page 1 of 4)

Log in to post a comment.