Design Script to Python (Successes/Failures/Workflows)

I saw a post recently by @Ben_Osborne about converting DS to Python and it really got me thinking about the power of quickly putting some nodes together, converting to DS using the Node to Code and then translating it into Python.

I realize this isn’t the most elegant way of coding, but in some cases it might be a quick and dirty way of generating some of the python code. Anyone want to share successes/failures/workflows that has done this on a few cases?

At this point, I’m just getting familiar with editing other python nodes and only making a few basic ones myself. I think that this is quite relevant to many users on the forums.

Here’s the link to the original conversation
https://forum.dynamobim.com/t/import-all-design-script-methods-to-python/?source_topic_id=11047

@Marcello_Sgambelluri does a similar workflow for Zero Touch.

The syntax of design script is more similar to C# than python, but either way I think the biggest challenge is that both python and C# is imperative code and Design Script is something Autodesk call Associative code. That basically means that you have to make a loop in python or c#, where you in Design Script just feed a function with a list and it will work…

Here is a pdf that gives a little more explanation

Here is a screenshot that might help illustrate the difference:

4 Likes

@john_pierson I’d seen that video from @Marcello_Sgambelluri and thought it was interesting. It would be interesting to see a similar video for a more elaborate example.

@Einar_Raknes I actually ran into this issue just the other day when I was rebuilding the K-Mean script to work with sub lists. I guess that’s one of the benefits of c#, however since most of the design examples are available for dynamo with python, I’m going to focus my attention there first.