@topologic keep it up! Great work! I don't know anything C++ / Python bindings but I think IfcOpenShell uses swig. Maybe you've already considered it.
@topologic keep it up! Great work! I don't know anything C++ / Python bindings but I think IfcOpenShell uses swig. Maybe you've already considered it.
If anyone wants to pre alpha test Topologic for python on Linux, email me at wassim.jabi@gmail.com
@Moult said:
@topologic keep it up! Great work! I don't know anything C++ / Python bindings but I think IfcOpenShell uses swig. Maybe you've already considered it.
Thanks. We did consider SWIG but decided to go with cppyy. Hopefully we have made the right decision.
@topologic said:
If anyone wants to pre alpha test Topologic for python on Linux, email me at wassim.jabi@gmail.com
Thanks :D Sent you a mail, hope there is something I can help.
Hi everyone. Just to update you on our efforts to port Topologic to Linux, Python, and Blender, we have over-come some segmentation faults we were causing in python. Since yesterday, I have been stress-testing the Topologic methods and I am not able to break it so that is good news. The way Topologic works requires a bit of type checking on the return values so the python syntax needs to be carefully considered. I think a more general purpose solution is to create a set of python classes that wrap and represent Topologic classes (e.g. Vertex, Edge, Wire, etc etc). These python classes would replicate all the methods. Most will be one-liners, but some need a bit more work. This is not a difficult task, but time consuming. Any python experts who would like to contribute to this effort let me know.
In addition, @brunopostle tested the latest modifications within Blender/python and everything seems to be working fine on his setup! He reports that Topologic builds easily, but ccppyy is a bit more tricky, but he managed to build it on Fedora. I am still facing issues getting the same done for Ubuntu. I am meeting @brunopostle and @Theo on Friday to try to figure it out. Once it is in Blender, we can accelerate the development of a Topologic Add-on and integrate it with sverchok. This should yield something that looks very similar to TopologicDynamo and TopologicGH.
The last, but not least challenge will be the conversion of geometry between Blender and Topologic. Topologic uses Opencascade BREP. So, if anyone knows of a python utility to convert blender geometry into and from BREP then it would be as simple as myTopology = Topology.ByString(brepString) and brepString = myTopology.String(). Any help on that is also most welcome. Absent that kind of instant conversion, we will need to examine the input geometry, parse it down to vertices and build the Topologic shape from the bottom up. I am NOT looking forward to that!
The other challenge is to bring all this work to FreeCAD. I believe we will be able to do that, but again, I am looking for an expert programmer that knows FreeCAD well and knows how to extend its python engine with additional tools. With FreeCAD, topologic will be comfortably at home as they both use OCCT.
Attached is a screenshot of the work thus far. No 3D images, but the text shows that everything is working fine.
@topologic said:
The way Topologic works requires a bit of type checking on the return values so the python syntax needs to be carefully considered. I think a more general purpose solution is to create a set of python classes that wrap and represent Topologic classes (e.g. Vertex, Edge, Wire, etc etc). These python classes would replicate all the methods. Most will be one-liners, but some need a bit more work. This is not a difficult task, but time consuming.
This does need to happen, because currently an error generates a segfault which takes out blender too. In perl I would subclass each of the classes, this way there is no need to rewrite any methods that are already ok, just those methods that take a list (as I understand the problem).
@brunopostle said:
@topologic said:
The way Topologic works requires a bit of type checking on the return values so the python syntax needs to be carefully considered. I think a more general purpose solution is to create a set of python classes that wrap and represent Topologic classes (e.g. Vertex, Edge, Wire, etc etc). These python classes would replicate all the methods. Most will be one-liners, but some need a bit more work. This is not a difficult task, but time consuming.
This does need to happen, because currently an error generates a segfault which takes out blender too. In perl I would subclass each of the classes, this way there is no need to rewrite any methods that are already ok, just those methods that take a list (as I understand the problem).
Hi @brunopostle Yes you are right actually. We just sub-class it and over-write the troublesome methods.
Sorry to geek out on this, but here is an example of how the syntax can be made much more intuitive. This is the example of creating a Cluster that needs a std:list of Topology objects, so you cannot send it Wires and Edges and Vertices. They all first need to be converted to Topologies:
<code>class ClusterPy(Cluster):
def ByTopologies(topologies):
topologyList = cppyy.gbl.std.list\[Topology.Ptr\]()
for aTopology in topologies:
aTopology.\__class\__ = cppyy.gbl.TopologicCore.Topology
topologyList.push_back(aTopology)
return Cluster.ByTopologies(topologyList)</code>
Then the syntax is no longer like this:
topologies = cppyy.gbl.std.list[Topology.Ptr]()
wire1._class_ = cppyy.gbl.TopologicCore.Topology
wire2._class_ = cppyy.gbl.TopologicCore.Topology
topologies.push_back(wire1)
topologies.push_back(wire2)
cluster = Cluster.ByTopologies(topologies)
Instead it is simplified to:
cluster = ClusterPy.ByTopologies([wire1, wire2])
is the way for geometry not possible via ifc? ifcopenshell is also OCC? so brep<->OCC<->IfcOpenShell<->BlenderBIM<->Blender?
do I misunderstand it all?
Lukas
Does this mean that, eventually, Topologic will become a plugin for blender and that we'll be able to use it on Windows or Mac? I'm eagerly antecipating that!
@lukas said:
is the way for geometry not possible via ifc? ifcopenshell is also OCC? so brep<->OCC<->IfcOpenShell<->BlenderBIM<->Blender?
do I misunderstand it all?
Lukas
Yes that is possible too. I think ifcopenshell outputs and accepts breps so Topologic can communicate with it. I have already done a proof of concept of that in TopologicDynamo on Windows.
@JQL said:
Does this mean that, eventually, Topologic will become a plugin for blender and that we'll be able to use it on Windows or Mac? I'm eagerly antecipating that!
Yes. Windows version (ie. for python3 in Windows) is being developed as we speak, but in the open-source spirit, I have focused my energy on making sure Topologic is available on Linux's python. The Mac is still a way off, but I think @Theo can help here. So my priority is:
Topologic in Blender python add-on module in Linux
Topologic in sverchock in Linux
Topologic for FreeCAD in Linux
Topologic in for python/ Blender/Sverchok/FreeCAD Windows
Topololgic for python/Blender/Scerchok/FreeCAD Mac
As a proof of concept, the test Topologic python script in Linux outputs a brep string (line 116 Topology.String(cellComplex) and then I copy and paste that in a text file on Windows and import it into FreeCAD. Since it is a brep string/file, it opens with no errors. I am hoping I can do that directly inside Blender so that I can read and write to its list of objects.
Great news @topologic!
FreeCAD has a shape from mesh function, maybe you can check if it is useful: https://wiki.freecadweb.org/Part_ShapeFromMesh
I see myself using it in FreeCAD as I see myself using FreeCAD in the future (I love FreeCAD Sketches). I was under the impression Topologic required the visual programming UI to enable us to program what to do with it. How do you envision that being circumvented in FreeCAD?
@JQL said:
I see myself using it in FreeCAD as I see myself using FreeCAD in the future (I love FreeCAD Sketches). I was under the impression Topologic required the visual programming UI to enable us to program what to do with it. How do you envision that being circumvented in FreeCAD?
@yorik just got it working in FreeCAD!! Topologic does not need visual programming. You can use it in a python script very similar to what you can do in FreeCAD.
So the UI in FreeCAD would be something like typing code?
I am @Theo but I am not the Theo you probably want to contact.
Anyway, thanks for bringing me into the discussion. It looks interesting.
Theo Armour
@Theo said:
I am @Theo but I am not the Theo you probably want to contact.
Anyway, thanks for bringing me into the discussion. It looks interesting.
Theo Armour
Ooops Sorry!
@JQL said:
So the UI in FreeCAD would be something like typing code?
it's the same as ladybug. dynamo/grasshopper is a convenient way for users to manipulate code.. we dont have that in freecad (atm at least), so yes the way to interact with it is with code. But of course what would be best is to build specific UI tools to manipulate it, for ex a topologic workbench in freecad. That is not so hard to do, who knows ;)
Looking forward to Topologic functions in FreeCAD :)
For bringing IfcOpenShell shapes into Blender, this is the code: https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.6.0/src/ifcblenderexport/blenderbim/bim/import_ifc.py#L1978-L2007 - if there are faces, I use one method, if not, I use another. The foreach_set technique is the fastest method you'll find in Blender. IfcOpenShell geometry are IfcGeom::Representation::Triangulation (https://github.com/IfcOpenShell/IfcOpenShell/blob/b1c4481795445de3c91b2557048607ef269c4d6e/src/ifcgeom/IfcGeomIteratorImplementation.h#L25-L33). I'm still very slowly looking at the C++ side of IfcOpenShell but https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.6.0/src/ifcgeom/IfcGeomRepresentation.h#L103 is a good starting point to see how it starts to wrap what I expect is originally an OCC brep.
I never convert Blender into OCC breps - I go straight to IFC during the export process. Here's the code, which is probably irrelevant: https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.6.0/src/ifcblenderexport/blenderbim/bim/module/geometry/add_representation.py#L97-L139
so we are close to the automatic ifc building generator ? handling ifcspaces via Topologic, send them to homebuilder/topologise.. and that's it.
A topologic super-graph to handle to ifc-buildings to deliver a whole city (like testfit.io)
Or a parallel-graph to handle the ifcspaces to build the energymodeling structure. (ifc to gbxml)
a similar under-graph for the piping structure of water distribution within the building.. all elements being ifc entities that would be transformed by a 'topologise' to a geometry (wether blender or freecad does not matter no more) ?
Architecture, well construction/building is reduced to defining dictionaries and rules (setting and rearranging nodes).. and there will be the german arrangements (according to DIN) or the Danisch ones (according to their regulations)...
the automatics run behind the time free-ed for creativity.. sounds good
@Moult thank you! The code is quite helpful and will enable me to write a two-way translator between Blender and Topologic. It is now a matter of time and resources.
Login or Register to reply.