Left or Right Curve

apweng
Collaborator
Collaborator

Left or Right Curve

apweng
Collaborator
Collaborator

Hi there,

 

I'd like to return LT for left direction curve or RT for right direction curve in a curve label style.

 

Can anybody help me with a formula for an expression to determine whether a curve is left or right direction curve?

 

Thanks!

 

Andrew

 

 

0 Likes
Reply
4,849 Views
10 Replies
Replies (10)

AKoerner
Advocate
Advocate

Hi Andrew,

 

Try this:

 

  1. Create 2 expressions for the curve label styles:  one for the 'right' label text component height, and one for left.  Expressions are based on the curve start direction - curve end direction.  note that you *may* need to adjust the equation to account for certain values for the directions (or use additional expressions?).

    Expression_Right.png

    Expression_Left.png

    Note that the value of '0.00254' corresponds with an intended text height of 2.54mm for this example.
  2. Next, create a 'Left' and a 'Right' text component in your label style...use the same anchor point, etc for each and set the text height to the appropriate expression (created in the previous step):

    LabelStyle.png
  3. Test on a couple of curves to validate the results:

    LtRtCurveLabels.png

 

Adam Koerner
civil+plus
Your work is challenging…your software shouldn’t be.
http://civilplus.net
civil+plus on Autodesk Exchange Apps

Joe-Bouza
Mentor
Mentor
Not in front of c3d , but isn't there a curve direction property in the lable composer?

Joe Bouza
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

AKoerner
Advocate
Advocate

There are General Segment Start Direction, General Segment End Direction, and Curve Chord Direction fields, however, these return azimuths or bearings depending on settings; there is also a General Segment Total Angle value that always returned a positive angle value when i tested it... The first two fields are the ones you must therefore use to calculate a signed delta value (unless I'm missing something here?), which may then be used to determine whether the curvature is oriented to the 'right' or to the 'left'.  Because we cannot generate text values in expressions, we must add text components for both options to the curve label style and use the expressions to control text height...

Adam Koerner
civil+plus
Your work is challenging…your software shouldn’t be.
http://civilplus.net
civil+plus on Autodesk Exchange Apps
0 Likes

joantopo
Mentor
Mentor

alignment entities(arcs) in API Civil 3D has the bool property: Clockwise.

 

However, we cannot get this property in the expression.

This is one thing that I ordered in Civil 3D ideastation.

 

I wanted to get this for reports because in Spain is typical adding a minus (-) symbol in the Radius if the curve is to the left.   Report of that curve:  -Radius.

(This is an idea for Visual Report Designer 🙂  )

 

 

I don´t know if we can get a "bool" clockwise from the start and end direction.

 

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes

joantopo
Mentor
Mentor

There is a easy way to know if a curve is Right-hand or left-hand.

 

If we were able to get the center point of the arc and the (start or end point of the arc), then we could check if the center point is on the left or on the right.

If the center point is on the left (negative offset), then the curve turns to the left.

 

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes

AKoerner
Advocate
Advocate

Hi Joan,

 

That would only work for some arcs... consider a 180-degree arc.

 

This could possibly be solved using vectors, though I haven't looked at this in sufficient depth to see whether the necessary fields are exposed (I think there may be some problems there which could be difficult to resolve via expressions). Regardless, to simplify the expression, I suggested using a signed delta based on start and end directions, however, there is very likely still an issue with this as well depending on how the angles/directions are presented and where the curve endpoints are located.  For example, if the curve is starting in Q4 and ending in Q1, the expressions I suggested may fail as presented.  In order to implement a robust solution, one would need to work through the various scenarios (including 180-deg curves, which may be problematic in any approach given the available fields) and determine what angle corrections need to be made, etc.  The reason I left it simplified was to emphasize the technique for turning the text 'RT' and 'LT' on/off...

 

[Edited:  corrected a few items...]

Adam Koerner
civil+plus
Your work is challenging…your software shouldn’t be.
http://civilplus.net
civil+plus on Autodesk Exchange Apps
0 Likes

joantopo
Mentor
Mentor

Yes, with expressions it´s very dificult.

 

with Civil 3D API, we only need the start direction and the coordinates of the center point.

The start direction of the arc will be a ray,

 

From the center point, we create another ray (start station+100 gon) to be ortoghonal.

Then we find out the intersection point between both rays and then we calculate the offset length. According on the sign of the offset, then the arc is right-hand or left-hand.

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes

sboon
Mentor
Mentor

Here's a simple label using the expressions required.  These will work for a curve less than 180 degrees.  You can also create almost the same expressions for generic curve labels.

 

Steve
Please use the Accept as Solution or Kudo buttons when appropriate

Steve
Expert Elite Alumnus
0 Likes

sboon
Mentor
Mentor

I thought about Adam's comment over the weekend, and worked out a new version of the expressions that will allow for curves greater than 180 degrees.  Now it doesn't matter what the curve looks like, the label will always describe it properly.

 

Steve
Please use the Accept as Solution or Kudo buttons when appropriate

Steve
Expert Elite Alumnus

joantopo
Mentor
Mentor

jajaja, nice trick--> text height=1 if it is true and text height=0 if it is false.  🙂

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
0 Likes