usalu / semio

✏️ Design-Information-Modeling for Kit-of-Parts Architecture.
9 stars 1 forks source link

Add layout to assembly logic #3

Closed usalu closed 1 year ago

usalu commented 1 year ago

Layouts are intended to be a fuzzy description of connected elements in a design. As every element should be placed exactly once, only a tree per connected elements is required. To have potentially the full control, unfinished assemblies can be provided which will be resolved through something like breadth-first search.

Conceptually to achieve this: Image

An algorithm could be this:

Undirected graphs:

Image Image Image Image Image

Result would be:

{
    "assemblies": [
        {
            "sobject_id":"1"
        },
        {
            "sobject_id":"3"
        },
        {
            "sobject_id":"6",
            "parts":[
                {
                    "sobject_id":"2"
                }
            ]
        },
        {
            "sobject_id":"10",
            "parts":[
                {
                    "sobject_id":"4",
                    "parts":[
                        {
                            "sobject_id":"5",
                            "parts":[
                                {
                                    "sobject_id":"8"
                                }
                            ]
                        }
                    ]
                },
                {
                    "sobject_id":"9",
                    "parts":[
                        {
                            "sobject_id":"7"
                        },
                        {
                            "sobject_id":"16"
                        }
                    ]
                },
                {
                    "sobject_id":"11"
                }
            ]
        },
        {
            "sobject_id":"14",
            "parts":[
                {
                    "sobject_id":"12"
                },
                {
                    "sobject_id":"17"
                }
            ]
        },
        {
            "sobject_id":"20",
            "parts":[
                {
                    "sobject_id":"19",
                    "parts":[
                        {
                            "sobject_id":"15"
                        },
                        {
                            "sobject_id":"18"
                        }
                    ]
                },
                {
                    "sobject_id":"23"
                }
            ]
        },
        {
            "sobject_id":"21",
            "parts":[
                {
                    "sobject_id":"13"
                },
                {
                    "sobject_id":"22"
                }
            ]
        }
    ]
}

Directed multi graphs;

grafik Image Image Image Image Image

Idea use networkx as graph engine for finding subcomponents of the graph, do breadth-first search on them, etc

usalu commented 1 year ago

Prototype for undirected graph was implemented by @kaatzjo 🎉 in cc6727621a0ec1a817ba6946c21c6e567f7112c9