Created
September 13, 2020 09:30
-
-
Save chuongmep/ab84414bc289b815f3845dc0934ca956 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Copyright(c) 2020, chuongho | |
# @chuongmep, https://chuongmep.com/ | |
import clr | |
clr.AddReference('ProtoGeometry') | |
from Autodesk.DesignScript.Geometry import * | |
clr.AddReference("RevitServices") | |
import RevitServices | |
from RevitServices.Persistence import DocumentManager | |
from RevitServices.Transactions import TransactionManager | |
clr.AddReference('RevitAPI') | |
from Autodesk.Revit.DB import * | |
clr.AddReference("RevitNodes") | |
import Revit ,Autodesk | |
clr.ImportExtensions(Revit.Elements) | |
clr.ImportExtensions(Revit.GeometryConversion) | |
doc = DocumentManager.Instance.CurrentDBDocument | |
TransactionManager.Instance.EnsureInTransaction(doc) | |
textnote = UnwrapElement(IN[0]) | |
bbox = textnote.get_BoundingBox(None) | |
if bbox==None: | |
View = doc.GetElement(textnote.OwnerViewId) | |
bb = textnote.get_BoundingBox(View).ToProtoType(True) | |
P1 = Autodesk.DesignScript.Geometry.Point.ByCoordinates(bb.MinPoint.X,bb.MinPoint.Y,0) | |
P2 = Autodesk.DesignScript.Geometry.Point.ByCoordinates(bb.MaxPoint.X,bb.MinPoint.Y,0) | |
P3 = Autodesk.DesignScript.Geometry.Point.ByCoordinates(bb.MaxPoint.X,bb.MaxPoint.Y,0) | |
P4 = Autodesk.DesignScript.Geometry.Point.ByCoordinates(bb.MinPoint.X,bb.MaxPoint.Y,0) | |
OUT = [bb],[P1,P2,P3,P4] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment