Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Journal to flip arrow placement on selected dimensions

Status
Not open for further replies.

Techomick

Mechanical
Jun 21, 2011
46
0
0
US
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:
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
 
Replies continue below

Recommended for you

Status
Not open for further replies.
Back
Top