This project has moved and is read-only. For the latest updates, please go here.

Dimension UserText below dim line with "\X" ?

Jul 17, 2016 at 1:15 AM
Edited Jul 17, 2016 at 1:18 AM
In AutoCAD, adding the code "\X" (no quote marks) into a dimensions text will force the string beyond the "\X" code to appear below the dimension line. If I add this to the .UserText property for a linear dimension, the actual text characters "\X" just appear in the dimensions text string instead of the string beyond the "\X" code being shifted below the dim line. Other codes like "%%D" are properly recognized in the same text string, but not "\X".

Can anyone think of a way to get the "\X" code to be recognized upon opening the DXF file?
Jul 17, 2016 at 4:13 PM
Edited Jul 17, 2016 at 4:17 PM
To properly write the a backslash character "\" in a string literal you need to use the escape sequence "\\" or use a verbatim string.

This two examples should lead to the same result:

I have not tested but it should work.

Jul 22, 2016 at 1:26 AM
Thanks for the reply. Good suggestion. Unfortunately, I've tried every combination of escape sequences without any luck.

I did notice that a simple string like "I am a /XTest" will initially show as a single line with the "/X" string included.

But, if I double click and open the dimensions text in AutoCAD, the word "Test" is immediately moved below the dimension line. It seems that the string is correct with or without an escape sequence, but AutoCAD isn't recognizing the "\X" code when the dxf file is opened. After it is opened and the dimension is edited, the character code is recognized.
Aug 9, 2016 at 10:14 AM
Update to the last 2.0.1 netDxf version and take a look at the sample "DimensionUserTextWithTwoLines();" in the TestDxfDocument project source code. I have implemented this behavior. It was not some kind of code that is passed to the MText content but it affects how the block that represent the dimension is actually built.

Aug 19, 2016 at 5:27 PM
Thanks for the work on this Daniel. I'll give this a shot soon. Been distracted lately with a few other things. This is a really fantastic library you've put together.