Fabrication Specs Python Help

I’m a little rusty on my python so wondering if someone here could help me. So I’m trying to pull all the loaded specifications in the project. I wrote a custom python node and am pulling the SpecificationId without a problem. Now I’m trying to get the name with the Id but just can get it to work.
Here is the C# code:

Here is my project showing im pulling ID’s correctly

If I manually enter an Integer into the second python node named “Fabrication Specification Name” I can get a name. I want it to iterate through like the C# code does.

Here is the Python Code that works when I type a single Integer that gets the name. What does this have to look like for it to work?

you are feeding in a list of lists so you can do something like this:

for item in SpecID:
    for itemId in item:
        test = config.GetSpecificationName(itemId)
        elementList.append(test)

OUT = elementList

you could also use something like Map() to make sure that if you feed in a flat list it still works. For this particular example you need to iterate a nested list, but you might as well just flatten it and do away with secondary “for loop”

Thanks for the response Konrad. I tried that originally but it will pull the last index. I know that because using snoop I can see 165 for specification.


It should be pulling all specs not just the last. Am I doing something wrong?
Here is the update python.

you noticed how i pushed the elementList.append() statement inside of the second loop. just indent that twice…otherwise its outside of the loop and only adds the last item to the list.

Man its going to be one of those days! Thanks so much Konrad!