Cancel
Showing results for 
Search instead for 
Did you mean: 

create intersection points between two curves in Nx 8.5

Creator
Creator

I have a lot of grid lines, So, how to create point between two curves that are the intersection automatically.

I made by command: intersection point, but It took too much time.

Thanks.2018-06-14_10-48-46.png

 

11 REPLIES

Re: create intersection points between two curves in Nx 8.5

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

I don't believe there is a way to create all the intersection points at one command.

You could record a journal to create one point, then edit it so you can

- select all the curves in one direction

- select all the cross curves

- loop thru both & create an intersection point at each pair.

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled


Re: create intersection points between two curves in Nx 8.5

Creator
Creator

thanks, @Ken_A, Let me try.

Re: create intersection points between two curves in Nx 8.5

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi @hungbk

I found an old grip program that does what you want.

I have attached the source and the executable. It is compiled with NX12 as I don't have NX8.5.

If it doesn't work you need to compile and link the .grs file with your NX8.5 "NX Open Grip" application under the Tools sub menu.

There is a soft limit os 10,000 curves in each selection group but can easily be increased.

Hope it helps

Regards

Paul

Re: create intersection points between two curves in Nx 8.5

Creator
Creator

 @Paul_Hartrick.

I had tried your code. It is ok.

Thank you so much!

Hung.

 

Re: create intersection points between two curves in Nx 8.5

Siemens Phenom Siemens Phenom
Siemens Phenom

@hungbk

Good news. It should save you a lot of time for sure.

Regards

Paul

Re: create intersection points between two curves in Nx 8.5

Creator
Creator

I also made a code to create intersection points, but I only want to show points as shown, So, how to remove points that I do not expected. please see my code below 

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities

Module pick_some_curves

    Dim s As Session = Session.GetSession()
    Dim ufs As UFSession = UFSession.GetUFSession()
    Dim lw As ListingWindow = s.ListingWindow
    Sub Main()

        
        Dim dp As Part = s.Parts.Display
        Dim wp As Part = s.Parts.Work
        Dim bp As BasePart = CType(wp, BasePart)
        Dim pc As PointCollection = bp.Points
        Dim pointCounter As Integer = 1
		Dim myCurves() As Curve = SelectCurves("AESI")
        Dim curveCount As Integer = myCurves.GetUpperBound(0)
        If curveCount < 1 Then
            lw.Open()
            lw.WriteLine("Run this in a part with at least two curves.")
        End If

        Dim copiedCurves(curveCount)
        Array.Copy(myCurves, copiedCurves, curveCount + 1)
        Array.Reverse(copiedCurves)
        ReDim Preserve copiedCurves(curveCount - 1)

        ' Turn on object name display
        dp.Preferences.NamesBorderVisualization.ObjectNameDisplay = _
            Preferences.PartVisualizationNamesBorders.NameDisplay.WorkView

        For Each thisCurve As Curve In myCurves

            For Each otherCurve As Curve In copiedCurves
                Try
                    Dim i1 As IBaseCurve = CType(thisCurve, IBaseCurve)
                    Dim i2 As IBaseCurve = CType(otherCurve, IBaseCurve)

                    Dim h1 As Point = Nothing
                    Dim h2 As Point = Nothing
                    Dim PT As Point = pc.CreatePoint(i1, i2, h1, h2, _
                                SmartObject.UpdateOption.WithinModeling)
                    PT.SetVisibility(SmartObject.VisibilityOption.visible)
                    pointCounter += 1
                Catch ex As Exception
                    'don't do anything - not all curves intersect!
                End Try

            Next

            If (copiedCurves.GetUpperBound(0) > 0) Then
                ReDim Preserve copiedCurves(copiedCurves.GetUpperBound(0) - 1)
            End If

        Next
        pointCounter -= 1
        MsgBox("Created " & pointCounter.ToString() & _
               " points.", MsgBoxStyle.Information)
        Dim undoMark As Session.UndoMarkId = _
            s.SetUndoMark(Session.MarkVisibility.Visible, "UpdateMark")
        s.UpdateManager.DoUpdate(undoMark)


    End Sub

    Function SelectCurves(ByRef prompt As String) As Curve()

        Dim selected() As TaggedObject = Nothing

        NXOpen.UI.GetUI.SelectionManager.SelectTaggedObjects("Select Curves", prompt,
            Selection.SelectionScope.WorkPart, False,
            New NXOpen.Selection.SelectionType() {Selection.SelectionType.Curves},
            selected)

        Dim curveList As Collections.Generic.List(Of Curve) =
            New Collections.Generic.List(Of Curve)

        For Each aCurve As NXObject In selected
            curveList.Add(aCurve)
        Next

        Return curveList.ToArray()

    End Function

    Sub Echo(ByVal output As String)

        s.ListingWindow.Open()
        s.ListingWindow.WriteLine(output)
        s.LogFile.WriteLine(output)

    End Sub

    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        Return Session.LibraryUnloadOption.Immediately
    End Function

End Module

ex2.PNG

Re: create intersection points between two curves in Nx 8.5

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi @hungbk

One way is to do a distance check of each point to each curve. Each point has to be close(within some threshold) to two curves. If its only close to 1 curve then delete it.

Regards

Paul

Re: create intersection points between two curves in Nx 8.5

Siemens Phenom Siemens Phenom
Siemens Phenom

@hungbk

I hope I didn't miss something in between all the postings, but did you try the Point set command?

 

point set.png

Regards,
Abe

Re: create intersection points between two curves in Nx 8.5

Creator
Creator

@Abeinjapan, thanks.

I tried with Point set. if the line is straight that is easy. but the gird is included: spine line, arc,...that is difficult.