T
by topologic on 12 Feb 2021
#
+1 votes
@paullee Since you are on Linux you can download and install topologicPy from http://github.com/wassimj/topologicPy
Then you have five options:
-
Use pure python scripts from the console to read and write BREP objects (100% compatible with FreeCAD)
-
Use python scripts within FreeCAD
-
Use python scripts within Blender
-
Use sverchok Topologic visual nodes in Blender (coming soon)
-
Same as #4 but integrate with FreeCAD sverchok nodes.
B
by brunopostle on 12 Feb 2021
#
+3 votes
@JQL said:
I think it's very interesting to think on a tool to develop standard architecture in a zip if that's what you're aiming for. However, topologic allows for much more and what's brilliant about the future is how we can free ourselves from constraints.
This is what you will be able to do with Topologic Sverchok nodes or the equivalent. The tool I have in mind needs to go further and, as I said, 'anything-goes-in-free-jazz-architecture' imposes some severe constraints.
@paullee basically, you get the line equation for each of the edges, and with this you can determine which of the other nodes are 'above' or 'below' the line. But if you are coding this in python, Topologic exists to solve these sort of problems for you.
P
by paullee on 12 Feb 2021
#
@topologic said:
I can't figure out the algorithm to find out the 4 areas automatically. Currently, I need to do that manually - i.e. pointing out which 4 edges define an area and need to do that 4 times :(
This is a very easy workflow for Topologic. Feed the edges into a Cluster, self-merge it, and feed it to wire-cycles with maximum 4 vertices (this is a custom node written in pure python available on TopologicDynamo. Planning to port it to Blender/sverchok. It will return 4 closed wires.
Sounds great :D Need to tell Topologic the numbers of vertices say 4 to form an area ?
T
by topologic on 12 Feb 2021
#
@paullee 4 is to limit the search. As you can imagine your diagram can have many sub-shapes. But if you don’t want to do that, you can extrude the lines up to faces, then call CellComplex.ByFaces then call CellComplex.Cells and it will automatically give you four cells. If you want the floor, just extract the face that has a face normal with Z less than 0 (usually -1).
T
by topologic on 12 Feb 2021
#
+1 votes
@paullee Here is how it would look in Topologic. Read the graph from left to right. It generates 6 lines as you specified, it makes them into a Cluster, then self-merges the Cluster yielding a Wire then fed into Wire.Cycles to detect closed cycles of maximum number of vertices (in this case 4) and then convert into faces and geometry to display. At the end I move them apart so you can see them.
J
by JQL on 12 Feb 2021
#
+1 votes
I wonder if Topologic will be able to read FreeCAD sketches. They are not actual geometry, they are only geometric rulers/constraints... I might be wrong.
T
by topologic on 12 Feb 2021
#
+2 votes
@JQL said:
I wonder if Topologic will be able to read FreeCAD sketches. They are not actual geometry, they are only geometric rulers/constraints... I might be wrong.
I am not sure. Topologic can read BREP files. If you send me a sample file, I have FreeCAD and can test it.
P
by paullee on 13 Feb 2021
#
@JQL @topologic Seems better idea than I attempt to compile Topologic without much experience in this :D
Seems FreeCAD file .FCStd is not accepted, I just rename the extension to .zip for uploading - pls rename back to *.FCStd
Ok, there is a Sketch object, with 6 edges.
Then, make extrude to make 6 vertical faces, 1 bottom face and 1 top face from the edges - all in a Group folder.




P
by paullee on 13 Feb 2021, edited 13 Feb 2021
#
p.s.
Maybe this file is better.
There is an Edges Group folder. All the edges in the original Sketch are made into individual Part Shape, if you may have problem to work with the Sketch Object :D
Thanks in advance !
(remember to rename the attached FC file into *.FCStd to open)


T
by topologic on 13 Feb 2021
#
+3 votes
@paullee This was quite easy for Topologic in FreeCAD. Mainly, first make sure the 8 surfaces are selected and then paste the following python code:

You get the four Cells converted into four new Parts




P
by paullee on 13 Feb 2021
#
@topologic said:
You get the four Cells converted into four new Parts
Gorgeous !
Hope can use that right in my FreeCAD :D
1 Question at the moment - can you relate back to which 4 (or 6 faces) in FreeCAD shapes each of the generated Cells came from ?
Thanks.
T
by topologic on 13 Feb 2021
#
@paullee said:
@topologic said:
You get the four Cells converted into four new Parts
Gorgeous !
Hope can use that right in my FreeCAD :D
1 Question at the moment - can you relate back to which 4 (or 6 faces) in FreeCAD shapes each of the generated Cells came from ?
Thanks.
I selected Shape --> Shape007 and then pasted the python script in the python console. It creates Shape008, Shape009, Shape010, and Shape011 automatically from the original 8 Faces.
If you are on Linux, try to follow the instructions on github.com/wassimj/topologicPy and if you have FreeCAD 0.19 daily, it should work. The tricky part is always installing cppyy and all its dependencies, but I think the recipe I have on github is good. Myself, Theo Dounas and @brunopostle have been able to install Topologic and cppyy on Linux and it works great. My setup is python 3.8, Ubuntu 2.10 Groovy Gorilla and FreeCAD 0.19 daily build.
T
by topologic on 13 Feb 2021, edited 13 Feb 2021
#
Oh sorry. I did not understand your question! You mean to go back to the original faces. This would be a geometric workflow of testing if the two faces are co-planar and identical etc.. For simple cases, you can compare their centroids and that might be enough perhaps (if the original face was not cut up into smaller pieces). In principle, it is possible like this:
- For each Cell in the result:
2.----For each face in the Cell:
-
-------- Get a vertex guaranteed to be inside (Face.InternalVertex())
-
------------ For each face in the original list:
-
----------------Is the internal vertex inside the original face in question?
-
-------------------- If so, copy attributes from that original face to the cell face.
B
by brunopostle on 13 Feb 2021
#
@paullee said:
1 Question at the moment - can you relate back to which 4 (or 6 faces) in FreeCAD shapes each of the generated Cells came from ?
This would be a very useful feature, for the elements of the cell complex to inherit any attributes (as a dictionary) of the original objects.
T
by topologic on 13 Feb 2021
#
@brunopostle said:
@paullee said:
1 Question at the moment - can you relate back to which 4 (or 6 faces) in FreeCAD shapes each of the generated Cells came from ?
This would be a very useful feature, for the elements of the cell complex to inherit any attributes (as a dictionary) of the original objects.
It is certainly possible. I had done that in Dynamo many months ago.
T
by topologic on 13 Feb 2021
#
+3 votes
@brunopostle said:
@paullee said:
1 Question at the moment - can you relate back to which 4 (or 6 faces) in FreeCAD shapes each of the generated Cells came from ?
This would be a very useful feature, for the elements of the cell complex to inherit any attributes (as a dictionary) of the original objects.
Hi @brunopostle Here it is :). I didn't bother with dictionaries, but the principle is the same. The 20 derived faces are checked against the original 8 faces. If they match, the name and the color is transferred to the new face. If you look closely and count, you will notice that 2 of the original faces (top and bottom Shape and Shape007) yield 4 new faces while the other faces yielded 2 new faces.

P
by paullee on 13 Feb 2021
#
@topologic said:
Hi @brunopostle Here it is :). I didn't bother with dictionaries, but the principle is the same. The 20 derived faces are checked against the original 8 faces. If they match, the name and the color is transferred to the new face. If you look closely and count, you will notice that 2 of the original faces (top and bottom Shape and Shape007) yield 4 new faces while the other faces yielded 2 new faces.
Thanks taking the time to explain :D This is exactly what I mean.
Though I thought it do not require the user to test by going through the loop you indicates ? During the process Topologic identify the 4 resultant Cells, would it already know which 6 Original Faces creates that 'boundary' ?
It is apparent to a human being, 2D on the Sketch or 3D of the 8 Faces - that's the algorithm to find the 4 'boundaries' in 2D Sketch I would like to know - the same feature in AutoCAD to do Hatch / find boundary ?
Not only as @brunopostle point out that attributes can inherit, but the Original Edges and the Resultant Cells / Faces can 'co-relate' to each other. For example, user may do a script to ask Topologic to deduce what faces are External, then assign back desirable materials / thickness / reflectance to the Original Faces / Edges (Wall / Curtain Wall ) and the elements it contain (Window / Spandrels / Cladding / Insulation).
Just some random thoughts :)
T
by topologic on 13 Feb 2021
#
+2 votes
@paullee said:
@topologic said:
Hi @brunopostle Here it is :). I didn't bother with dictionaries, but the principle is the same. The 20 derived faces are checked against the original 8 faces. If they match, the name and the color is transferred to the new face. If you look closely and count, you will notice that 2 of the original faces (top and bottom Shape and Shape007) yield 4 new faces while the other faces yielded 2 new faces.
Thanks taking the time to explain :D This is exactly what I mean.
Though I thought it do not require the user to test by going through the loop you indicates ? During the process Topologic identify the 4 resultant Cells, would it already know which 6 Original Faces creates that 'boundary' ?
It is apparent to a human being, 2D on the Sketch or 3D of the 8 Faces - that's the algorithm to find the 4 'boundaries' in 2D Sketch I would like to know - the same feature in AutoCAD to do Hatch / find boundary ?
Not only as @brunopostle point out that attributes can inherit, but the Original Edges and the Resultant Cells / Faces can 'co-relate' to each other. For example, user may do a script to ask Topologic to deduce what faces are External, then assign back desirable materials / thickness / reflectance to the Original Faces / Edges (Wall / Curtain Wall ) and the elements it contain (Window / Spandrels / Cladding / Insulation).
Just some random thoughts :)
Hi @paullee, There isn't a way to relate the faces without a search. The subdivision of an orginal face to create the faces of the cellComplex is buried deep in opencascade's engine, so we need to do this after (not during) the creation of a CellComplex from a list of Faces.
What you write in the last message is exactly correct: Now that we have built the CellComplex, we can ask questions such as:
-
For a given Cell in a CellComplex, give me the list of its adjacent Cells?
-
For a given Face in a CellComplex, give me the two Cells that it separates (or one Cell if it happens to be an exterior Face).
-
For a given CellComplex, give me the outer faces and the inner faces in separate lists (you can further divide by vertical vs. horizontal)
-
For a given Face, give me the apertures and other contents that it may contain.
The above are just examples. We can think up other more advanced queries that can be readily answered by Topologic. For example, for a given Cell in a CellComplex, how central or how isolated is it?
P
by paullee on 13 Feb 2021, edited 13 Feb 2021
#
@topologic said:
Hi @paullee, There isn't a way to relate the faces without a search. The subdivision of an orginal face to create the faces of the cellComplex is buried deep in opencascade's engine, so we need to do this after (not during) the creation of a CellComplex from a list of Faces.
What you write in the last message is exactly correct: Now that we have built the CellComplex, we can ask questions such as:
- For a given Cell in a CellComplex, give me the list of its adjacent Cells?
- For a given Face in a CellComplex, give me the two Cells that it separates (or one Cell if it happens to be an exterior Face).
- For a given CellComplex, give me the outer faces and the inner faces in separate lists (you can further divide by vertical vs. horizontal)
- For a given Face, give me the apertures and other contents that it may contain.
The above are just examples. We can think up other more advanced queries that can be readily answered by Topologic. For example, for a given Cell in a CellComplex, how central or how isolated is it?
Thanks, I can partly understand the mechanism when you mention underlying process is done by OCC :D Just curious what the algorithm do ?
I do not know much about OCC, it is the core of Part WB in FreeCAD to my understanding. I see there are methods (exposed in python too) like childShapes(), isSame(), isEqual() that may help to trace the history of OCC operation. The method to check the correlation become significant if the workflow start with an Object in FreeCAD, rather than starting from Topologic, I think ...
And maybe Topologic can find the escape path in a labyrinth ? :D
T
by topologic on 13 Feb 2021
#
@paullee The workflow I demonstrated does start with FreeCAD objects and returns FreeCAD objects. Anyway this is how it can be done in Topologic, but if someone can hack OCCT that would be impressive (OCCT is notoriously difficult and low level), but I doubt that is the right way to do it when you can write it easily in a few lines of code. That’s why people use libraries: to work at a higher level.
P
by paullee on 13 Feb 2021
#
+1 votes
Thanks @topologic, I understand! Impressed very much by the capabilities of Topologic. Would try the codes you shows when I manage to compile and run it here :D
L
by lukas on 13 Feb 2021
#
So if it can run in and sort out a maze (labirynth) , then topologic can 'reanalyse' any IFC ? and redefine it, and correct what was wrong. The (imperfect) IFC -tree (graph) is then replaced by the Topologic-tree, which of course can be rewritten as IFC.. the IFC-correction-tool ? The import/export tool for all BIM authoring softwares.. depending on the dictionnary settings..
T
by topologic on 13 Feb 2021
#
@lukas said:
So if it can run in and sort out a maze (labirynth) , then topologic can 'reanalyse' any IFC ? and redefine it, and correct what was wrong. The (imperfect) IFC -tree (graph) is then replaced by the Topologic-tree, which of course can be rewritten as IFC.. the IFC-correction-tool ? The import/export tool for all BIM authoring softwares.. depending on the dictionnary settings..
I don’t know enough about ‘problematic’ IFC to know if Topologic can correct them, but happy to collaborate and test.
B
by brunopostle on 13 Feb 2021
#
+2 votes
@paullee said:
Would try the codes you shows when I manage to compile and run it here :D
Are you on fedora Linux? I have built rpm packages of all the Topologic dependencies (except for topologicPy itself, but this is the easy one). Currently f32, f33 & f34, but I can probably push f31 too.
P
by paullee on 13 Feb 2021
#
@brunopostle said:
Are you on fedora Linux? I have built rpm packages of all the Topologic dependencies (except for topologicPy itself, but this is the easy one). Currently f32, f33 & f34, but I can probably push f31 too.
Thanks! Yes, but still unfortunately on f31, no time to move ( to f33 probably) yet ...