If you're reading this, we've just migrated servers! If anything looks broken please email dion@thinkmoult.com :)

[topologic] topologicpy - an independent python API for topologic

2»

Comments

  • I would start by deleting any old installation of topologic. Make sure it is never found. Then pip install topologicpy and try if that works (from topologicpy.Vertex import Vertex). If so you are done. If not:
    1. Build or install the newest version of topologic. Make sure it works (import topologic works?)
    2. Download and install topologicpy
    3. go into its bin folder and delete all files but keep all folders.
    4. Try to import topologicpy in python

    paullee
  • @paullee if you install topologicpy with pip this includes opencascade, the topologic c++ library and the python bindings - if you have Topologic installed using any other method (such as my fedora rpms) it is likely to cause problems.

    topologicpaullee
  • @brunopostle said:
    @paullee if you install topologicpy with pip this includes opencascade, the topologic c++ library and the python bindings - if you have Topologic installed using any other method (such as my fedora rpms) it is likely to cause problems.

    @brunopostle Just for my own understanding: Are you saying that pip install topologicpy works on Fedora (I know it works on Ubuntu) and thus can it be the preferred way to access topologic and topologicpy? Can we recommend it as a universal solution? If so, would you start distributing homemaker without topologic and simply ask for topologic (and topologicpy) as a dependency? Homemaker can continue to use topologic methods as is (after importing topologicpy at the start, import topologic and continue as is). In the future, and incrementally, you can start switching your methods to use topologicpy if it suits.

    paullee
  • @topologic pip install topologicpy probably works fine on fedora, but if you also have topologic installed via rpm then this will cause issues.

    I was offering rpms as a way to get Topologic working with the version of freecad that comes with fedora - this is not the all-in-one freecad binary distributed by freecad.org, it is built for fedora and linked with the fedora versions of python, opencascade etc..

    This is the Linux platform ecosystem, if you get all your software via platform channels, then you get no conflicts, it just works, I don't need to check import topologic in the freecad console, I know it will be fine. This requires a change of mindset if you have a Windows background - hence my aversion to installing random binaries from the internet when reliable platform channels are available.

    When installing a precompiled blender downloaded from blender.org and then packaged add-ons from Github, all system-wide libraries are ignored, so anything installed via pip or rpm is irrelevant.

    The Homemaker add-on downloads on Github are bundled with everything you need (apart from blender and blenderbim), but there is also a 'noarch' download that doesn't include topologic, this should work on any system where blender, blenderbim and topologic are already working together.

    paullee
  • ok, thanks. I can only support so many things on my own. Officially, topologicpy is the recommended interface moving forward and "topologic" is increasingly becoming a behind-the-scenes underlying library. It may disappear in the future and the two python layers merged. But for now, the current two-layer system offers a transition for those (like you) who built software on top of topologic.

    paullee
  • edited March 2023

    Thanks @topologic @brunopostle !

    Tada ! Finally it works on FreeCAD 0.21 (pre) !
    I pip uninstall topologicpy, then pip install topologicpy, and it works. Maybe previously I had a topologic installed before I 'pip install topologicpy', and it confuse the installation ?

    In FreeCAD 0.21_pre python 3.10.8 console -
    ( EDIT - found in fact no need below (anymore) : marked with 'XXX' )
    XXX - sys.path.append("/home/paullee/.local/lib/python3.10/site-packages")

    import topologicpy
    topologicpy.topologic.Vertex
    " <"class 'topologic.Vertex'>

    topologic
  • edited March 2023

    @topologic Maybe you would like to make an announcement in FreeCAD forum about the TopologicPy ?

    Previous threads in FreeCAD Forum -

    topologic
  • topologicpy v 0.2.6 and associated documentation have been released with many bugs squashed! (pip install topologicpy --upgrade) The source also contains a new folder called UnitTests with several python files that form the start of a unit testing mechanism, but it also gives you hints on how to call the API.

    paulleeAce
  • Hello,
    I'm attempting to import the "rooms" from an IFC file into TopologicPy. Because these rooms are represented in net volume, I'm trying to implement Shell.ByDisjointedFaces. However, I'm encountering an issue where I end up with a single tile.
    I've also tried running the ShellByDisjointedFaces.ipynb from the TopologicPy GitHub repository examples, but I'm getting the same result.
    Any guidance or suggestions would be greatly appreciated.
    Thank you.
    input cluster
    result

  • Hello OSSArch community,
    When using topologicpy within Jupyter Notebook, I noticed that the library automatically downloads required packages directly into the root directory. While this works, it can clutter the root directory, which might be distracting for some users. To address this, I devised a workaround by modifying the sys.path to direct topologicpy to download its required libraries into a specific folder. This ensures a cleaner directory structure and better organization.

    Here's the solution for anyone who might find it helpful:

    import os
    import sys
    
    # Change the working directory to the desired folder for downloads
    os.chdir('./topologic_required_packages')
    
    # Update sys.path to ensure Python checks the new directory for modules
    path = os.getcwd()
    if path not in sys.path:
        sys.path.insert(0, path)
    
    # Now, when you import the library, it should use the new directory
    from topologicpy.Vertex import Vertex
    from topologicpy.Edge import Edge
    from topologicpy.Wire import Wire
    from topologicpy.Face import Face
    from topologicpy.Shell import Shell
    from topologicpy.Cell import Cell
    from topologicpy.Cluster import Cluster
    from topologicpy.Topology import Topology
    from topologicpy.Graph import Graph
    from topologicpy.Vector import Vector
    from topologicpy.Dictionary import Dictionary
    from topologicpy.Helper import Helper
    
    print("Current working directory:", os.getcwd())
    
    topologic
  • edited August 2023

    ...and if you are working on a Jupyter Notebook :

    import os
    import sys
    
    # Create a subfolder to store the required packages
    subfolder = 'topologic_required_packages'
    current_dir = os.getcwd()
    
    # If current directory is not already the subfolder
    if not current_dir.endswith(subfolder):
    
        # Construct the desired path
        desired_path = os.path.join(current_dir, subfolder)
    
        # Check if the subfolder exists, if not create it
        if not os.path.exists(desired_path):
            os.makedirs(desired_path)
    
        # Change the current working directory to the subfolder
        os.chdir(desired_path)
    
    # Update sys.path
    path = os.getcwd()
    if path not in sys.path:
        sys.path.insert(0, path)
    
    # Now import the library
    from topologicpy.Vertex import Vertex
    from topologicpy.Edge import Edge
    from topologicpy.Wire import Wire
    from topologicpy.Face import Face
    from topologicpy.Shell import Shell
    from topologicpy.Cell import Cell
    from topologicpy.Cluster import Cluster
    from topologicpy.Topology import Topology
    from topologicpy.Graph import Graph
    from topologicpy.Vector import Vector
    from topologicpy.Dictionary import Dictionary
    from topologicpy.Helper import Helper
    
    os.getcwd()
    
    topologic
  • @sergicera said:
    Hello,
    I'm attempting to import the "rooms" from an IFC file into TopologicPy. Because these rooms are represented in net volume, I'm trying to implement Shell.ByDisjointedFaces. However, I'm encountering an issue where I end up with a single tile.
    I've also tried running the ShellByDisjointedFaces.ipynb from the TopologicPy GitHub repository examples, but I'm getting the same result.
    Any guidance or suggestions would be greatly appreciated.
    Thank you.
    input cluster
    result

    Hi @sergicera I’m currently on annual leave and away from my computer. Will test this in a few days. Thanks.

    sergicera
  • @topologic said:

    @sergicera said:
    Hello,
    I'm attempting to import the "rooms" from an IFC file into TopologicPy. Because these rooms are represented in net volume, I'm trying to implement Shell.ByDisjointedFaces. However, I'm encountering an issue where I end up with a single tile.
    I've also tried running the ShellByDisjointedFaces.ipynb from the TopologicPy GitHub repository examples, but I'm getting the same result.
    Any guidance or suggestions would be greatly appreciated.
    Thank you.
    input cluster
    result

    Hi @sergicera I’m currently on annual leave and away from my computer. Will test this in a few days. Thanks.

    This nagged on me so I opened my laptop and looked at what is going. Unfortunately, I accidentally copied experimental internal code that was not yet functional into the release code! My sincere apologies. Will revert it back in the next few days.

    sergicerabitacovir
Sign In or Register to comment.