Hi, Seems like the GetEndPointReference method is producing the null object. Here is a test I did with python shell to verify. Doc is valid object, Line.CreateBound() method returns valid line, but line.GetEndPointReference(0) returns null object, Then system error gets thrown when I pass to doc.FamilyCreate.NewDimension(doc.ActiveView, line, references).
IronPython 2.7.4 (2.7.0.40) on .NET 4.0.30319.18063 (64-bit)
>>> import clr
>>> clr.AddReference('RevitAPI')
>>> clr.AddReference('RevitAPIUI')
>>> from Autodesk.Revit.DB import *
>>> app = __revit__.Application
>>> doc = __revit__.ActiveUIDocument.Document
>>> print doc
<Autodesk.Revit.DB.Document object at 0x000000000000002E [Autodesk.Revit.DB.Document]>
>>> print type(doc)
<type 'Document'>
>>> print doc.ActiveView
<Autodesk.Revit.DB.ViewSection object at 0x000000000000002F [Autodesk.Revit.DB.ViewSection]>
>>> print type(doc.ActiveView)
<type 'ViewSection'>
>>> t = Transaction(doc, 'test')
>>> t.Start()
Autodesk.Revit.DB.TransactionStatus.Started
>>> refPoint = doc.FamilyCreate.NewReferencePoint(XYZ(0,0,0))
>>> print refPoint
<Autodesk.Revit.DB.ReferencePoint object at 0x0000000000000031 [Autodesk.Revit.DB.ReferencePoint]>
>>> line = Line.CreateBound(XYZ(0,0,0), XYZ(0,0,10))
>>> print line
<Autodesk.Revit.DB.Line object at 0x0000000000000032 [Autodesk.Revit.DB.Line]>
>>> print line.GetEndPointReference(0)
None
>>> print line.GetEndPointReference(1)
None
>>> print type(line)
<type 'Line'>
>>> dim = doc.FamilyCreate.NewDimension(doc.ActiveView, line, references)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'references' is not defined
>>> references = ReferenceArray()
>>> references.Append(line.GetEndPointReference(0))
>>> references.Append(line.GetEndPointReference(1))
>>> print references
<Autodesk.Revit.DB.ReferenceArray object at 0x0000000000000030 [Autodesk.Revit.DB.ReferenceArray]>
>>> dim = doc.FamilyCreate.NewDimension(doc.ActiveView, line, references)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: Object reference not set to an instance of an object.
Here is the full error message:
System.NullReferenceException: Object reference not set to an instance of an object. at Autodesk.Revit.Creation.ItemFactoryBase.NewDimension(View view, Line line, ReferenceArray references) at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run6[T0,T1,T2,T3,T4,T5,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) at System.Dynamic.UpdateDelegates.UpdateAndExecute5[T0,T1,T2,T3,T4,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) at Microsoft.Scripting.Interpreter.DynamicInstruction`6.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope sc...