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

12021222325

Comments

  • 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
  • Amazing progress, @paullee!
    In the following, I am going to assume 2D, but 3D works in exactly the same way. Just replace "Edge" in 2D with "Face" in 3D and "Face" in 2D with "Cell" in 3D. I am also assuming that rather than just a 2D wire, you are able to create a 2D shell (made of inter-connected faces).
    You should assign a dictionary to each face. Or perhaps this can be intelligently derived by the faces' location, size, shape, neighbours etc (we are researching using machine learning to do exactly that).
    Get the interior edges/boundaries of the Shell. Loop through them. For each edge, ask it for its super topologies. It should give you two faces. Ask each cell for its dictionary value at key (e.g. "Function") and if the answers are "space" and "circulation" then you know you should place a door between the two.

    To return the direction of a face, use Face.Normal()

    paullee
  • Hi @paullee,
    Here is a sample script in jupyter notebook that shows you how to find the walls that separate offices from circulation

    paulleeknotsruen
  • edited September 2023

    Thanks for your time @topologic in explaining and the sample codes, learnt a lot, still studying :D

    Now, user defines 'type' of space. Conceiving usescases like user define main entrance and the script know the 1st cell/space is kind of passage and place doors to reach every room, checking of escape route distance, window area vs room area etc.

    @yorik @Moult Anything in IFC define 'main entrance(s) ' ( for door(s)) of a building ?

    Thanks all again :D

    topologic
  • Yes. Very possible.

    paullee
  • Amazing exploration @paullee @topologic ! in ifc, there is nothing in the IfcDoor object itself, but there is an "isExternal" property in Pset_DoorCommon: https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD1/HTML/schema/ifcsharedbldgelements/pset/pset_doorcommon.htm

    paulleetopologic
  • Happy to announce that #topologicpy now supports Apple Silicon. Download the latest version (0.4.41) through pip install topologicpy --upgrade or visit: http://pypi.org/project/topologicpy

    brunopostlejsdbroughtonatomkarincapaulleesergicera
  • edited October 2023

    Further to previous Automatic Building Generator,
    now feature includes automatically :-

    • identify Internal Corridor
    • identify Internal Wall connecting to Rooms, and
    • place Door at these internal walls :D
      (Next is let Topologic to work out the graph of corridor and rooms?)

    topologicbrunopostledimitarknotsruen
  • Fantastic work @paullee! Graph is very straightforward. I assume you have a CellComplex with apertures (calling it myCellComplex below). So:

    from topologicpy.Graph import Graph
    g = Graph.ByTopology(myCellComplex, direct=False, directApertures=True) #Connects cells/rooms only if they share an aperture.
    # or
    g = Graph.ByTopology(myCellComplex, direct=False, viaSharedApertures=True) #Connects cells/rooms to shared apertures so you get a node at the door.

    You can then do shortest path, draw the graph etc. etc.. lots of methods to analyse the building. Let me know if you have any questions.

    paulleedimitar
Sign In or Register to comment.