GetEndPointReference of Edge from SymbolGeomery

Hello guys,

I would like to create automatic dimensions from visible parts of the railing. I can get the edges of element and their curves but it gives me null value as reference when I use curve.GetEndPointReference(0).
Why is it like that? I have to draw detail lines and get their references to create dimensions. In UI I can snap same points on element but why does not it work over API?

Le code:

# Phython-Standard- und DesignScript-Bibliotheken laden
import sys
import clr
clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry as dscore
clr.AddReference("RevitAPI","RevitServices")
from Autodesk.Revit.DB import *
import System
clr.AddReference("System.Core")
clr.ImportExtensions(System.Linq)
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager 
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

doc = DocumentManager.Instance.CurrentDBDocument

ansichten, elemente  = UnwrapElement(IN)

opt  = Options()
opt.ComputeReferences = True
opt.IncludeNonVisibleObjects = False
output=[]
TransactionManager.Instance.EnsureInTransaction(doc)
for ansicht, element in zip(ansichten, elemente):
	temp =[]
	opt.View = ansicht
	geom = element.get_Geometry(opt)
	for geomObj in geom:
		instTransform = geomObj.Transform
		symbolGeometrie = geomObj.GetSymbolGeometry()
		for instObj in symbolGeometrie:
			solid = instObj
			if solid ==None or solid.Faces.Size==0 or solid.Edges.Size==0:
				continue
			for edge in solid.Edges:
				curve = edge.AsCurve()
				if isinstance(curve,Arc):
					if curve.Radius>20:
						startPoint = curve.GetEndPoint(0)
						endPoint = curve.GetEndPoint(1)
						startPoint = curve.GetEndPoint(0)
						endPoint = curve.GetEndPoint(1)
						transStart = instTransform.OfPoint(startPoint)
						transEnd = instTransform.OfPoint(endPoint)
						if transStart.Y<transEnd.Y:
							line = Line.CreateBound(transStart,transEnd)
						else: line = Line.CreateBound(transEnd,transStart)
						temp.append(line.ToProtoType())						
					else: pass
				else:
					startPoint = curve.GetEndPoint(0)
					endPoint = curve.GetEndPoint(1)
					transStart = instTransform.OfPoint(startPoint)
					transEnd = instTransform.OfPoint(endPoint)
					if transStart.Y<transEnd.Y:
						line = Line.CreateBound(transStart,transEnd)
					else: line = Line.CreateBound(transEnd,transStart)
					temp.append(line.ToProtoType())
	output.append(temp)


OUT = output

I also read here but it did not help.

Found the problem. I should use edge.GetEndPointReference.

2 Likes

What does the list output give of an edgepointreference in dynamo out of curiosity? trying to get it for door edges but struggling.