Exception by drawing a line

Forums: 

I'm trying to draw a line with AssociativeLineBuilder. As input data I use user selected objects, for example point and surface.

Just for a moment I even can see an expected line, but it disappears immediately and I recieve and exception: "a deleted or invalid class id was used" for line where Commit() method is used.

The code is very similar to recorded journal on C++, but does not work for some reason. Really appreciate if someone can help me.

import NXOpen

theSession = NXOpen.Session.GetSession()
theUI = NXOpen.UI.GetUI()

def main():
workPart = theSession.Parts.Work

# asking user to select an existing point
selection_tuple = theUI.SelectionManager.SelectObject("Please, select a point",
"Select point",
NXOpen.SelectionSelectionScope.AnyInAssmbly,
False,
False)
selected_obj = selection_tuple[1]
if type(selected_obj) is NXOpen.Point:
start_point = selected_obj

# asking user to select a surface
selection_tuple = theUI.SelectionManager.SelectObject("Please, select a surface",
"Select surface",
NXOpen.SelectionSelectionScope.AnyInAssebly,
False,
False)
selected_obj = selection_tuple[1]
if selected_obj.IsSheetBody:
face = selected_obj.GetFaces()[0]

# creating a line starting from selected point, normal to selected face, with length 10 mm
line_bld = workPart.BaseFeatures.CreateAssociativeLineBuilder(NXOpen.Features.AssociativeLine.Null)

line_bld.StartPointOptions = NXOpen.Features.AssociativeLineBuilderStartOption.Point
line_bld.StartPoint.Value = start_point

line_bld.EndPointOptions = NXOpen.Features.AssociativeLineBuilderEndOpion.Normal
line_bld.EndNormal.Value = face

line_bld.Limits.StartLimit.LimitOption = NXOpen.GeometricUtilities.CurveExtendDataLimitOptions.AtPoint
line_bld.Limits.EndLimit.LimitOption = NXOpen.GeometricUtilities.CurveExtendDataLimitOptions.Value
line_bld.Limits.EndLimit.Distance.Value = 10.0

if line_bld.Validate():
created_line_obj = line_bld.Commit()
line_bld.Destroy()

if __name__ == "__main__":
main()

For some reason, now the code above works fine as expected.
Nothing changed. Even NX was not restarted..

I blame the cosmic rays.