The angle of a 3D vector is the angle from the vector directly to each of the 3 positive axes. The angles are named alpha (x-axis), beta(y-axis) and gamma(z-axis). They are always positive and between 0 and 180 inclusive. They are called direction angles.
The arrowhead is inserted at rotation angle 0 at the endpoint of the vector then rotated. 2D rotation rotates around a point that is actually an axis normal (perpendicular) to the current UCS. The easiest way to rotate the arrowhead into position is to make a UCS that includes the plane of the alpha (or beta or gamma) angle between the vector and the axis. if the vector does not have a startpoint at the origin, a line parallel to the axis at the startpoint of the vector is used. after the ucs is made, the arrowhead is inserted and rotated by the alpha angle. the same procedure works for the other axes and direction angles.
how can the arrowhead be moved into position with only one rotation? If the vector is located by two angles, the third angle can be calculated. Imagine standing up a vector and dimensioning two angles, the other angle is fixed. the first rotation is the rotation of the ucs, the second angle is the alpha and final rotation needed.
The VBA UCS method uses 3 points, a new origin, a point on the postive new x-axis and a point on the positive new y-axis. Its very easy to work with but it required 3 points that form a right angle. Draw a line from the end of the vector perpendicular to the axis. that is the projection of the vector on the axis and the new origin point on the axis. another point any distance in the direction of the positive axis is the second point. The new y-axis point is the endpoint of the vector.
'3D Vectors set_wcs Set blockrefObj = acadDoc.ModelSpace.InsertBlock(endpt2, blkname, 0.375, 0.375, 0.375, 0) Call set_ucs(px2, py1, pz1, _ px2 + 1, py1, pz1, _ px2, py2, pz2, _ "UCS_alpha") blockrefObj.Rotate endpt2, alpha 'these are just for reference Call set_ucs(px1, py2, pz1, _ px1, py2 + 1, pz1, _ px2, py2, pz2, _ "UCS_beta") Call set_ucs(px1, py1, pz2, _ px1, py1, pz2 + 1, _ px2, py2, pz2, _ "UCS_gamma") set_wcs acadApp.Update Sub set_ucs(x1 As Double, y1 As Double, z1 As Double, _ x2 As Double, y2 As Double, z2 As Double, _ x3 As Double, y3 As Double, z3 As Double, strname As String) 'pt1 is origin, pt2 is xaxis, pt3 is yaxis Dim ucsObj As AcadUCS Dim originPt(0 To 2) As Double Dim xAxisPt(0 To 2) As Double Dim yAxisPt(0 To 2) As Double originPt(0) = x1: originPt(1) = y1: originPt(2) = z1 xAxisPt(0) = x2: xAxisPt(1) = y2: xAxisPt(2) = z2 yAxisPt(0) = x3: yAxisPt(1) = y3: yAxisPt(2) = z3 Set ucsObj = acadDoc.UserCoordinateSystems.Add(originPt, xAxisPt, yAxisPt, strname) acadDoc.ActiveUCS = ucsObj End Sub