cart: empty [ Login ]

Text on rotated linear dimension

1 
Spring Air
7/12/2023 8:50 PM
Is there any way to reset the text rotation back to 0 on a rotated linear dimension? For example, if I've rotated a horizontal dimension 180 degrees, I'd like the text to not be upside down. This doesn't seem to work:
C# Code:
var rotation = dim.TextRotation; dim.TransformMe(new TransformConfig(), matrix0); dim.TextRotation = rotation; if (dim.TextRotation == 0) dim.TextRotation = Math.PI * 2; //Hack to force vertical dimensions to have horizontal text dim.GenerateBlock();
Wout
7/14/2023 2:09 PM
I'd keep the dimension rotation at 0, it's basically not rotated. You can put the dimension line below the extension line points. - Wout
Spring Air
7/17/2023 3:48 PM
If you mean this:
C# Code:
dim.TransformMe(new TransformConfig(), matrix0); dim.TextRotation = 0; dim.GenerateBlock();
That doesn't fix the issue. The text is still rotated. I'd prefer to avoid changing the dimension line if possible, since I'm trying to get this operation to work on any arbitrary dimension entity.
Wout
7/17/2023 7:43 PM
I had a closer look at how TextRotation is supposed to affect the text for linear dimensions. It appears that it is relative to the linear dimension Rotation. I've just changed the GenerateBlock() implementation to take this in account. Before it just used the TextRotation as is when non-zero, but it should be TextRotation + Rotation. Therefore, ideally when rotating the linear dimension, the TransformMe method should only affect the DxfDimension.Linear.Rotation property, and it should leave the TextRotation property as is. CadLib didn't do this though, it rotated both. So I've just changed it to only change the Rotation property. So, after you transform the linear dimension, the text will indeed be rotated, and might end up upside down. You can check the value of TextRotation + Rotation, and if it's upside down, you just add PI to the TextRotation. Please download the latest CadLib 4.0 version. - Wout
Spring Air
7/26/2023 4:44 PM
When I insert a dimension cloned from another file - This correctly rotates the text 90 degrees:
C# Code:
dim.TextRotation = Math.PI / 2;
As does this:
C# Code:
if (dim.TextRotation == 0) dim.TextRotation = 0; dim.TextRotation += Math.PI / 2;
Whereas this causes rendering to act as though the rotation is 360 degrees:
C# Code:
dim.TextRotation += Math.PI / 2; //dim.TextRotation = 0
Not sure what's going on there, since if it were a floating point error, it would still be around 90 degrees.
C# Code:
Wout
7/27/2023 1:32 PM
Hi, My earlier analysis and fix of the problem was incorrect. The TextRotation is relative to the HorizontalDirection instead of the DxfDimension.Linear.Rotation. Because TransformMe transforms both, it could have been either of these 2 properties that offset the text rotation, and in my previous analysis I overlooked the HorizontalDirection as it's rarely used. Furthermore you problably don't want the HorizontalDirection to be affected by TransformMe() in your scenario. So I've added 2 properties to TransformConfig that allow you to customize the DxfDimension.TramsformMe() behavior a little: properties TransformDimensionHorizontalDirection and TransformDimensionTextRotation. The default values for both are true, so the behavior is identical to older CadLib versions by default. In your case you probably want to at least set property TransformConfig.TransformDimensionHorizontalDirection to false. Please download the latest CadLib 4.0 version to try. - Wout
RC Dev
9/11/2023 2:19 PM
Hi Wout, Sorry for hijacking the thread. Currently we are also having a similar problem with the rotation angle of the dimension line texts after rotating them with TransformMe-method. We use WW6 and wanted to know if it is the same problem there. Tested with versions 6.0.39.66 and 6.0.2023.5221. Thanks and regards.
Wout
9/11/2023 6:13 PM
Hi, I've just built a new 6.0 version, can you try it? - Wout
RC Dev
9/12/2023 8:09 AM
Hello That does the trick, thanks a lot. Thanks and regards.
1