Hello, I am wanting to export fabrication pipe lengths and valves,elbows,fittings as quantities. I’ve been racking my brains and cant seem to figure out how to separate them since they all get returned as Pipe. Any help would be greatly appreciated.
2TESTTTTExport BOWS Script.dyn (65.7 KB)
Fabrication parts have an IsAStraight() method which would allow you to do this. See below:
elements = UnwrapElement(IN)
straights = 
other = 
for element in elements:
OUT = [straights, other]
Let me give it a shot. Thanks for the response.
Your script worked but i didnt know how much more i needed to filter out the script.
So i create a custom node to return Product name, Part Id, Product Long Description, CIDs, and centerlineLength. So I’m wanting to return length of the 2 pipes in my model and return a quantity of everything not named pipe.
Ah, that makes sense. If all pipe sections have “Pipe” in their name, then this is the right approach. I believe that is the case, but do some spot checks just to make sure.
So I have all the information I need from the fabrication parts, now is trying to extract pipe & length in to another list since pipe is the only thing that will counted as length and everything else will be pieces.
Is there a way to return the pipe and its length and also return everything else as = 1?
“0” Coupling = 1
“1” Coupling = 1
“2” Pipe = 7’ 5 53/128"
“3” Adapter = 1
“4” Coupling = 1
From your list of straights, I would further split it out using “Pipe” as a keyword. Then, rather than getting the “Length” measurement from all elements, you would only do so for your pipes and then create a list where every value is “1” to act as your counter for pipe fittings, valves, etc.
As @cgartland said you can get index of “Pipe” as a keyword by using List.AllIndices node. Later use that indexes to get other items.
Is there a way i can do it with the current flow i have. Im almost done with the script but cant get this length/qty right. 33333TESTTTTExport BOWS Script.dyn
Can you create an example. I’ve been trying and trying and and just been hitting a wall.
Worked perfectly, i do have one question. It looks like i have a couple of tees that have pipe in the family name, if i wanted it to get separated out with the other parts how do i achieve this?
Ok. I don’t want to throw a curveball in here when you are so close. But. Could you not just do a filter by CID number. All straight pipe should have the same CID. If you pull the CID and then filter by a mask looking for just that CID you should be able to remove all fittings like that.
MI_Select Fab Part by CID Filter.dyf (33.2 KB)
You can try this. Its a custom node I use to take a list of elements and filter out anything that’s not a Fabrication part that matches a CID input to the node. If you leave the CID input blank it will just filter out all non-fabrication parts.
I don’t know if this will help your current specific situation, but it may be useful to you in the future.
This would work but my transitions fitting have the same 2041 CID like my pipe so its returning length instead of a piece. I’m starting to figure out how lists work, now its more how to filter/sort out certain elements. Thanks for all the help its very useful.