I have a script for placing pipe sleeves at the intersection of the pipe and the floor. The script works well and does place the sleeve at the pipe but I would like to take this to the next step and have it place the correct size of sleeve based on the size of pipe. The pipe sleeve family already has all of the pipe instances. I would like to make more of a table where I can list al of the size pipes and match it to the sleeve size it should be. Any ideas?
ADD SLEEVES TO PIPES MASTER.dyn (48.7 KB)
I would suggest creating a dictionary where the keys are the possible trade sizes of your pipes and the values are the corresponding pipe sleeve families.
The keys may have to be slightly different in your case (as it depends on how the actual formatting of pipe sizes in your project). Alternatively, you could use the pipe’s “Diameter” property, which is not dependent upon any project-specific settings, however this would have to be converted from a number to a string so that it can be used as a key in a dictionary.
I keep getting an error at Dictionary.ValueAtKey. also where can I tie this into the scrip I have to have them place based off of the Dictionary?
The error tells you exactly what’s happening. You don’t have those keys in the dictionary.
Your dictionary uses 2"Ø instead of just 2 and is missing 5 completely.
You would use the pipe diameter values from your list of pipe defining the sleeves in order to get the correct size in your graph.
no luck even with all of the pipe and sleeve sizes defined.
Can you show the whole graph again? We can’t help you solve your problem if we don’t have all of the information. Did you change all of the keys as well?
You ca also easily make your dictionary as a Python script as a *.dyf so it is compact and easily used in other applications.
Revit uses the lowercase character (ø) whereas it looks like you are using the uppercase character (Ø). As a side note, the character used in Revit is not actually the diameter symbol, but rather the similar-looking Scandinavian letter.
You can still use the parameter you were using before (Product Entry), but make sure that you are consistent in the formatting of each of them. If you use “Size”, be sure to use the ø
character, or if you prefer to use “Product Entry”, leave it out entirely.
1 Like
Is the value going into Dictionary.ValueAtKey a string?
Might stick in a Object To String node to make sure it is the right format.
Good to know. (!#&*! Autodesk programmers…)
Yeah, I would avoid using characters at all. Stick with the number values. You also don’t have the same number of keys as you do values.
Yes it is string because you are feeding string into it. To keep it as simple as possible, only use string, int, double, and bool in dynamo
I got the dictionary to work but how can I tie it to my ADD SLEEVES TO PIPES MASTER in the first post? So when the pipe is found it will reference the dictionary and place the sleeve defined in the dictionary.
You’ll need to collect a list of family types and feed that into your final family placement node.
To keep it clean and readable, I’d pair up the points and family types in a list first as
[[FamilyType,Point], [FamilyType,Point], [FamilyType,Point]] and then transpose into two list right before input into FamilyInstanceByPoint.
To get a list of the family types, input a list of family types and names into node FamilyType can vary too - I just cycled the one input to get the list.
FamilyType.ByFamilyNameAndTypeName