×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Journal to flip arrow placement on selected dimensions

Journal to flip arrow placement on selected dimensions

Journal to flip arrow placement on selected dimensions

(OP)
Here is a journal I wrote that will flip the arrow placement of a dimension. I found it a little tedious to have to go under style and have to do it manually so I created this journal and created a short cut to it. Hope you find it helpful. Tested on NX8.5, but should work on all versions.

CODE --> .net

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module NXJournal

	Sub Main (ByVal args() As String) 

		Dim theSession As Session = Session.GetSession()
		Dim theUFSession As UFSession = UFSession.GetUFSession()
		Dim theUI As UI = UI.GetUI()
		
		Dim mpi(99) As Integer
                Dim mpr(69) As Double
                Dim radius_value As String = Nothing
                Dim diameter_value As String = Nothing

		Dim numObjects As Integer = theUI.SelectionManager.GetNumSelectedObjects()
		Dim markId1 As Session.UndoMarkId
		markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Dimension")
		
		For i As Integer = 0 To numObjects - 1
			Dim nXObject1 As NXObject = theUI.SelectionManager.GetSelectedObject(i)
			Try
				theUFSession.Drf.AskObjectPreferences(nXObject1.Tag, mpi, mpr, _
					radius_value, diameter_value)
				If mpi(0) = 1 'Then Text/Arrow Placement is Automatic
					mpi(0) = 3
				ElseIf mpi(0) = 2 'Then Text/Arrow Placement is Manual, Arrows In
					mpi(0) = 3
				ElseIf mpi(0) = 3 ' Then Text/Arrow Placement is Manual, Arrows Out
					mpi(0) = 2
				End If
							
				theUFSession.Drf.SetObjectPreferences(nXObject1.Tag, mpi, mpr, _
					radius_value, diameter_value)
			Catch eX As NXException
				'Echo("The object you selected: " & vbNewLine & nXObject1.ToString & vbNewLine & vbNewLine & "Failed to change arrow placement. See below error for details:" & vbNewLine & eX.ToString)
			End Try
		Next
		
		Dim nErrs1 As Integer
		nErrs1 = theSession.UpdateManager.DoUpdate(markId1)
	End Sub
	
	Sub Echo(input As String)
		Dim s As Session = Session.GetSession()
		Dim lw As ListingWindow = s.ListingWindow
		lw.Open()
		lw.WriteLine(input)
	End Sub
	
		
End Module 

Design Engineer, NX 7.5

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources