Yes.
So, in the diagram that I drew, find the equation of the line connecting A and B in the form y = mx + b
Then, take the negative reciprocal of the slope of AB. (flip the fraction and multiply it by -1).
Next, use the slope of the line that connects C to AB and the point C to find the equation of that line also in the form y = mx + b
Set the two equation equal to each other (mx + b = mx +b) and solve for x. The, plug that x value back into either equation to find y. This is the point at which the two pipes meet.
Now, use the distance formula that topsquark provided to find the distance between C and the new point(lets call it D).
Now use Pythagoras to find the distance from D to the refinery.
Add these two distances:
From C to D + From D to Refinery.
And you have your answer!