Change lacing on Python of Clockwork's Element.SuperComponent node

Hi everyone! I created a script on Dynamo using Clockwork’s Element.SuperComponent node that is working fine. For it to work well, I need to set Clockwork node lacing as Shortest.

The core of the Element.SuperComponent node is the python code below.

How can I set it to behave as if the lacing was set as ‘Shortest’?

I’m willing to deploy this script to remote team members that aren’t comfortable using Dynamo at all. Therefore, I decided to paste the root script of the Element.SuperComponent node inside my graph, hoping that people can just use Dynamo Player without needing to deal with installing any packages.

Thanks for your help!

import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *

def GetSuperComponent(item):
if hasattr(item, “SuperComponent”):
sc = item.SuperComponent
if sc: return sc
else: return BeamSystem.BeamBelongsTo(item)
if hasattr(item, “HostRailingId”): return item.Document.GetElement(item.HostRailingId)
elif hasattr(item, “GetStairs”): return item.GetStairs()
else: return None

items = UnwrapElement(IN[0])

if isinstance(IN[0], list): OUT = [GetSuperComponent(x) for x in items]
else: OUT = GetSuperComponent(items)

Your image is too far zoomed out to read the node names so it’s hard to tell what’s going on. It would also be helpful if you formatted the python code using preformatted text (</>).

Lacing is a Dynamo node feature. There’s no such thing as “shortest lacing” for a Python node. You would have to modify the code to behave in a similar fashion. Most likely you just need to adjust your list structure to work in the way that the original node intended.

I would give consideration to finding a suitable method to deploy packages. You’re probably creating more work for yourself in trying to unpackage all these custom nodes than you are in talking with your IT guys on how best to roll out packages to everyone’s systems.

Thank you, Nick. I believe you just needed to click on the image to enlarge it. As for the python code, I just copy&paste it from dynamo indeed.

Yeah, I know Python doesn’t have ‘lacing’ but I read somewhere that you can reproduce the lacing behaviour working with loops in the code. As my knowledge in Python is near to 0, I was hoping for someone to take me “by hands” and tell me what to do in this specific code.

I any case I came out with an unsexy solution: I duplicated the Python node as needed and created the nested list after it.

Thanks

Thank you, @Hamish. It was just 1 node to unpackage so I considered it doable in this specific case.

Just as an FYI for future posts, you need to make sure the nodes are legible before exporting. Enlarging the screenshot doesn’t change the fact that it was exported with bad extents. If you look at your image the node titles aren’t visible. Best practice for graph screenshots is to use the Export Workspace as Image button (camera icon) in the top right corner of Dynamo. Just make sure the node titles are visible when you do this. The entire workspace will be exported, not just the visible portion, so you don’t need to worry about fitting the whole graph.

There are also plenty of posts on the forums already about making python scripts work for lists. Try looking into some of those examples. Even just a little python knowledge can go a long way.

Thanks, Nick! Not sure why the titles weren’t exported but I used the Export Workspace tool. Indeed I looked on previous forums before asking, and that’s why I knew it was possible somehow so I placed my question.

Thanks and have a nice day