someonedflr
Automotive
- Jan 14, 2014
- 40
Hello,
I'm by no means an expert developing journals, but the opposite, hehe... but I have been trying to made up a code that add appended before text to all the PMI dimensions in a model. My purpose is to list them as (1), (2), (3), etc... I have taken some parts of code from other threads here, and modified it a little bit. It lists the dimensions as pretended, but only the dimensions which already have a text assigned to the appended before text. If they have no text, they remain like that.
So my question is, how to list all the dimensions, regardless they whether or not have appended text?.
Here is my code so far:
Thanks in advance!!
I'm by no means an expert developing journals, but the opposite, hehe... but I have been trying to made up a code that add appended before text to all the PMI dimensions in a model. My purpose is to list them as (1), (2), (3), etc... I have taken some parts of code from other threads here, and modified it a little bit. It lists the dimensions as pretended, but only the dimensions which already have a text assigned to the appended before text. If they have no text, they remain like that.
So my question is, how to list all the dimensions, regardless they whether or not have appended text?.
Here is my code so far:
Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI
Imports NXOpen.Utilities
Imports NXOpen.Annotations
Module ChangeDimText
Dim s As Session = Session.GetSession()
Dim dp As Part = s.Parts.Display
Dim n As Integer = 1
Sub Main()
Dim markId2 As Session.UndoMarkId
markId2 = s.SetUndoMark(Session.MarkVisibility.Visible, "Edit Dimension Text")
Dim dims() As Annotations.Dimension = dp.Dimensions.ToArray
For Each dim1 As Dimension In dims
Dim appendedtext1 As Annotations.AppendedText = dim1.GetAppendedText()
Dim beforetext() As String = appendedtext1.GetBeforeText()
For i As Integer = 0 To beforetext.Length - 1
beforetext(i) = "(" & n & ")"
appendedtext1.SetBeforeText(beforetext)
dim1.SetAppendedText(appendedtext1)
n = n + 1
Next
Next
Dim nErrs1 As Integer
nErrs1 = s.UpdateManager.DoUpdate(markId2)
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module
Thanks in advance!!