Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UFModule Create_Associative_Point_on_Point
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim ufs As UFSession = UFSession.GetUFSession()
Dim response2 As Selection.Response = Nothing
Dim pnt2() As Double = {0.0, 0.0, 0.0}
Dim selectedObjects() As NXObject
response2 = select_a_Point(selectedObjects)
response2 = Selection.Response.Cancel
Dim sda As Point
For Each sda In selectedObjects
ufs.Curve.AskPointData(sda.Tag, pnt2)
MsgBox("Point specified" & vbNewLine & _
"X=" & pnt2(0) & " Y=" & pnt2(1) & " Z="& pnt2(2))
Dim nullXform As Xform = Nothing
Dim test_point As Point
test_point = workPart.Points.CreatePoint(sda, nullXform, SmartObject.UpdateOption.WithinModeling)
test_point.SetVisibility(SmartObject.VisibilityOption.Visible)
Dim nullFeatures_Feature As Features.Feature = Nothing
Dim pointFeatureBuilder1 As Features.PointFeatureBuilder
pointFeatureBuilder1 = workPart.BaseFeatures.CreatePointFeatureBuilder(nullFeatures_Feature)
pointFeatureBuilder1.Point = test_point
Dim nXObject1 As NXObject
nXObject1 = pointFeatureBuilder1.Commit()
Dim Name_test_point as string = "TEST_POINT"
nxObject1.SetName(Name_test_point)
pointFeatureBuilder1.Destroy()
Next
End Sub
Function select_a_Point(ByRef selectedObjects As NXObject())
Dim ui As UI = ui.GetUI()
Dim mask(0) As Selection.MaskTriple
With mask(0)
.Type = UFConstants.UF_point_type
.Subtype = UFConstants.UF_point_subtype
.SolidBodySubtype = 0
End With
Dim resp As Selection.Response = _
ui.SelectionManager.SelectObjects("Specify Point", "Specify Point", _
Selection.SelectionScope.AnyInAssembly, _
Selection.SelectionAction.ClearAndEnableSpecific, _
False, False, mask, selectedObjects)
End Function
End Module