Angular dimension node/code

Hi, I am looking for a node (or code) that can create an angular dimension between two lines. Does such a node exist? (in any of the custom packages maybe?)

I don’t think there is any node till now for angular dimension. But you could look into Revit API Docs http://www.revitapidocs.com/2017/2e3b9201-d5fa-3cdb-53e4-8e204bda1fe5.htm

AngularDimension.ByElements.dyf (23.5 KB)

I found this one in clockwork package. though I couldn’t use it cause I cant find the input “dimension type”
if you could get it worked then please help me too.

I tried this one. it does work but only in floor plan views, not in elevation views

A bit janky but will do

import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

import System
from System.Collections.Generic import *
from System import Array

clr.AddReference('ProtoGeometry')
clr.AddReference('DSCoreNodes') 
import DSCore
from DSCore import *
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
from Revit.Elements import *
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.GeometryReferences)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

fec = FilteredElementCollector(doc).OfClass(View)
fec2 = FilteredElementCollector(doc).OfClass(Autodesk.Revit.DB.DimensionType)

elements = IN[0]
radius = IN[1]
d3 = []
dt = []

for i in fec:
	if "{3D}" in i.Name:
		d3.append(i)

for i in fec2:
	if "Angular" in i.FamilyName:
		dt.append(i)

def thereWillBeArc(e):
	lines = [UnwrapElement(i).GeometryCurve.ToProtoType() for i in e]
	normal = lines[0].NormalAtParameter(0.5)
	tangent = lines[1].TangentAtParameter(0.5)
	tangentI = tangent.Reverse()
	points = [i.PointAtParameter(0) for i in lines]
	points2 = [i.PointAtParameter(1) for i in lines]
	plane = Plane.ByOriginNormal(points[0], normal)
	cPoint1 = points[1].Project(plane,tangent)
	cPoint2 = points[1].Project(plane,tangentI)
	if len(cPoint1) == 0:
		cp = cPoint2
	else:
		cp = cPoint1
	v1 = Vector.ByTwoPoints(points[0],points2[0])
	v2 = Vector.ByTwoPoints(points[1],points2[1])
	a1 = Vector.AngleAboutAxis(v1,Vector.XAxis(),Vector.ZAxis())
	a2 = Vector.AngleAboutAxis(v2,Vector.XAxis(),Vector.ZAxis())
	return Arc.ByCenterPointRadiusAngle(cp[0],radius,a1,a2,Vector.ZAxis())

ar = thereWillBeArc(elements).ToRevitType()
lines = [UnwrapElement(i).GeometryCurve for i in elements]
ref = [lines[0].Reference, lines[1].Reference]
refs = Array[Reference](ref)

TransactionManager.Instance.EnsureInTransaction(doc)

OUT = AngularDimension.Create(doc, doc.ActiveView, ar, refs, dt[0])

TransactionManager.Instance.TransactionTaskDone()

To make it work in vertical sections, you’ll need to feed appropriate vectors for the arc.

1 Like