public void RotateInPlace() { UIDocument uidoc = this.ActiveUIDocument; Document doc = uidoc.Document; ICollection selectedElementsId = uidoc.Selection.GetElementIds(); using (Transaction t = new Transaction(doc, "Rotate")){ t.Start(); foreach (ElementId eid in selectedElementsId) { TextElement e = doc.GetElement(eid) as TextElement; //XYZ center = e.get_BoundingBox(doc.ActiveView).Max - e.get_BoundingBox(doc.ActiveView).Min; XYZ baseVector = e.BaseDirection; XYZ upVector = e.UpDirection; XYZ center = e.Coord + new XYZ(0,0,e.Width*100/2) - upVector.Normalize()*e.Height*100/2; //100 is the view scale XYZ sec = center + 3 * upVector.Normalize(); //doc.Create.NewDetailCurve(doc.ActiveView, Line.CreateBound(center,sec)); XYZ normalVector = baseVector.CrossProduct(upVector); Line axis = Line.CreateUnbound(center, normalVector); ElementTransformUtils.RotateElement(doc, eid, axis, Math.PI); } t.Commit(); } }