So, if you just need the 2D length this can be achieved fairly easily.
SurfaceFootprintReplacer > Dissolver (to get one single polygon) > CenterLineReplacer. This should give you a pretty decent centerline (including the curves).
Next use a Clipper with the SurfaceFootprintReplacer polygon as the Clippers and the Centerline as the Clippee. It worked well in your test data, however, I'm not quite sure how you'd want to handle the T-junction.
If you needed this in 3D that would be a little more tricky. This would not be a very helpful process for vertical pipe sections
So, if you just need the 2D length this can be achieved fairly easily.
SurfaceFootprintReplacer > Dissolver (to get one single polygon) > CenterLineReplacer. This should give you a pretty decent centerline (including the curves).
Next use a Clipper with the SurfaceFootprintReplacer polygon as the Clippers and the Centerline as the Clippee. It worked well in your test data, however, I'm not quite sure how you'd want to handle the T-junction.
If you needed this in 3D that would be a little more tricky. This would not be a very helpful process for vertical pipe sections
@virtualcitymatt Thanks, Matt! That's interesting but I need the correct lengths so the solution must account for 3D.
@virtualcitymatt Thanks, Matt! That's interesting but I need the correct lengths so the solution must account for 3D.
Fair enough - just looking at the data again, are you aware that the lengths are already included in these data?
@virtualcitymatt Thanks, Matt! That's interesting but I need the correct lengths so the solution must account for 3D.
@virtualcitymatt I'm not sure what you mean, I can't find length? If it's there and if it's actual length (and not just an attribute) then it's interesting. However I would like to find a solution to this problem either way. Thanks for you input, again.
@virtualcitymatt Thanks, Matt! That's interesting but I need the correct lengths so the solution must account for 3D.
@virtualcitymatt I found it now. Ouch this trait-concept is difficult for me. Thanks again!
@virtualcitymatt Thanks, Matt! That's interesting but I need the correct lengths so the solution must account for 3D.
@virtualcitymatt Just spoke to my collegue, he knew but the problem seems to be that not all objects (in a full data set) has valid length attributes. So the problem remains!
@virtualcitymatt Thanks, Matt! That's interesting but I need the correct lengths so the solution must account for 3D.
Ahh that's too bad.
The next thing I've seen is that the pipe sections that are not joins or corners seem to be read by FME as FMEExtrusion geometry - this is great because the extrusion is just a vector which is stored in the geometry.
The downside is that there is no transformer to extract this, but fortunately there is some pretty simply python that can be used to get it and calculate the length.
Here is a screen shot from a small workspace which just filters out the unsupported geometries types (we just want the IFME Extrusion.
The Pyhton Caller is used to extract the extrusion vector and create a _len attribute from it.
Here is the python inside the transformer:
import fme
import fmeobjects
from fmeobjects import FMEFeature, FMELine, FMEGeometryTools
class FeatureProcessor(object):
def __init__(self):
"""Base constructor for class members."""
pass
def input(self, feature):
#Here we get the extrusion vector from the pipes, create a line feature out of it and calculate the lines length
#extract the vector
vec=feature.getGeometry().getExtrusionVectorXYZ()
#create an empty line
_line=FMELine()
#add two points to the line, 0,0,0 (the origin) and the end of the vector we extracted above)
_line.appendPoints(e(0,0,0),vec])
#extract the length of the lines (the "True" incuicates a 3D Length)
_len=_line.getLength(True)
#dd _len as an attribtue to the feature
feature.setAttribute("_len",_len)
#output the feature with a new attribute
self.pyoutput(feature)
def close(self):
"""This method is called once all the FME Features have been processed
from input().
"""
pass
The important stuff is Indie the 'Input' function.
This of course only works on those pipe sections which are read as extrusions, sadly not the bends or joins.
@virtualcitymatt Thanks, Matt! That's interesting but I need the correct lengths so the solution must account for 3D.
@virtualcitymatt Thank you so much for your effort, Matt! We'll test this approach on a larger data set to see if the will be the whole or a part of the solution. We are so grateful for your help.
@virtualcitymatt Thanks, Matt! That's interesting but I need the correct lengths so the solution must account for 3D.
All good, I lernt something so very much worth it! Cheers and good luck