2014-03-15

Transform 3D Line into Pipe-like Solids

From an actual job which I've completed this week. The requirement was to transform 3D polyline like this image into pipe-like solids.

Through the following manipulations, cylindric solids along the line can be created.

Step 1

Chopper divides the polyline into individual line segments.LengthCaluculator calculates 2D length of the line segment (_length).
Two CoordinateExtractor extract coordinates of start and end points (x0, y0, z0), (x1, y1, z1).2DEllipseReplacer and 3DForcer create horizontal circle whose center is located at (x0, y0, z0).

Step 2

AttributeCreator calculates components of vector representing direction of the line segment.
vx = x1 - x0
vy = y1 - y0
vz = z1 - z03DRotator rotates the circle so that the face turns to direction of the vector. PI is a user parameter whose value is the circular constant.
Note: There is a bug on the 3DRotator (Custom Axis mode, FME 2014 build 14235), it doesn't work correctly when more than one axis direction has been specified. But it works fine if the rotational origin was (0, 0, 0). So I used two Offsetter transformers in the workflow as a workaround for the bug. After the bug having been fixed, remove the Offsetters and specify (x0, y0, z0) to "Origin X, Y, Z" of the 3DRotator.
Regarding the bug, see also here (Community members only) > Chatter: 3DRotatorProblem