Convert blocks into families


Friends, could you help me with this new script? I’m trying to identify elements (cad blocks) from the cad link, and convert them into corresponding families. But right at the beginning I get an error, if I use the dictionary it expects a list, if I use a list it gives an error because the names of the blocks are strings. What can I do?

This is the python that is giving error.
image

Update your function as follows so a single string will be enclosed in a list

def tolist(x):
    if not isinstance(x , str) and hasattr(x, "__iter__"):
        return x
    return [x]

The Genius Loci CAD Block node is out putting the block name which is not a GeometryInstance

The GeometryInstance element contains the information to convert

One of the nice things about custom nodes is that you can inspect the code - open up the node and the code outlines how to inspect the ImportInstance and collect the information you want to use

I would start by copying the code and pasting into a new python node and adjust to get what you are looking for