create a end point

Good evening
I am a beginner NXopen
Please tell me how to create a point at the end of the edge that is selected in the SelectAnObject

scalar1 = workPart.Scalars.CreateScalar(###
### = 0-1 of value
How do you determine the value of ###?

Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main()

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim theUI As UI = UI.GetUI
Dim mySelectedObject As NXObject
Dim cursor As Point3d
Dim typeArray() As Selection.SelectionType = {Selection.SelectionType.Edges}

Dim resp As Selection.Response = theUI.SelectionManager.SelectObject( _
"Select a solid edge", "Select Edge", Selection.SelectionScope.workpart, _
False, typeArray, mySelectedObject, cursor)

Dim scalar1 As Scalar
scalar1 = workPart.Scalars.CreateScalar(###, Scalar.DimensionalityType.None, _
SmartObject.UpdateOption.WithinModeling)

Dim point1 As Point = workPart.Points.CreatePoint(mySelectedObject, scalar1, _
SmartObject.UpdateOption.WithinModeling)

Dim nullFeatures_Feature As Features.Feature = Nothing
Dim pointFeatureBuilder1 As Features.PointFeatureBuilder
pointFeatureBuilder1 = _
workPart.BaseFeatures.CreatePointFeatureBuilder(nullFeatures_Feature)
pointFeatureBuilder1.Point = point1
Dim nXObject1 As NXObject
nXObject1 = pointFeatureBuilder1.Commit()
pointFeatureBuilder1.Destroy()
End Sub
End Module

The value of the scalar represents the percent of the arc length along the curve. If you enter a zero it will be the start point, a value of one will represent the end point. You might try creating a point on the end of the curve that minimizes the distance between the pick point and the start/end point of the curve.

Thank you for answering
I was able to understand the meaning of the scalar.
Select edge in SelectObject. Cursor point of SelectObject is not a point on the edge.
After converting the edge to the curve, I do not know how to convert to a point on the curve the SelectObject point.
excuse me. Please tell me?

NX9 Menu (Insert) → (Datum / Pont) → (Point) → Type (End Point)
I do want to make this command in NXOpen.

The journal below shows one way of doing this. Run the journal in the modeling application and select an edge on the model; a point will be created on the end closest to the pick point.

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()

Sub Main()

If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If

Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Const undoMarkName As String = "create endpoint"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

Dim selectedEdge As Edge
Dim selectedPoint As Point3d
If SelectAnEdge("Select an Edge", selectedEdge, selectedPoint) = Selection.Response.Cancel Then
Return
End If

Dim scalarValue As Double = ClosestEnd(selectedEdge, selectedPoint)

Dim scalar1 As Scalar
scalar1 = workPart.Scalars.CreateScalar(scalarValue, Scalar.DimensionalityType.None, SmartObject.UpdateOption.WithinModeling)

'create point
Dim endPoint As Point
endPoint = workPart.Points.CreatePoint(selectedEdge, scalar1, SmartObject.UpdateOption.WithinModeling)
endPoint.SetVisibility(SmartObject.VisibilityOption.Visible)

lw.Close()

End Sub

Function SelectAnEdge(prompt As String, ByRef selEdge As Edge, ByRef selPos As Point3d) As Selection.Response

Dim selObj As NXObject
Dim theUI As UI = UI.GetUI
Dim cursor As Point3d
Dim typeArray() As Selection.SelectionType = _
{Selection.SelectionType.Edges}

Dim resp As Selection.Response = theUI.SelectionManager.SelectObject( _
prompt, "Select an edge", _
Selection.SelectionScope.AnyInAssembly, _
False, typeArray, selObj, cursor)

If resp = Selection.Response.ObjectSelected Or resp = Selection.Response.ObjectSelectedByName Then
selEdge = selObj
selPos = cursor
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If

End Function

Function ClosestEnd(ByVal theEdge As Edge, ByVal pickPoint As Point3d) As Double

Dim pickPt(2) As Double
pickPt(0) = pickPoint.X
pickPt(1) = pickPoint.Y
pickPt(2) = pickPoint.Z

Dim dist(1) As Double
Dim junk(2) As Double
Dim trash As Double
Dim startPt(2) As Double
Dim endPt(2) As Double

theUfSession.Modl.AskCurveProps(theEdge.Tag, 0, startPt, junk, junk, junk, trash, trash)
theUfSession.Modl.AskCurveProps(theEdge.Tag, 1, endPt, junk, junk, junk, trash, trash)
theUfSession.Vec3.Distance(pickPt, startPt, dist(0))
theUfSession.Vec3.Distance(pickPt, endPt, dist(1))

If dist(0) < dist(1) Then
Return 0
Else
Return 1
End If

End Function

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

End Function

End Module

Great!!!
Code Thank you.
In Search of the start and end point in Modl.AskCurveProps, to measure the distance in Vec3.Distance.
Thank you very much.