GetEndPoints of a curve Method

Hi All,

I was wondering if anybody knew - the GetEndPoint method for the curve class gets the coordinate value based on which point (the survey point or the internal origin)
Appreciate all inputs here :slight_smile:

Hi @adikshit ,

I don’t think there is a direct method to get the world-coordinates of a point, since everything within the Revit project is translated according to the Project Base Point.

You could however extract the xyz-values from your points and the xyz-values of your Project Base Point. Then add them together to get the world-coordinates of those points.

Hello @adikshit and welcome
the GetEndPoint method return point from internal origin coordinate

here an example to return point from different system coordinates

import clr
import sys
import System
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

class OriginEnum:
	Internal = 1
	Survey = 2
	BaseProject = 3

def get_end_point(curve, index, originEnum):
	originEnum -> OriginEnum.Internal OR OriginEnum.Survey OR OriginEnum.BaseProject
	pt = curve.GetEndPoint(index)
	if originEnum ==  OriginEnum.Survey:
		translatedpointA = doc.ActiveProjectLocation.GetTotalTransform().Inverse.OfPoint(pt)
		return translatedpointA
	elif originEnum ==  OriginEnum.BaseProject:
		projectPoint = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_ProjectBasePoint).FirstElement()
		projectXyz = projectPoint.get_BoundingBox(None).Min
		return pt.Subtract(projectXyz)
		return pt

toList = lambda x : x if hasattr(x, '__iter__') else [x]
#Preparing input from dynamo to revit
lstCurves = toList(UnwrapElement(IN[0]))

pts_survey = [get_end_point(c.Location.Curve, 1, OriginEnum.Survey) for c in lstCurves]
pts_Project = [get_end_point(c.Location.Curve, 1, OriginEnum.BaseProject) for c in lstCurves]

OUT = pts_survey, pts_Project

haha - you solved it all for me :slight_smile: Thanks Cyril

1 Like