Here is an example of the confusion I'm having.
Run this sub then run the 3dorbit command.
The aim is to find the center of the 3dorbit,
It works great for a while.
Run it again and it's no good.
Sub OrbitCenter()
Dim C, T, O, P As AcadPoint
Dim Util As AcadUtility
Set Util = ThisDrawing.Utility
ThisDrawing.SetVariable "PDSIZE", 0.5
ThisDrawing.SetVariable "PDMODE", 35
C = ThisDrawing.GetVariable("viewctr")
C = Util.TranslateCoordinates(C, acUCS, acWorld, 0)
T = ThisDrawing.GetVariable("target")
T = Util.TranslateCoordinates(T, acUCS, acWorld, 0)
Set P = ThisDrawing.ModelSpace.AddPoint(C)
P.color = acGreen
Set P = ThisDrawing.ModelSpace.AddPoint(T)
Dim dMid(2) As Double
dMid(0) = (C(0) + T(0)) / 2
dMid(1) = (C(1) + T(1)) / 2
dMid(2) = (C(2) + T(2)) / 2
Set P = ThisDrawing.ModelSpace.AddPoint(dMid)
P.color = acYellow
ThisDrawing.ModelSpace.AddLine C, T
End Sub
In a new drawing the target getvar is 0,0,0
type camera and
Command: ca CAMERA Specify new camera position <6.0000,4.8571,18.3799>:
Specify new camera target <6.0000,4.8571,0.0000>: Regenerating model.
Since I'm in an inch dwg the x and y values are the center of the limits (12,9) (I presume the actual number varies with resolution).
A new target value seems to start with the old z value and take the screen center x and y.
But where does the 18.3799 come from?