[Topologic] Redefining BIM through Spatial Topology, Information, and Grammars

12021222325

Comments

  • @paullee topologicpy works perfectly well in FreeCAD 0.20 on Windows. Here is what I did to make it work:

    import sys
    sys.path.append("path/to/the/top/folder/that/contains/topologicpy/")
    import topologicpy
    from topologicpy.Vertex import Vertex
    v = Vertex.ByCoordinates(10,20,30)
    print(Vertex.X(v), Vertex.Y(v), Vertex.Z(v))

    10 20 30

    paullee
  • Hmmm, searched on my Fedora 36 and seems found it under .local/lib/python3.10/site-packages ...

    import sys
    sys.path.append("/home/paullee/.local/lib/python3.10/site-packages")
    import topologicpy

    Traceback (most recent call last):
    File "", line 1, in
    File "/home/paullee/Downloads/FreeCAD_weekly-builds-31391-2022-12-22-conda-Linux-x86_64-py310/squashfs-root/usr/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
    return original_import(name, *args, **kwargs)
    File "/home/paullee/.local/lib/python3.10/site-packages/topologicpy/__init__.py", line 16, in
    import topologic
    File "/home/paullee/Downloads/FreeCAD_weekly-builds-31391-2022-12-22-conda-Linux-x86_64-py310/squashfs-root/usr/lib/python3.10> /site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
    return original_import(name, *args, **kwargs)
    ImportError: /home/paullee/.local/lib/python3.10/site-packages/topologicpy/bin/linux/topologic/./libTopologicCore.so.0: undefined symbol: _ZN24BRepBuilderAPI_MakeShape5BuildEv

  • I am not a Linux expert, but it seems that the bundled version of topologic is not compatible with your system. If you can get your hands on a compiled and compatible version of topologic for Linux (eg from homemaker) just drop it in the bin/Linux/topologic folder inside topologicpy

    paullee
  • One test would be to delete the files in bin/linux/topologic and try again. It might find the one you got working from homemaker

    paullee
  • It seems:-

    1. FC_0.20, with Python 3.9 + Brunopostle's packages for Fedora 36
      = import topologic : OK

    2. FC_0.21_pre, with Python 3.10 + Brunopostle's packages for Fedora 36
      = import topologic : Not OK
      = import topologicpy : Not OK

    topologic
  • @paullee said:
    It seems:-

    1. FC_0.20, with Python 3.9 + Brunopostle's packages for Fedora 36
      = import topologic : OK

    2. FC_0.21_pre, with Python 3.10 + Brunopostle's packages for Fedora 36
      = import topologic : Not OK
      = import topologicpy : Not OK

    What about import topologicpy with FC_0.20 with Python 3.9?

  • @paullee I'm> @paullee said:

    It seems:-

    1. FC_0.20, with Python 3.9 + Brunopostle's packages for Fedora 36
      = import topologic : OK

    2. FC_0.21_pre, with Python 3.10 + Brunopostle's packages for Fedora 36
      = import topologic : Not OK
      = import topologicpy : Not OK

    my rpms of blenderbim and topologic use the system python. freecad downloads come with their own python interpreter (like blender), surely?

    paullee
  • edited January 2023

    @topologic said:
    What about import topologicpy with FC_0.20 with Python 3.9?

    It is not supposed to work - as it seems installed under python 3.10 ?

    /home/paullee/.local/lib/python3.10/site-packages/topologicpy

    However in FC 0.20 python console (using 3.9 python version), forcing it to look into python 3.10 location :-

    sys.path.append("/home/paullee/.local/lib/python3.10/site-packages")
    import topologicpy
    topologicpy.platform
    'linux'
    topologicpy.os

    topologicpy.topologic.Vertex

    dir (topologicpy)
    ['builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'os', 'os_name', 'platform', 're', 'sitePackagesFolderName', 'sys', 'test1', 'topologic', 'topologicFolderName', 'topologicPath']

    No Vertex etc. directly under topologicpy, but under topologicpy.topologic ....

  • edited January 2023

    @brunopostle said:
    @paullee I'm>
    ...
    my rpms of blenderbim and topologic use the system python. freecad downloads come with their own python interpreter (like blender), surely?

    Thanks :D
    This is FC 0.20 screencapture -

    Below
    is FC 0.21 screencapture -

    To my understanding -
    Python 3.9 is in FC 0.20
    Python 3.10 is in FC 0.21_pre

  • @paullee did you try
    import topologicpy
    from topologicpy.Vertex import Vertex
    v = Vertex.ByCoordinates(10,20,30)
    print(v)

  • Yes it is working on FC 0.20 (importing 3.10 topologicpy in 3.9 python console) :-

    Python 3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:07:55)
    [GCC 10.3.0] on linux
    Type 'help', 'copyright', 'credits' or 'license' for more information.

    sys.path.append("/home/paullee/.local/lib/python3.10/site-packages")
    import topologicpy
    from topologicpy.Vertex import Vertex
    v = Vertex.ByCoordinates(10,20,30)
    print(v)

    <topologic.Vertex object at 0x7f3b3c21a270>

    topologic
  • edited January 2023

    @paullee Atleast it works under FC 0.20. It doesn’t matter if topologicpy was installed under python 3.10 because topologic has .pyd files for python 3.7 3.8 3.9 and 3.10

    paullee
  • This .local directory seems to be containing what are installed with "pip install topologicpy" :-

  • edited January 2023

    Noted some difference between FreeCAD 0.20 and 0.21_pre, particularly OCC :-

    OS: Fedora Linux 36 (Workstation Edition) (GNOME/gnome)
    Word size of FreeCAD: 64-bit

    Version: 0.20.29177 (Git)
    Python 3.9.13, Qt 5.12.9, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.3

    Version: 0.21.0.31391 (Git)
    Python 3.10.8, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3

    Would it be the difference in OCC make topologic not working in FreeCAD 0.21_pre ?

  • edited September 2023

    @topologic FreeCAD has its formal release 0.21.1 available, development of 0.22 (or 1.0) is in the progress :D

    Any idea topologicpy is upgraded and tested to make it works in the latest version?

    Thanks for your advice in advance.

  • Hi @paullee. I’m not an expert in Linux but my suspicion (or unfounded theory) is that on windows, the build process for topologic includes a name mangling step for the needed libraries, but on Linux, judging by your screenshot, the file names are not changed so they conflict with FC. To confirm, is it possible that you or others test topologicpy with the latest FC on windows? I would test it myself, but I am sadly very busy this period as classes are about to start.

  • Thanks @topologic I could test again the latest topologipy / FC on Fedora 38.

    But I do not use have Windows on my PCs. I'll see if I can have access to one to test. Or some more peoples can help to test :)

    Hope everbody has more resources and spare time :D

  • @topologic Good news :)
    I do not know how, but now below combination works !

    • Topologicpy (by pip install 6.9.2023) + FreeCAD 0.21.0 (AppImage) + Fedora 38
    • Topologicpy (by pip install 6.9.2023) + FreeCAD 0.20.0 (Fedora rpm Repo) + Fedora 38

    Thanks !

    topologic
  • edited September 2023

    With the latest topologicpy installed by pip install topologicpy and run on FreeCAD 0.21 on Fedora 38, a method (x.String()) previously worked in below quoted example / post no longer works, haven't found the solution yet, @topologic or anybody has idea?
    Thanks :)

    Below runs in FreeCAD python console :

    sys.path.append("/home/paullee/.local/lib/python3.11/site-packages")
    import topologicpy as topologic
    (remarks) 2 boxes / cubes for example
    s=Gui.Selection.getSelection()
    c1 = s[0]
    c2 = s[1]
    tc1 = topologic.Topology.ByString(c1.Shape.exportBrepToString())
    tc2 = topologic.Topology.ByString(c2.Shape.exportBrepToString())
    tc3 = tc1.Merge(tc2)
    print(tc3)
    ... <topologic.CellComplex object at 0x7f9f56aac430>
    shp3 = Part.Shape()
    shp3.importBrepFromString(tc3.String())

    That 'tc3.String()', used to work, now returns error :

    Traceback (most recent call last):
    File "", line 1, in
    TypeError: String(): incompatible function arguments. The following argument types are supported:
    1. (self: topologic.Topology, rkVersion: int) -> str

    Invoked with: <topologic.CellComplex object at 0x7f9f56aac670>

  • If you are using the latest version of topologicpy, Topology.String and Topology.ByString are now deprecated. Please try Topology.BREPString and Topology.ByBREPString
    https://topologic.app/topologicpy_doc/topologic_pdoc/Topology.html

    paullee
  • In general, please try to move away from topologic methods and instead use topologicpy methods which are far better documented. So instead of myTopology.String() please use:
    from topologicpy.Topology import Topology
    brepString = Topology.BREPString(myTopology)

    paullee
  • @topologic said:
    In general, please try to move away from topologic methods and instead use topologicpy methods which are far better documented. So instead of myTopology.String() please use:
    from topologicpy.Topology import Topology
    brepString = Topology.BREPString(myTopology)

    Thanks, it seems working :D

  • edited September 2023

    @topologic
    If I just want to from the 'external edges' from a set of connecting Faces (Shell?) e.g. below screencapture, any way to do it?

    • 6 'external edges',
    • 1 'internal edge'

    Thanks again for any hints :)

  • @paullee said:
    @topologic
    If I just want to from the 'external edges' from a set of connecting Faces (Shell?) e.g. below screencapture, any way to do it?

    • 6 'external edges',
    • 1 'internal edge'

    Thanks again for any hints :)

    If you have a Shell, then:
    from topologicpy.Shell import Shell
    from topologicpy.Topology import Topology
    myBoundary = Shell.ExternalBoundary(myShell)
    myEdges = Topology.Edges(myBoundary)

    paullee
  • edited September 2023

    This is really a good document, there is python source code directly below every method, very easy to understand :)

    Thanks !

    EDIT - It's bit difficult to find from the website main page, maybe add a link in https://topologic.app/learning/ ?

    topologic
  • @paullee said:

    This is really a good document, there is python source code directly below every method, very easy to understand :)

    Thanks !

    EDIT - It's bit difficult to find from the website main page, maybe add a link in https://topologic.app/learning/ ?

    Yes. Been meaning to do that, but never got around to it. Will do soon. Thanks!

    paullee
  • edited September 2023

    Noted there is a few method about OCCTShape and want to try, but it seems it is not presented. Deprecated ?

    Thanks.

    https://topologic.app/topologicpy_doc/topologic_pdoc/Topology.html#Topology.Topology.OCCTShape
    https://topologic.app/topologicpy_doc/topologic_pdoc/Topology.html#Topology.Topology.ByOCCTShape

    EDIT - Oops, too soon to create noise, found, 2nd screencapture :D
    Hmmm... the question becomes - how to 'export' OCCTShape in FreeCAD?


  • Hi @paullee,
    You wrote:

    Hmmm... the question becomes - how to 'export' OCCTShape in FreeCAD?

    Sadly these methods are not well-tested and this is why they have been hidden. Instead, please use the BREP string as the standard way to communicate between FreeCAD and topologicpy (Note, I think I found a typo that is making Topology.BREPString and Topology.ByBREPString not work. I think I solved it, but I am still testing and investigating. If the following code doesn't work for you, please contact me privately or put an issue on github. This forum is supposed to be for general discussion, but I worry we are going into bugs and tracking which is best done on github. In any case, to convert a FreeCAD object to topologic:
    1. Select the object that you want to convert to a topology in topologic
    2. This assumes that topologicpy module can be found already and is functional

    import FreeCAD
    from topologicpy.Topology import Topology
    doc = FreeCAD.ActiveDocument
    sel = doc.ActiveObject
    shape = sel.Shape
    brep = shape.exportBrepToString()
    new_topology = Topology.ByBREPString(brep)
    print(new_topology)

    paullee
  • edited September 2023

    Thanks, no worry, shape.exportBrepToString() route works. Just note there maybe OCCTShape route and see if FreeCAD and Topologic speaks and communicate in 'native language'. Any my bad, would use github to discuss as necessary.

    Thanks for creating and maintaining Topologic !

    topologic
  • edited September 2023

    Based on the idea of HomeMaker-Topologic, created a short script on FreeCAD.
    In FreeCAD :

    • Make a single-line Sketch of a building layout, run the script (Topologic-Homemaker like)
      (On 2nd Gen i3, it needs 10s)

    • You get the wall, slabs, roof, windows on external walls
      (Just proof of concept at the moment)

    Q :

    • Wondering how to identify a wall access from a corridor to automatically place a door, from a common wall which divides a room from another (thus not placing a wall door by the script) ?
    • Found Face.FacingToward() method ( https://topologic.app/topologicpy_doc/topologic_pdoc/Face.html#Face.Face.FacingToward ), seems needs input of direction to test to return result . Any other method available which return the direction?

    Thanks :)

    topologicbrunopostleyorikdimitarbitacovir
Sign In or Register to comment.