I'm trying to programmatically rotate the purple block in AutoCAD shown here by 90 degrees so that it lines up with the orange block.
The purple block's base point is the lower left hand corner. Using AutoCAD's built in rotate function gives me the result that I want shown here:
But when I try to rotate it programmatically with this function
public static BlockReference RotateBlockWithAttributes(ObjectId passedIdOfBlockToRotate)
{
Transaction tr = _database.TransactionManager.StartTransaction();
DocumentLock docLock = _activeDocument.LockDocument();
using (tr)
using (docLock)
{
BlockReference blockToRotate = tr.GetObject(passedIdOfBlockToRotate, OpenMode.ForWrite) as BlockReference;
blockToRotate.TransformBy(Matrix3d.Rotation(Math.PI / 2, blockToRotate.Normal, blockToRotate.Position));
tr.Commit();
return blockToRotate;
}
}
I get this result
And have no idea why...