Help sorting Fabrication parts for length and Quantities

#1

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)

#2

Fabrication parts have an IsAStraight() method which would allow you to do this. See below:


Fab Straights.dyn (14.5 KB)

elements = UnwrapElement(IN[0])
straights = []
other = []
for element in elements:
	if element.IsAStraight():
		straights.append(element)
	else:
		other.append(element)
	
OUT = [straights, other]
2 Likes
#3

Let me give it a shot. Thanks for the response.

#4

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.

#5

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.

#6

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.

#7

Is there a way to return the pipe and its length and also return everything else as = 1?
Example:
“0” Coupling = 1
“1” Coupling = 1
“2” Pipe = 7’ 5 53/128"
“3” Adapter = 1
“4” Coupling = 1

#8

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.

#9

Hi @jes.gonzalez

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.

#10

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 (95.3 KB)