March 06, 2025

ACA: Formula Property to Abbreviate Room Name

A question came up in the Autodesk AutoCAD® Architecture forum regarding the creation of a custom Space Tag to display an abbreviated room name. I indicated that was possible, if a property was added to hold the abbreviated room name. I provided an example file and explained how I created the tag. I assumed that the user would determine the abbreviated name and type it in for each Space.

Another user jumped in and indicated an expectation that I would have provided a formula property to automatically generate the abbreviation. While the example provided by the original poster was for a two-word room name where the abbreviated version was the first letter of each word, I had not taken that to always be the case. But I found the idea interesting enough to take some time to come up with a formula that would do that, in case that was the intent of the original poster or would be of interest to others. Here is the formula I devised:
rmName = "[Name]"
rmAbbr = ""
rmName = Trim( rmName ) + " "

Do
	rmName = LTrim( rmName )
	rmAbbr = rmAbbr + Left( rmName, 1 )
	rmName = Right( rmName, Len( rmName ) - InStr( rmName, " " ))
Loop Until InStr( rmName, " ") = 0

RESULT = rmAbbr

In the first line, [Name] needs to be a properly created property reference inserted from the Insert Property Definitions area in the lower left of the Formula Property Definition dialog. In the example file I included in the forum thread, it references the SpaceObjects:Name automatic property of Spaces, but it could reference any property you are using to hold the room name.

The second line initializes the variable, rmAbbr, in which the abbreviated name will be stored as an empty string.

The third line removes any Space characters from the beginning or end of room name, and then adds a single Space character to the end, so that the last "word" in the room name is processed by the Do loop.

The Do loop processes the value in rmName until there are no Space characters left. It removes any leading Space characters with the LTrim function, in case the room name string has two or more consecutive Space characters within it. It then adds the first character in rmName to the end of the rmAbbr string. Finally, it looks for the next Space character in rmName and removes all of the characters to the left of that Space character, including the Space character.

After the last "word" is processed, rmName will contain an empty string, the Loop Until test will not find a Space character (so the InStr function will return 0), and the Lopp will be exited.

Finally, the abbreviated name value is returned as the result of the formula.
Here is a screen shot from a file in which three Spaces have been tagged twice - once with the out-of-the-box tag showing the Name automatic property for the room name and once with a custom tag showing the abbreviated name created by the AbbrName formula property.
If the formula provides the desired abbreviation a majority of the time, but there are occasions where you would like to be able to manually enter something else, you could include this formula to generate the default abbreviation, set up a text-type manual property to hold an override value, and create an additional formula property that passes through the default abbreviation unless an override value has been entered in the manual property. That last formula property would be the one to reference in a Schedule Tag. You can find a more detailed description of setting up a property override in this blog article. Please note that the link to a forum post with a sample file in that article is no longer working, as Autodesk has removed posts that are more than 10 years old.