View Full Version : 2019 Adding TEXT to an Expression
zeero.error798375
2021-11-25, 12:05 PM
Dear All
need help regarding the below issue.
===========================
I am new to Civil 3D.
want to create an expression in ( Alignment ----Label Styles-----Point of Intersection.)
Expression with IF statement, should return a text " LEFT " when statement true else " RIGHT"... See image attached.
108971
mjfarrell
2021-11-26, 02:01 PM
So what part, if any of your current Expression works, or fails to work?
From what I see your statement would not work as written.
What is the goal of the label? are you after the deflection between alignments?
What I get when I duplicate your Expression as shown is a PARSE Error undefined symbol "LEFT"
A quick bit of research indicates one can NOT have an Expression return a TEXT Value.
So this may not be a thing you can do in this way.
Back the the question; What are you attempting to do with this label?
Show me a 'fake' version with just text and an explanation.
There may be another solution.
zeero.error798375
2021-12-01, 11:39 AM
So what part, if any of your current Expression works, or fails to work?
From what I see your statement would not work as written.
What is the goal of the label? are you after the deflection between alignments?
What I get when I duplicate your Expression as shown is a PARSE Error undefined symbol "LEFT"
A quick bit of research indicates one can NOT have an Expression return a TEXT Value.
So this may not be a thing you can do in this way.
Back the the question; What are you attempting to do with this label?
Show me a 'fake' version with just text and an explanation.
There may be another solution.
Dear mjfarrell thanks for your reply.
Dear my goal is to make a lebl for alignment at IP" Intersection points " which tells me the direction of deflection . that is Right (R) or Left (L) form tangent point.
see attached picture for better understanding.
108975
108976
mjfarrell
2021-12-01, 01:24 PM
Did you add those "LEFT" and "RIGHT" annotations manually?
What does that I= represent, and what is it being calculated against?
Or is that a label style you have seen?
The label shown looks like a standard Statioon and Offset Label108977
I don't know that one can get this from a PI lable it looks like it might be possible from a Curve label, because the options
within the expression generator include Angle In and Angle out, however it is still not going to generate a Left or Right direction output.
If the L and R are automatically placed in the label, you might look into the drawing's settings. There is an Abbreviations tab which has a setting for labeling Left and Right, with each being initially set to the first letter of each direction. You could add the T at the end there to see if it helps.
mjfarrell
2021-12-01, 02:49 PM
Opie,
From what I can tell the OP wants to label the deflection direction at a PI point even if/when there is no curve.
A curve PI point will return a station and offset from the alignment.
I can't seem to get a deflection direction as "LEFT" or "RIGHT" for a PI point because that isn't an option within an expression, it wont return
a TEXT output. I'm not seeing anyway to add this automatically as part of an alignment label set.
Now, it might be a case of evaluating the deflection, testing the angle and then returing a nemeric value to apply a size
to a fixed piece of text that then displays too small to read LEFT when the deflection should be RIGHT
and another piece of text that hides the RIGHT text value when the deflection angle is equal to a LEFT hand change in direction.
MHultgren
2021-12-02, 12:58 AM
Did you try formatting the result as a String in the dropdown at the bottom?
Depending on what your positive direction is set to (clockwise/counterclockwise) you should be able to evaluate the deflection angle and if it is positive or negative (or if it greater than or less than 180 degrees), output the appropriate string (LEFT or RIGHT).
mjfarrell
2021-12-02, 01:06 PM
Mark, I'm not so sure it can do that, even if formatting the output as 'STRING' (?)
Do you have an example that does?
zeero.error798375
2021-12-03, 09:04 AM
Did you add those "LEFT" and "RIGHT" annotations manually?
What does that I= represent, and what is it being calculated against?
Or is that a label style you have seen?
The label shown looks like a standard Statioon and Offset Label108977
I don't know that one can get this from a PI lable it looks like it might be possible from a Curve label, because the options
within the expression generator include Angle In and Angle out, however it is still not going to generate a Left or Right direction output.
Dear MJFARRELL can you share the label of image you attached.
- - - Updated - - -
Did you try formatting the result as a String in the dropdown at the bottom?
Depending on what your positive direction is set to (clockwise/counterclockwise) you should be able to evaluate the deflection angle and if it is positive or negative (or if it greater than or less than 180 degrees), output the appropriate string (LEFT or RIGHT).
Dear MHultgren ... I am unable to find STRING option in dropdown, can you help me in this regard.
mjfarrell
2021-12-03, 01:40 PM
From HELP:
Format Result As
Specifies how the expression results are formatted.
Double: This value is formatted using the Unitless type.
Note
The following are all of type Double but are formatted according to the settings on the Ambient Settings tab in the Drawing settings:
Angle
Area
Coordinate
Dimension
Direction
Distance
Elevation
Grade/Slope
Latitude
Longitude
Station
Volume
I'm pretty sure "STRING" is not an option, if it is I would like to see an example.
The lable is a fairly standard Station and Offset Label
STA <[Station Value(Uft|FS|P2|RN|AP|Sn|TP|B2|EN|W0|OF)]>
N=<[Northing(Uft|P2|RN|AP|GC|UN|Sn|OF)]>
E=<[Easting(Uft|P4|RN|AP|GC|UN|Sn|OF)]>
I=<[Offset(Uft|P0|RN|AP|GC|UN|SD|OF)]>' <[Station Offset Side(CP)]>
jessevas656864
2021-12-22, 01:57 PM
Dear All
need help regarding the below issue.
===========================
I am new to Civil 3D.
want to create an expression in ( Alignment ----Label Styles-----Point of Intersection.)
Expression with IF statement, should return a text " LEFT " when statement true else " RIGHT"... See image attached.
108971
There's an extra right brace in your expression. "Right}" Did you try removing it?
mjfarrell
2021-12-22, 04:12 PM
jessevas656864 Question for you; did you make such a lable and get it to add the Left or Right text?
Is so could you post an example? of your code for it to work?
chris805_1996
2021-12-23, 03:30 AM
One cannot return a string in an Expression. Why? Because Autodesk sucks. I'd suggest finding a software vendor that actually cares about their customers and doesn't force them to do horrible workarounds to get a frequently requested feature.
To get it to work, you have to have two expressions and two text components that have LEFT or RIGHT in them. Then you use the expression to make the text height either size you want or really small so it doesn't show up.
Here is an example: http://blog.civil3dreminders.com/2008/12/vertical-curve-hplp-split-profile.html
I wasn't able to find the drawing I created over a year ago that showed it and Google has killed the file: https://sites.google.com/a/civil3dreminders.com/www2/checkrightorleft?authuser=0
Here is an article with better instructions on the concept: https://www.augi.com/articles/detail/express-yourself-using-expressions-in-civil-3d
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.