# Offset 3D line in the Z Axis (World Coordinate System)

Hi,

Is there anyway to offset a 3D line in the Z Axis only? I am not able to do this in perspective view as I am limited in the x or y axis. When I try to offset in either the right or front view, the resulting offset is different depending on which view I use. How can I offset a line in the z direction such that when looking from the top view, the original line is directly under the offset line?

Any help is appreciated.

Well, Offset is a 2D operation that depends on a plane as a reference. By default, the plane is either the plane of the curve - if Rhino can determine it - or if not, the active CPlane. A line does not have one inherent plane, so it falls into the second category - so in this case the world top plane will be used if the Perspective viewport is active.

That being said, if a line is not lying flat on the World XY plane - that is to say it is inclined in Z to some degree - then its offset will not be directly above it viewed from the top in any case - as an offset of a line is defined as being parallel to the line at all points - i.e. line segments between the start/end points of the line and its offset will be perpendicular to both.

Correct me if I’m wrong, but what you appear to want is a vertical copy, but with the specified parallel offset distance between the copies. I don’t think there is a built-in function to do this, however it should be possible to create a small scripted tool to do so - just needs a bit of math to calculate the copy distance. However, this would only work correctly with lines or curves that were planar.

Thanks for the response,

I may have worded my question poorly, I want an offset in the z axis as described in your second paragraph. I understand when viewed from the top view, these lines would not be perfectly under each other due to the fact that the offset would be perpendicular to inclined line.

I Just want the vertical movement part of the offset to be in the z axis of the world coordinate system. That is I don’t want the offset to be at some degree away from the z axis.

Application: I have a 3D line model of a drainage network, (lines represents the invert of the pipes), I want an offset in the z axis (World Coordinate System) to show the center line of the drainage pipe. Once I have this centreline in the correct position, I can use the rhino pipe command to show the extents (diameter) of the drainage pipe which would then show where the drainage pipe would enter through the walls of a drainage pit.

Thanks for any help.

OK, I guess I’m not understanding how this would be different from just using Copy with the Vertical option… Can you post a small example of the starting line(s) and the result you would like to have?

I think that he needs the resulting curve made by “Object intersection” between a pipe around the original curve and a vertically extruded surface which also uses the original curve as an input. However, to do so, in some cases the pipe should be automatically extended (such like what the “Extend surface” with “Type=Smooth” option does) in order to be able to create a proper 3d offset curve intersection of a steep (inclined) original 3d curve. Probably something like this, where the green pipe is extended, while the red one is not?

3d offset curve.3dm (286.1 KB)

A little lateral thinking. I’m assuming your drainage network is made up of straight segments. Make pipes of the correct radius around each invert line. Then take each pipe in turn and move it up by its radius using the end of its invert line as the ‘from’ point and the end point at the top of the pipe as the ‘to’ point.

This makes the movement perpendicular to the pipe, preserving the true radius whilst ensuring that the invert lines continue to meet, which I think is what you want. You have to do the segments individually (although I suspect that a simple vertical move as proposed by Mitch would be good enough for drainage system tolerances).

If I’m misunderstanding what you want, please post your model so we can see the problem rather than having to guess.

Regards
Jeremy

If all the straight segments composing a pipe run are at exactly the same slope, an exact parallel vertical offset solution is possible with all joints meeting. However, if the slope varies between segments, the ends of the offsets will not meet if the exact distance is maintained, so the joints need to be adjusted somehow so the ends meet - meaning that the offset distance needs to be “compromised”.

@Rhino_Bulgaria 's solution is interesting, but with kinked curves (such as a zigzag pipe run with corners) the intersection curve, while possibly continuous, will have some deviation near the corners as well. That’s just the geometry of the situation. In a real-world situation, the pipe elbows handle this situation nicely. So one could determine a corner radius, remove the corners to that radius and then create a blend there. Might even be scriptable.

In case it’s useful, below is a rather simpler approach which vertically offsets lines and planar curves keeping the parallel offset distance. If you have polylines that are not planar, you will need to explode them first; the solution will then have segments where the corners do not meet - you will need to fix/adjust those manually. FWIW.

OffsetVertical.py (2.1 KB)