Thanks for the Program.
Is it possible to create the Feature points through this program?
I have noticed the program creates basic points.
I'm curious to know why you want "Feature Points". I don't see any benefit to having the points associated with the lines, and writing thousands of points into the Part Navigator is going to slow things down.
But, anyway, it's easy to do. Here is the code. It uses a mixture of SNAP and NX/Open functions:
Option Infer On Imports Snap, Snap.Create, Snap.UI.Selection Module NXJournal Sub Main() ' Create a selection dialog Dim dialog = SelectObject("Select lines") ' Allow selection of multiple lines dialog.SetFilter(Snap.NX.ObjectTypes.Type.Line) dialog.AllowMultiple = True ' Display the dialog and get a result Dim result = dialog.Show() ' Cycle through the lines, creating points For Each obj In result.Objects Dim line = CType(obj, Snap.NX.Line) CreatePointFeature(line.StartPoint) CreatePointFeature(line.EndPoint) Next End Sub Public Function CreatePointFeature(pos As Position) As NXOpen.Features.PointFeature Dim workPart = NXOpen.Session.GetSession.Parts.Work Dim builder = workPart.BaseFeatures.CreatePointFeatureBuilder(Nothing) Dim pt As NXOpen.Point = Snap.Create.Point(pos) builder.Point = pt Dim pointFeature As NXOpen.Features.PointFeature = builder.Commit builder.Destroy Return pointFeature End Function End Module
Here is code that will create a point feature associative to the given line's start point.
Dim theSession As Session = Session.GetSession() Dim workPart As Part = theSession.Parts.Work Dim markId1 As Session.UndoMarkId markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Point") 'change code to reference your line Dim line1 As Line = [reference to your line object] Dim scalar1 As Scalar scalar1 = workPart.Scalars.CreateScalar(0.0, Scalar.DimensionalityType.None, SmartObject.UpdateOption.WithinModeling) Dim point1 As Point point1 = workPart.Points.CreatePoint(line1, scalar1, SmartObject.UpdateOption.WithinModeling) point1.SetVisibility(SmartObject.VisibilityOption.Visible) Dim nullFeatures_Feature As Features.Feature = Nothing Dim pointFeatureBuilder1 As Features.PointFeatureBuilder pointFeatureBuilder1 = workPart.BaseFeatures.CreatePointFeatureBuilder(nullFeatures_Feature) pointFeatureBuilder1.Point = point1 Dim nXObject2 As NXObject nXObject2 = pointFeatureBuilder1.Commit() pointFeatureBuilder1.Destroy()