Hi,
I’m struggling to understand how points are transformed between elevation views and the world coordinate system.
I’m using this to amend the CropBox of an elevation view, the XYZ points of the lower left and upper right of the crop box are returned in the views local coordinate system, I then need to convert to the world coordinate system.
This part is easy:
This code looks for an elevation called ‘TEST’ and then obtains its CropBox XYZs:
allViews = FilteredElementCollector(doc).OfClass(View).ToElements()
viewtopick = "TEST"
for f in allViews:
if f.Name == "TEST":
viewtouse = f
#Get View cropbox
viewcropbox = viewtouse.CropBox
#Set View cropbox minimum value
mincb = viewcropbox.Min
maxcb = viewcropbox.Max
minpos = viewcropbox.Transform.OfPoint(mincb)
maxpos = viewcropbox.Transform.OfPoint(maxcb)
The Cropbox.Transform.OfPoint() method converts the local coords to the world coords - nice and easy.
But in order to amend the view I need to calculate some points going the other way around - i.e. from World coordinate system to view local coordinates.
I can’t find a method of using .Transform backwards.
Thanks.