Needing a Label Style that displays the bearing as NORTHEASTERLY, with no DD°SS'MM"

Needing a Label Style that displays the bearing as NORTHEASTERLY, with no DD°SS'MM"

billb
Observer Observer
738 Views
5 Replies
Message 1 of 6

Needing a Label Style that displays the bearing as NORTHEASTERLY, with no DD°SS'MM"

billb
Observer
Observer

I've looked all over the interwebs but haven't found what I need. I am looking for a label style that will label the bearing direction in the -ERLY style, no DD°SS'MM", in the shown quadrants.

 

Example:

Between N22°30'00"W and N22°30'00"E it will display NORTHERLY, between S67°30'00"E and S22°30'00"E it will display SOUTHEASTERLY, etc.

0 Likes
739 Views
5 Replies
Replies (5)
Message 2 of 6

billb
Observer
Observer

I forgot to add my image

0 Likes
Message 3 of 6

andrewpuller3811
Advisor
Advisor

The way I am aware to do it is to -

create a label style that has a text component for each of the different labels you want to possibly show.

create as many expressions as you have components to show

each expression will use an if statement to check the angle and return a text height if it meets the desired outcome. The output text height would be either the normal height you use for text labels, if the condition was met, or a very small number, that would essentially hide the text component, if the condition was not met.

 

An example expression could be -

expression name - "NORTHERLY"

expression:  if(((RAD2DEG({General Segment Direction}) > 337.5) * (RAD2DEG({General Segment Direction}) < 360))+((RAD2DEG({General Segment Direction}) >= 0) * (RAD2DEG({General Segment Direction}) <= 22.5)),0.0025,0.000001)

output type: double

 

expression name - "EASTERLY"

expression: if(((RAD2DEG({General Segment Direction}) > 67.5) * (RAD2DEG({General Segment Direction}) < 112.5)),0.0025,0.000001)

output type: double

 

The northerly one is the more complex as it has to check from 337.5 to 360 and then 0 to 22.5.

 



If a post provides a fix for your issue, click on "Accept as Solution" to help other users find solutions to problems they might have that are similar to yours.

Andrew Puller
Maitland, NSW, Australia
Windows 11
Intel core i7 11800 @ 2.30 GHz with 32GB Ram
Civil 3d 2023
Message 4 of 6

ChrisRS
Mentor
Mentor

Still no image. 😁

Christopher Stevens
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 5 of 6

ChrisRS
Mentor
Mentor

Spot on!

 

I have not examined your logic, but it looks interesting.

 

Two observations:

  1. The specified text height needs to be in model space units.
    You used 0.0025m for a 2.5mm text height.
    This is easy to miss because we are used to typing mm when in the Label Style Composer.
  2. Zero (0) can be used for the "very small number." 
    This was not always possible.

Christopher Stevens
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 6 of 6

ChrisRS
Mentor
Mentor

I would probably use a different approach to the expressions.

 

  1. Your direction scheme breaks the compass into 8 octants.
    An expression to calculate the octant number of a line simplifies the direction expressions.
    1. Each octant spans pi/4 radians.
    2. Adding pi/8 radians to the direction angle (azimuth) simplified calculations.
    3. Dividing (direction + pi/8) by 2*pi normalizes the range to 0 to 1
      (A test reduces values > 1 to 0)
    4. Multiplying by 8 results in octant numbers from 0 to 7
    5. Truncating this value results in integer numbers.
    6. Adding 1 normalizes the range to 1 through 8.
    7. Expression = Octant
      TRUNC(IF(({General Segment Direction}+(pi/8))/(2*pi)>=1,0,({General Segment Direction}+(pi/8))/(2*pi))*8)+1
      (I do not have time to explain further. Feel free to ask questions.))
  2. Because the Octant expression delivers integer values, the direction expression can do simple = tests
    1. Northerly
      IF(Octant=1,0.01,0)
      (This is Imperial. 0.01' = 0.12")
    2. Northeasterly
      IF(Octant=2,0.01,0)
    3. Northwesterly
      IF(Octant=8,0.01,0)
    4. etc.

The attached drawing should get you started.  

 

If you do not have nice clean uniform-sized ranges like this, you may need @andrewpuller3811's approach.

 

Octants.png

ChrisRS_1-1681840400146.png
Shameless Plug Follows.

 

You may want to check out my Civil 3D Label series
over at the Autodesk Community Voices Blog.

 

Civil3d: leveraging Label Legerdemain! A Series
          1 ... Not Magic, but a Quest for Some Pret...
 

 

          2 ... "I Can See Clearly Now ..."   Better Visibility for Text Component Editor Contents Window

 

          3 ... When The Chips are Stacked Against You, Finesse the Stacked Formatting

          4 ... An Expression is An Expression is an Expression NOT!   

 

ChrisRS_2-1681842308384.png


Christopher Stevens
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature