Quantcast
Channel: MicroStation Programming - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1677

Re: [V8-VBA] Cell rotation about XYZ axes

$
0
0

Rotation Matrix

Object rotation in 3D is governed by a rotation matrix.  This is a common mathematical concept widely used in 3D geometry.  When dealing with rotation, prefer rotation matrices to angles.  Angular rotation about three axes is hard to work with in 3D.  You can find out why elsewhere.

VBA Matrix3D

MicroStation VBA provides the Matrix3duser defined type (UDT) and methods that operate on those data.

Each DGN element that can be rotated has a rotation matrix that you can read and modify.  Elements that have intrinsic rotation include, for example, text elements and cell elements.

In general, what you want to do is apply the inverse rotation matrix to your elements.  The API lets you do that easily...

Sub UnrotateText (ByRef oText As TextElement)
  Dim rotation As Matrix3D

  rotation = oText .Rotation
  Dim inverseRotation As Matrix3D
  inverseRotation = Matrix3dInverse (rotation)
  oText.Rotation = inverseRotation
  oText.Rewrite
End Sub

As Sivag pointed out, CellElement.Rotation is a read-only property, so we have to use a more protracted way to rotate a cell.  See his response to apply rotation to a CellElement.



Viewing all articles
Browse latest Browse all 1677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>