import sys
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
clr.AddReference(“RevitNodes”)
import Revit
from Revit.Elements import *
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
#general
INPUT = UnwrapElement(IN[0])
#1: get midpoints from DetailCurve (RevitAPI)
MIDPOINT_RVT_API =
for i in INPUT:
point_RVT = i.GeometryCurve.Evaluate(0.5, False)
MIDPOINT_RVT_API.append(point_RVT)
#2: get RevitPoints from RevitAPI Points
MIDPOINT_RVT =
for y in MIDPOINT_RVT_API:
point = y.ToPoint()
MIDPOINT_RVT.append(point)
#3: Translate
POINT_TL =
for z in MIDPOINT_RVT:
#P1 = Point.ByCoordinates(z.X - 800, z.Y + 800, z.Z)
#P2 = Point.ByCoordinates(z.X + 800, z.Y + 800, z.Z)
#P3 = Point.ByCoordinates(z.X + 800, z.Y - 800, z.Z)
#P4 = Point.ByCoordinates(z.X - 800, z.Y - 800, z.Z)
#P1 = Point.ByCoordinates(z.X - 800, z.Y + 800, z.Z)
#P2 = Point.ByCoordinates(z.X + 800, z.Y + 800, z.Z)
#P3 = Point.ByCoordinates(z.X + 800, z.Y - 800, z.Z)
#P4 = Point.ByCoordinates(z.X - 800, z.Y - 800, z.Z)
P1 = z.Translate(-800, 800, 0)
P2 = z.Translate(800, 800, 0)
P3 = z.Translate(800, -800, 0)
P4 = z.Translate(-800, -800, 0)
RECTANGLE = Rectangle.ByCornerPoints(P1, P2, P3, P4)
POINT_TL.append(P1)
OUT = POINT_TL
I get a AttributeError: about the Rectangle.ByCornerPoints.
How to fix it?