Hi @yahya_kilic
To get the diagonal vector, you have to cross the Dimension line Vector with Z Basis. Then Multiply the distance for translation with diagonal vector. Kindly refer the below code for additional reference.
Reference Code:
//01.Get Curve from Dimension
Line line = dim.Curve.Clone() as Line;
//02. Get Unit Vector
XYZ unitVector = line.Direction.Normalize();
//03. Diagonal Vector
XYZ diagonalVec = unitVector.CrossProduct(XYZ.BasisZ);
//04. Movement Vector
//Note: For Reverse Negatate the Value
XYZ translationVec= diagonalVec.Multiply(300 / 304.8);
using (Transaction translateDim = new Transaction(doc, "Move Dim"))
{
translateDim.Start();
ElementTransformUtils.MoveElement(doc, dim.Id, translationVec);
translateDim.Commit();
}
For Additional Help regarding Mathematical Concept, Kindly check the below URL
https://www.mathsisfun.com/algebra/vectors-cross-product.html#:~:text=The%20Cross%20Product%20a%20%C...
Hope this Helps 🙂
Mohamed Arshad K
Software Developer (CAD & BIM)