Trimble Business Center

 View Only

 how to offset a line in elevation, perpendicular to it's slope?

  •   TBC-General
Nathan Balcom's profile image
Nathan Balcom posted 04-23-2021 09:46
Hello,

When offsetting lines in elevation they retain the same location horizontally. Is there a way to offset lines in elevation that reflects the angle of the lines? A perpendicular offset in elevation.

I tried the offset slope command, and it gives a runtime error when opening it, not sure if it would be the correct tool.  TBC version 5.40.1

Cheers!
Nate B.
Shane Odenbach's profile image
Shane Odenbach
Hey Nate,

Could you share a some screen shots of what you are trying to do?  and the error your get when using offset slope?

Thanks,

Shane
Wayne Welshans Wayne Welshans's profile image
Wayne Welshans Wayne Welshans
Nathan, I understand what you are asking and have tried to do the same thing in the past.  As far as I know there is no direct way to do it.  The best workaround I was able to come up with, and it only works in some situations, is to create a surface profile (meaning you need to have a surface and an alignment).  Then view that surface profile in profile view where you can use the standard offset line command to offset the surface profile.  This will give the desired result of the offset being perpendicular to the slope.  Then use that offset profile(s) to construct a new surface.
Ronny Schneider's profile image
Ronny Schneider
Hello Nathan,
have a look at the attached video. It's a bit of clicking around, but it should be what you're after.

My proposal would be to
1. create an Alignment out of the linestring
2. view a profile view of the Alignment
3. use the CAD-Offset function in that profile view on the vertical Alignment
4. create a new vertical Alignment from that offset line
5. delete the old vertical Alignment
6. explode that whole Alignment to a Linestring
Ronny Schneider's profile image
Ronny Schneider
Hi Nathan,
in addition to my first comment I had a quick look at the macro language.
Attached a first quick version of a macro. Unzip it into the folder "C:\ProgramData\Trimble\MacroCommands" and restart TBC.
Its been written while having a beer. No error proofing and extensive checking done yet. It might throw an error once in a while. But it did work with pretty much every line type I've checked so far.
Once I have more time I'll look more into it.
Be careful at the begin and end of the line, since it's a perpendicular offset the new line might be shorter, although it seems to actually extend it according the length of the horizontal alignment.
Wayne Welshans Wayne Welshans's profile image
Wayne Welshans Wayne Welshans
Ronny,

Wow that is quite impressive!  I've been struggling for a few years now trying to get myself into the TML coding.  I guess I've got to try out what ever beer you're having because the Guinness is coming up short lol.

Cheers, Sir!
Nathan Balcom's profile image
Nathan Balcom
@Shane Odenbach
​Here are the errors I get when trying the Offset Slope command.

For the other part, say you have two points in space one at 5,5,5 and the other at 5,10,10, and you create a line between them, you'd have a 1:1 line with a vertical difference of 5 from the lower to higher end.
now if you run the offset line with a -5 for vertical offset, and create points at the end of the new line, you get one point at 5,5,0 and 5,10,5.

since the first line is at a 1:1, when I vertically offset it, in my mind, I'm offsetting this line at it's angle vertically (so in truth, perpendicularly) and expecting the points at the ends of the new line to be at 5,10,0 and 5,15,5 respectively.  Especially since I'm picking an angled line, I want the offset to follow in the direction it's sloped.   I can understand why this doesn't happen, as a linestring with multiple nodes at different lengths and angles would look pretty odd if you tried to offset it in this way. similar to horizontally offsetting a curb line that has an arc in it, when staking out for the curb guys. 

The scenario that brought this question about involves trying to calculate the landing location of some support columns under a sloped pedestrian bridge. The steel columns are perpendicular (90 degrees) to the slope of the bridge and land at vertically plumb plinths. I want to find the location of the plinths, knowing the location of the column attachment at the underside of the bridge, and knowing the elevation of the FG in the area the concrete footing and plinths will land at. If I could offset a point perpendicular to the sloped bridge at the column connection location, at an exaggerated distance and create a line from the column attachment point to the offset point, I could find where the proposed FG intersects this line and then determine the length of the column as well as it's horizontal location.

Is there a way to have my sloped line be the reference zero bearing line, and offset by the reference line, thus tricking TBC into thinking it's just a vertical offset relative to the reference line and it's true bearing and angle?

Cheers!
Nate B.
Ronny Schneider's profile image
Ronny Schneider
@Wayne
The hurdle is high, since it is pretty much undocumented. It took me the whole Christmas break to get an initial idea of how Python and the TBC functions work. The few old macros that got installed with TBC ​are in plain ASCII and give you some hints. The newer versions are compiled and you can't read them anymore.
It's a lot of browsing and searching in the Object Browser in Visual Studio and a lot trial and fail. Visual Studio doesn't provide Intellisense for Ironpython and TBC functions, and with the latest VS update they even removed the support for IronPython 2.7. You have to force it to use the outdated Versions. At least the debugging with breakpoints works and you can see what values variables get during runtime, and how they are structured inside since everything is object based. Without that you'd be lost.

But once you get the hang of it you can do a few nifty things.


That macro here is rather simple and the interesting part just a few lines actually (no error testing included yet).
offset_v = self.offset_v.Value # we read the offset value from the numeric input field

# get the line data as so called polyseg
polyseg1 = l1.ComputePolySeg()
# just in case we convert it to world coordinates
polyseg1 = polyseg1.ToWorld()
# and we get us the vertical information also as polyseg, pretty much the vertical profile view
polyseg1_v = l1.ComputeVerticalPolySeg()

# we use the offset function on the profile view
offset_v_polyseg = polyseg1_v.Offset(Side.Left, offset_v, PolySeg.PolySeg())

# the offset_v_polyseg comes back as tuple object
# [0] is boolean and states if the computation was successful
# [1] contains the new offset polyseg

# from here on it's from the old ConvertToLineString macro
container = l1.GetSite()
ls = container.Add(Linestring) # create a new line

ls.Append(polyseg1, offset_v_polyseg[1], True, False) # add the new horizontal and vertical data to it

# change some of the new line properties to the ones from the input line
ls.Layer = l1.Layer
ls.Color = l1.Color
​
Attachment  View in library
Ronny Schneider's profile image
Ronny Schneider
New version that works in TBC 5.50