XDSoft 发表于 2014-12-10 19:25:31

ARX - Ordinate Dimension Text 在旋转UCS下不正确的解决方案

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 ofDXF 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:

**** Hidden Message *****

llq_78 发表于 2015-5-10 14:55:33

Ordinate Dimension Text 在旋转UCS下不正确的解决方案

sdlsxygh 发表于 2015-6-10 10:21:50

看不懂英语啊

buleant 发表于 2017-11-22 11:41:51

旋转UCS下不正确的解决方案 ,{:1_1:}{:1_1:}

xinxirong 发表于 2017-11-22 12:53:41

块属性把块自身遮住,是哪个变量控制的?

liyupitt 发表于 2017-11-23 08:37:24

正好遇到了UCS问题,谢谢楼主。

han.neng 发表于 2021-9-18 23:18:19

正好遇到了UCS问题,谢谢楼主。

li-fei-1979 发表于 2021-10-25 22:54:59

正好遇到了UCS问题,谢谢楼主

tigcat 发表于 2022-5-12 08:40:39

是不是要利用坐标变换呢?

cable2004 发表于 2024-2-26 10:30:16

Ordinate Dimension Text 在旋转UCS下不正确的解决方案

zeqi1991 发表于 2024-2-27 13:57:12

正好遇到了UCS问题,谢谢楼主。

lhg 发表于 2024-3-3 22:31:44

谢谢楼主。
页: [1]
查看完整版本: ARX - Ordinate Dimension Text 在旋转UCS下不正确的解决方案