How to get region point in TrimSheetBuilder function?

Hello,

I am trying to cut Body through composite curve and recorded journal for the same.
But i am not able to understand how to get the region point (coordinates1).

Any help will be great.

' NX 1973

Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String)

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display
Dim nullNXOpen_Features_Feature As NXOpen.Features.Feature = Nothing
Dim trimSheetBuilder1 As NXOpen.Features.TrimSheetBuilder = Nothing

trimSheetBuilder1 = workPart.Features.CreateTrimsheetBuilder(nullNXOpen_Features_Feature)

trimSheetBuilder1.Tolerance = 0.01
trimSheetBuilder1.KeepDiscardMethod = NXOpen.Features.TrimSheetBuilder.KeepDiscardOption.Discard
trimSheetBuilder1.ApplyToCopyOfSheets = True
trimSheetBuilder1.ExtendBoundaryObject = True

Dim body1 As NXOpen.Body = CType(workPart.Bodies.FindObject("UNPARAMETERIZED_FEATURE(15)"), NXOpen.Body)

Dim added1 As Boolean = Nothing
added1 = trimSheetBuilder1.TargetBodies.Add(body1)

Dim coordinates1 As NXOpen.Point3d = New NXOpen.Point3d(4222.1264877846479, 162.70463215688338, 1145.1823483051837)
Dim point1 As NXOpen.Point = Nothing
point1 = workPart.Points.CreatePoint(coordinates1)

Dim regionPoint1 As NXOpen.RegionPoint = Nothing
regionPoint1 = workPart.CreateRegionPoint(point1, body1)

trimSheetBuilder1.Regions.Append(regionPoint1)

Dim nullNXOpen_Direction As NXOpen.Direction = Nothing

trimSheetBuilder1.ProjectionDirection.ProjectVector = nullNXOpen_Direction

Dim section1 As NXOpen.Section = Nothing
section1 = workPart.Sections.CreateSection(0.0095, 0.01, 0.5)

section1.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.OnlyCurves)

Dim added2 As Boolean = Nothing
added2 = trimSheetBuilder1.BoundaryObjects.Add(section1)

Dim selectionIntentRuleOptions1 As NXOpen.SelectionIntentRuleOptions = Nothing
selectionIntentRuleOptions1 = workPart.ScRuleFactory.CreateRuleOptions()

selectionIntentRuleOptions1.SetSelectedFromInactive(False)

Dim features1(0) As NXOpen.Features.Feature
Dim compositeCurve1 As NXOpen.Features.CompositeCurve = CType(workPart.Features.FindObject("EXTRACTED_CURVE(17)"), NXOpen.Features.CompositeCurve)

features1(0) = compositeCurve1
Dim nullNXOpen_DisplayableObject As NXOpen.DisplayableObject = Nothing

Dim curveFeatureRule1 As NXOpen.CurveFeatureRule = Nothing
curveFeatureRule1 = workPart.ScRuleFactory.CreateRuleCurveFeature(features1, nullNXOpen_DisplayableObject, selectionIntentRuleOptions1)

selectionIntentRuleOptions1.Dispose()
section1.AllowSelfIntersection(True)

section1.AllowDegenerateCurves(False)

Dim rules1(0) As NXOpen.SelectionIntentRule
rules1(0) = curveFeatureRule1
Dim nullNXOpen_NXObject As NXOpen.NXObject = Nothing

Dim helpPoint1 As NXOpen.Point3d = New NXOpen.Point3d(0.0, 0.0, 0.0)
section1.AddToSection(rules1, nullNXOpen_NXObject, nullNXOpen_NXObject, nullNXOpen_NXObject, helpPoint1, NXOpen.Section.Mode.Create, False)

trimSheetBuilder1.ProjectionDirection.ProjectVector = nullNXOpen_Direction

Dim nXObject1 As NXOpen.NXObject = Nothing
nXObject1 = trimSheetBuilder1.Commit()
trimSheetBuilder1.Destroy()

End Sub
End Module

When using the trim sheet command in interactive NX, you can choose to keep or discard part of the sheet body based on the selection location. The region point in the journal code is equivalent to the selection point.

In your code, you have chosen the "discard" option. You'll need to specify a point in the part of the sheet that you want to discard.

yes, thank you for the suggestion.
I have provided option to user to select point on surface and now it is working fine.

Bhavik S.