 SOFTWARE SOLUTIONS FOR CIVIL ENGINEERING

Civil Fast Forward

# Alphabetical instead of numerical Sample Line Labels

If you want to change the sample line numbers into the letters in your sample line style description in Autodesk Civil 3D you can do it by creating your own sample line style that enables that operation.

Using this method you can easily create a letter description instead of a numerical/digital description. This method is useful in every alphabetical system so you don’t need any additional software to create:

– Letters in your native language alphabet,
– Letters without certain and specific letters (if you want).
If they are not used by design for any particular reason (e.g. some national alphabet letters),
– Your own letter system e.g. A, A’, A’’ or any other combination of an alphabetic system.

You will get all the needed information about this method to use it in the English alphabet.
You can also easily use it in any other alphabet system because it describes the universal rules

In spite of the differences in the alphabets like:

– Changes in the letter sequences in the national alphabets,
– Amount of letters (e.g. the English alphabet consists of 26 letters).

For most cases the sample lines can be described by the English alphabet letters without the national letters.
But even if you want to use them in your language you can do it anyway.

This method is described in two parts:

Part I – the basics of the method describing the standard method,
Part II – the Unicode improvement that improves the standard method (only for the English alphabet).

PART I – THE BASICS OF THE METHOD

You can make the sample line labels of the letter description for your sample lines.
You can assign a number to each letter and an extra number 0 equals null (empty). When you use the English alphabet you have 26 letters so you can describe it as: – Using only one digit you have 26×260=26 so you can describe 26 sample lines,

– Using only two digits you have 26×261+26×260= 702 so you can describe 702 sample lines,

– Using only three digits you have 26×262+26×261+26×260 = 18 278 so you can describe 18278
sample lines, this should be sufficient enough for most cases.

Note that you will get the sequence of the letters among others:
A,B,C,…,Z,AA,AB,AC,…AZ,BA,BB,BC,…,BZ,…,…,ZZ,AAA,AAB,AAC,…AAZ,BAA,…,…,…,ZZZ Generally you can convert any numerical/digital value into a letter marking.

You can use for this a simple method based on dividing and using the modulo operations.
This mechanism works as shown below: Using these simple calculations you can create your expressions for your sample lines.
However in some cases you should also make some extra logic operations to get the correct letter notation e.g.
from the value = 680 you get the letters: _, Z, D not: A, _, D.
It is a consequence of using the 0 value to represent an empty space. Therefore you should use an extra mechanism that will control the correct values of
the letters, remembering that the letters have their own values from the range: 1 – 26.

In other words you cannot use the 0 value after a non-0 value.
You should change that 0 value into the preceding value which will be the value = 26

So you should build some logic auxiliary expressions that will control the move mechanism when it is
necessary and calculate the proper values. You can use basic math and logic operations and build such

1. Choose the Sample Line node from Settings in your Toolspace,
2. First of all, choose Label Styles and then add a new expression and give it a meaningful name e.g.
NumChr which is equal to the amount of the letters in the English alphabet NumChr = 26 3. Next create new truncated expressions for every digit which you should numbering somehow but in the
same manner e.g. the first digit = 1, the second digit = 2, the third digit = 3

4. You can choose some math functions by selecting the button with the f(x)+ icon,

5. Give your expressions some meaningful names e.g. Trunc1, Trunc2, Trunc3
and choose also Format result as Double,

Trunc1:

TRUNC((({Sample Line Number}/NumChr)/NumChr)) Trunc2:

TRUNC((FMOD(({Sample Line Number}/NumChr),NumChr))) Trunc3:

TRUNC((FMOD({Sample Line Number},NumChr))) 6. Create the auxiliary value expressions and give them some meaningful names e.g. AuxVal1, AuxVal2,
AuxVal3 and choose also Format result as Double,

AuxVal1:

IF((Trunc1+NumChr)<=NumChr,Trunc1+NumChr,Trunc1) AuxVal2:

IF((Trunc2+NumChr)<=NumChr,Trunc2+NumChr,Trunc2) AuxVal3:

IF((Trunc3+NumChr)<=NumChr,Trunc3+NumChr,Trunc3) 7. Create the digit value expressions which will calculate the final values of the letters and give them some
meaningful names e.g. DigitVal1, DigitVal2, DigitVal3 and choose also Format result as Double,

DigitVal1:

IF((LOG10({Sample Line Number})/LOG10(NumChr))<=2,0,
IF(((Trunc2<=1)&((Trunc3!=AuxVal3)|(Trunc2!=AuxVal2))),
AuxVal1-1,AuxVal1)) DigitVal2:

IF((LOG10({Sample Line Number})/LOG10(NumChr))<=1,0,
IF((Trunc3!=AuxVal3),IF((AuxVal2-1=0),NumChr,AuxVal2-1),AuxVal2)) DigitVal3:

AuxVal3 You have the mechanism which calculates the proper values for each sample line.
Now you can build your expressions which will control the visibility by changing the height of every digit.

When the calculated letter corresponding to its position should be visible then the height of this letter changes
into the height which is visible now and
if the letter shouldn’t be visible then the height of the letter changes into the invisible height equals almost zero.
Thus you will see only the correct letters.

8. Create the expressions which will control globally the height of the letters:

MajusculeHeight = 0.005 MinusculeHeight = 0.0000000001 9. Create the expressions which will control the height of every letter,

The letter A expressions for 1, 2, 3 digit:

viA1 where A=1 → IF(DigitVal1=1,MajusculeHeight,MinusculeHeight) viA2 → IF(DigitVal2=1,MajusculeHeight,MinusculeHeight) viA3 → IF(DigitVal3=1,MajusculeHeight,MinusculeHeight) The letter B expressions for 1, 2, 3 digit:

viB1 where B=2 → IF(DigitVal1=2,MajusculeHeight,MinusculeHeight)

viB2 → IF(DigitVal2=2,MajusculeHeight,MinusculeHeight)

viB3 → IF(DigitVal3=2,MajusculeHeight,MinusculeHeight)

Getting the values from the letter table, create the expression for each letter until the letter Z:

The letter Z expressions for 1, 2, 3 digit:

viZ1 where Z=26 → IF(DigitVal1=26,MajusculeHeight,MinusculeHeight)

viZ2 → IF(DigitVal2=26,MajusculeHeight,MinusculeHeight)

viZ3 → IF(DigitVal3=26,MajusculeHeight,MinusculeHeight)

10. Create the offset expressions which will control globally the distance between the letters.

For the first digit:

IF((LOG10({Sample Line Number})/LOG10(NumChr))<=2,0,0.015) For the second digit:

IF((LOG10({Sample Line Number})/LOG10(NumChr))<=1,0,0.01) For the third digit:

0.005 11. Create your own letter sample line style and name it e.g. myLetterSection,

12. Build the text elements for the sample line label letters,

13. Add a new text element for the first A digit and name it A1:

– Set Name = A1
– Anchor Point = End
– Contents = A
– Text Height = viA1
– X Offset = OffsetChr1 14. Add a new text element for the second A digit and name it A2:

– Set Name = A2
– Anchor Point = End
– Contents = A
– Text Height = viA2
– X Offset = OffsetChr2 15. Add a new text label for the third A digit and name it A3:

– Set Name= A3
– Anchor Point = End
– Contents = A
– Text Height = viA3
– X Offset = OffsetChr3 16. Add the text elements for each successive letter in the same manner,

17. Select the sample lines and choose the created sample line style
description and click the Add button,

18. Next click the OK button and finally you will see the result. PART II – UNICODE IMPROVEMENT

If you know how the standard method works for the sample line letter style you can note
how to improve it to get a much faster and a more effective method.

The standard 26-elements method uses 26 letters for every three positions that gives 26×3=78 elements.

You can reduce this number of elements and get a better method for a large amount of sample lines because
the more elements the greater losses. When you check the Unicode values for each letter you can note that almost every letter can be calculated in the Unicode manner to get the Unicode character value.

You cannot calculate only some letters that using hexadecimal numbers which using the letters again
(A, B, C, D, E, F). But in spite of this you can greatly improve this method by grouping the letters so much as
possible in the groups of decimal numbers which you can easily calculate and control by simple logic operations. By grouping the letters using their Unicode values you will get 7 groups of the letters with
one strong AIPY group which includes the majority of the alphabet letters: When you look at each group you can draw conclusions about how to create
the expressions in your Unicode sample line style.

I group – AIPY – for letters A, B, C, D, E, F, G, H, I, P, Q, R, S, T, U, V, W, X, Y

Notice:

AI → U+0041,U+0042,…,U+0049, that is→U+004(1, 2, 3… 9)
PY → U+0050,U+0051,…,U+0059, that is→U+005(1, 2, 3… 9)

Generally:

AIPY→U+00(4or5)(1,2,3,…9)

So that you need some expressions which will control the first Unicode component 4 or 5
and also the expression which will control the second Unicode component 1, 2, 3… 9

II group – JZ – for letters J, Z

Notice:

J → U+004A
Z → U+005A

Generally:

JZ→U+00(4or5)A

So you need the expression which will control the Unicode component 4 or 5

III group – K – for letter K

You don’t need any extra expressions likewise for other groups: L, M, N, O

IV group – L – for letter L

V group – M – for letter M

VI group – N – for letter N

VII group – O – for letter O

You can create the expressions for the groups: AIPY and JZ and these expressions will control both groups.

For AIPY group you will use these expressions below:

for 1 digit → U+00<UniChar11><UniChar21>
for 2 digit → U+00<UniChar12><UniChar22>
for 3 digit → U+00<UniChar13><UniChar23>

For JZ group you will use these expressions below:

for 1 digit → U+00<UniChar11>A
for 2 digit → U+00<UniChar12>A
for 3 digit → U+00<UniChar13>A

19. Create the Unicode expressions controlling the characters described above:

UniChar11 → IF(DigitVal1<=15,4,5) UniChar12 → IF(DigitVal2<=15,4,5) UniChar13 → IF(DigitVal3<=15,4,5) UniChar21 → IF(UniChar11=4,DigitVal1,DigitVal1-16) UniChar22 → IF(UniChar12=4,DigitVal2,DigitVal2-16) UniChar23 → IF(UniChar13=4,DigitVal3,DigitVal3-16) 20. Build the expressions which will control the height of the Unicode character for each group,

viAIPY1

IF((DigitVal1>=1&DigitVal1<=9)|(DigitVal1>=16&DigitVal1<=25),
MajusculeHeight,MinusculeHeight) viAIPY2

IF((DigitVal2>=1&DigitVal2<=9)|(DigitVal2>=16&DigitVal2<=25),
MajusculeHeight,MinusculeHeight) viAIPY3

IF((DigitVal3>=1&DigitVal3<=9)|(DigitVal3>=16&DigitVal3<=25),
MajusculeHeight,MinusculeHeight) viJZ1

IF((DigitVal1=10)|(DigitVal1=26),MajusculeHeight,MinusculeHeight) viJZ2

IF((DigitVal2=10)|(DigitVal2=26),MajusculeHeight,MinusculeHeight) viJZ3

IF((DigitVal3=10)|(DigitVal3=26),MajusculeHeight,MinusculeHeight) viK1 where K=11

IF(DigitVal1=11,MajusculeHeight,MinusculeHeight) viK2

IF(DigitVal2=11,MajusculeHeight,MinusculeHeight) viK3

IF(DigitVal3=11,MajusculeHeight,MinusculeHeight) viL1 where L=12 → IF(DigitVal1=12,MajusculeHeight,MinusculeHeight)
viL2 → IF(DigitVal2=12,MajusculeHeight,MinusculeHeight)
viL3 → IF(DigitVal3=12,MajusculeHeight,MinusculeHeight)

viM1 where M=13 → IF(DigitVal1=13,MajusculeHeight,MinusculeHeight)
viM2 → IF(DigitVal2=13,MajusculeHeight,MinusculeHeight)
viM3 → IF(DigitVal3=13,MajusculeHeight,MinusculeHeight)

viN1 where N=14 → IF(DigitVal1=14,MajusculeHeight,MinusculeHeight)
viN2 → IF(DigitVal2=14,MajusculeHeight,MinusculeHeight)
viN3 → IF(DigitVal3=14,MajusculeHeight,MinusculeHeight)

viO1 where O=15 → IF(DigitVal1=15,MajusculeHeight,MinusculeHeight)
viO2 → IF(DigitVal2=15,MajusculeHeight,MinusculeHeight)
viO3 → IF(DigitVal3=15,MajusculeHeight,MinusculeHeight)

21. Create a new label style and give it a meaningful name e.g. myUnicodeLetters,

22. Create the expressions for all digits of AIPY group:

Add a new text label for the first AIPY digit and name it AIPY1:

– Set Name = AIPY1
– Anchor Point = End
– Text Height = viAIPY1
– X Offset = OffsetChr1 – Set the contents of AIPY1 Add a new text element for the second AIPY digit and name it AIPY2:

– Set the Name = AIPY2
– Anchor Point = End
– Text Height = viAIPY2
– X Offset = OffsetChr2 – Set the contents of AIPY2 Add a new text label for the third AIPY digit and name it AIPY3:

– Set the Name = AIPY3
– Anchor Point = End
– Text Height = viAIPY3
– X Offset = OffsetChr3 – Set the contents of AIPY3 23. Create the expressions for all digits of JZ group:

Add a new text element for the first JZ digit and name it JZ1:

– Set the Name = JZ1
– Anchor Point = End
– Text Height = viJZ1
– X Offset = OffsetChr1 – Set the contents of JZ1 24. Analogously create the text elements for JZ2 and JZ3,

25. Create also the elements for other groups in the same way,

26. Select the sample lines and choose the created sample line style and click the Add button,

27. Next click the OK button and finally you will see the result.  This method can be used to describe a large but not too large amount of sample lines.

You should note that sometimes you will get some recognizable words like e.g. CAD, GIS, BOX, BUS, DOG,
END, FOX, ICE (and many more) in your sample line letter description. Analogously you can create your own sample line style for your national language.
You can also easily modify this method and add some extra descriptions if you need them.