Dear Specialists,
I have an rotated scope box, see picture below.
I would like to receive the corner points of the scope box.
But the transform failed in my script. Could anyone help me?
My knowledge about the RevitAPI methodes/attributes in scope boxes/boundingboxes/transform is low. So extra explanation is helpfull!
Thanks in advance!!
import clr
# Add references to the Revit, Revit Services and TransactionManager
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
from datetime import datetime
#receive Revit Document
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
#get
scope_box = UnwrapElement([IN[0]])
elem_ref = UnwrapElement([IN[1]])
#receive orientation object
elem_loc = [a.Location.Curve for a in elem_ref]
begin = [a.GetEndPoint(0) for a in elem_loc]
end = [a.GetEndPoint(1) for a in elem_loc]
points = []
for a in range(len(scope_box)):
bbox = scope_box[a].get_BoundingBox(None)
transform = bbox.get_Transform()
min_pt = bbox.Min
max_pt = bbox.Max
corner1 = XYZ(min_pt.X, min_pt.Y, min_pt.Z)
corner2 = XYZ(max_pt.X, min_pt.Y, min_pt.Z)
corner3 = XYZ(max_pt.X, max_pt.Y, min_pt.Z)
corner4 = XYZ(min_pt.X, max_pt.Y, min_pt.Z)
corner1_transformed = transform.OfPoint(corner1).ToPoint()
corner2_transformed = transform.OfPoint(corner2).ToPoint()
corner3_transformed = transform.OfPoint(corner3).ToPoint()
corner4_transformed = transform.OfPoint(corner4).ToPoint()
points.append([corner1_transformed, corner2_transformed, corner3_transformed, corner4_transformed])
TransactionManager.Instance.TransactionTaskDone()
OUT = points