Python script to choose a family depending on input

Hey everyone, I’ve been using dynamo for a couple weeks now and had much success with no python background. However, i feel like my run time take sometime to complete. Im trying to compress my script using python. Can some one point me in the right direction on how to accomplish this task. I need an if else statement that looks at the pipes diameter and selects the right sleeve family. ex. if IN==6 then family 100SLV. I hope the picture below depicts on what im trying to accomplish. ive done this using nodes but the script is massive. Any help will be much appreciated.

Thank you,

Stephen.

You can always try node to code. Select the nodes you want to compress, right click on the canvas, select node to code. I’m not totally sure if thats what you’re asking for but I didn’t know about node to code and it’s helped alot.

Look up some simple conditional statements for Python (IF is probably all you will need for this.) Even if you have no coding experience it should be pretty straight forward. If you have even a bit of coding experience it should be no problem at all. Just follow the syntax. This is a good workflow if your families work with a range of pipe sizes.

The other thing you could do is create a dictionary if you want to use set diameter sizes. If you’re unfamiliar with dictionaries just search the forum. Then you can input any diameter from your dictionary and it will return the matching family.