Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reverse direction of line

Status
Not open for further replies.

dzupfrg

Industrial
Nov 22, 2011
87
You can reverse the direction of non-associative curve? Or quick replace start-end point.

NX 8.5.1.3
 
Replies continue below

Recommended for you

I recently was thinking the same thing.
I do not think there is a way to reverse the curve after it has been placed down.
 
The only way I know of is to reselect your points. You need to select a point out in space for the start point then select switch to end point and select the old start point then switch back to start point and select the old end point.
 
Here is a quick journal version (for NX8 and above) of moudy1's method. I have not tested it on associative lines or sketch lines, those may cause problems. Use at your own risk...

Code:
'May 2, 2013
'reverse direction of non-associative line

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
		Dim workPart As Part = theSession.Parts.Work

        Dim myLine As Line
        If SelectALine("Select a line", myLine) = Selection.Response.Cancel Then
            Exit Sub
        End If

        myLine.SetEndpoints(myLine.EndPoint, myLine.StartPoint)

    End Sub

    Function SelectALine(ByVal prompt As String, ByRef selObj As TaggedObject) As Selection.Response

        Dim theUI As UI = UI.GetUI
        Dim title As String = "Select a line"
        Dim includeFeatures As Boolean = False
        Dim keepHighlighted As Boolean = False
        Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
        Dim cursor As Point3d
        Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
        Dim selectionMask_array(0) As Selection.MaskTriple

        With selectionMask_array(0)
            .Type = UFConstants.UF_line_type
            .Subtype = UFConstants.UF_line_normal_subtype
        End With

        Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt, _
         title, scope, selAction, _
         includeFeatures, keepHighlighted, selectionMask_array, _
         selobj, cursor)
        If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
            Return Selection.Response.Ok
        Else
            Return Selection.Response.Cancel
        End If

    End Function

    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

    End Function

End Module

www.nxjournaling.com
 
Thank you, working ok.

NX 8.5.1.3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor