Hello,
I’m very new to grasshopper. I’m trying to write a basic piping script for myself now but I’m struggling a lot. I’ll try to explain how I constructed it in my mind as best as I can. Any help/advice etc. will be much appreciated.
My goal is to write a script so by only making a polyline and choosing the right diameter, pipes and fittings will be automatically baked. All fittings are seperate 3dm files which will be imported from the library I made.
-First problem is 3dm files are saved as blocks but when I import and bake them, they get exploded. How can I import them with block their block attributes?
-I guess the most compelling thing for me so far is to orient the object at the corners of the polyline at the correct angle. I added circles to the both ends of the fittings and orient them to the end of the pipes I think I’m getting closer but it still doesn’t work as intended.
-And I don’t know how to combine multiple statements to bring the correct object to the correct place. I tried adding an if statement and it works when I use it only based on diameter. But what I’m also trying to add fittings for different angles as well and this complicates things for me. For example, If it’s 90 degrees turn at DN32, it should bring DN32-90° block. If it’s 45 degrees turn at DN40, it should bring DN40-45° block etc.
So far only thing that’s working as I intended is the pipes themselves although I’m sure there are easier and more practical ways than what I did. I’m attaching the script I created and the fitting files I have some everyone’s welcome to check it.
Thank you,
Pipe.gh (17.0 KB)
cunim25el45.3dm (544.6 KB)
cunim25el90.3dm (596.0 KB)
cunim32el45.3dm (580.0 KB)
cunim32el90.3dm (207.8 KB)