- UID
- 1
- 积分
- 15846
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-3
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
ARX - Ordinate Dimension Text incorrect in rotated UCS
Issue
I have a function which creates ordinate dimensions. When the UCS is rotated around the Z Axis the value for the text is incorrect and appears to be the value of the X or Y value this point would have in WCS.
Solution
The solution to this behavior is to invoke AcDbDimension::setHorizontalRotation() . The value of DXF group code 51 is queried via AcDbDimension::horizontalRotation(), and is what is established by the angle of the UCS X axis at the time of acquisition. The X/Y ordinate flag on AcDbOrdinateDimension is set to indicate whether the text is aligned with, or perpendicular to, the horizontal rotation (the UCS X axis in effect) or the vertical direction (the UCS Y axis in effect).
When you rotate around the WCS Z axis to get your UCS, the underlying OCS is exactly the WCS. The value stored is the negative of the horizontal rotation angle in the OCS. Invoking “AcDbEntity::transformBy” on a dimension intentionally does not alter this setting, although it moves all the dimensioned points, extension line and text position points.
So, to reorient the text, get the angle between your UCS x axis and the OCS X axis (which is 1,0,0 when the UCS Z axis is parallel to the WCS Z axis; or else you use the arbitrary axis algorithm to arrive at your OCS X axis, given the UCS Z axis or object normal vector), and pass the negative of this angle to setHorizontalRotation() and your text will be oriented in the direction of that UCS X or Y axis, depending on the setting of the X/Y ordinate flag.
Here is an Example that creates an Ordinate dimension correctly regardless of the UCS rotation:
|
|