Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#Copyright(c) 2021, Hồ Văn Chương
# @chuongmep, https://chuongmep.com/
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
import System
from System.Collections.Generic import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
doc = DocumentManager.Instance.CurrentDBDocument
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
elements = UnwrapElement(IN[0]) if isinstance(IN[0],list) else [UnwrapElement(IN[0])]
ref=[]
for element in elements:
if isinstance (element, Autodesk.Revit.DB.Dimension):
ref.append(element.References)
elif isinstance (element, Autodesk.Revit.DB.ReferencePlane):
ref.append(element.GetReference())
else : ref.append(Reference(element))
arc = IN[1]
cen = IN[2]
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
dim = doc.FamilyCreate.NewRadialDimension(doc.ActiveView,ref[0],cen[0])
TransactionManager.Instance.TransactionTaskDone()
OUT = dim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment