Submitted by tomiuck on Thu, 03/03/2016 - 06:15
Forums:
Hello All,
I find myself working with many view labels and I was wondering if there was a way to edit this label with a journal file.
I would like to use the journal to find "(c2.0000)" and replace with "(c1.5)(d2)" as well as "(c)" and replace to "(c)(d)"
Is this possible? I have typically only used macros and I am new to journals.
Edit* ( ) = Greater than Less than signs
Thanks in advance for your help,
Riley
re: find view labels
Are you editing the standard NX view labels or are you adding your own custom notes to views as "view labels"? What version of NX?
I'm not quite sure what you mean by "replace with as well as replace to". Find and replace is common functionality in many programs, but what is the difference between "replace with" and "replace to"?
Sorry I was using greater
Sorry I was using greater than and less than signs that did not show up. I am using NX 9 and I believe it is a standard note. Essentially I just want to make a Journal to find and replace the items shown in the original post.
Thanks again.
re: find and replace
The following post would probably make a good starting point.
http://nxjournaling.com/content/searching-word-or-character-annotation-text
re: find and replace 2
Here's another thread worth looking at:
http://nxjournaling.com/content/note-replacement-error
re: view label size factor
If you are looking to change the "size factor" on the view label text, as I suspect, here is another thread worth looking at:
http://nxjournaling.com/content/extract-vb-file-preferences-view-label
Ok, So from what I know I
Ok, So from what I know I have the following. This works for me as long as its section views. Is there a way to make this work on detail views as well?
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module2
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim ufSession As UFSession = ufSession.GetUFSession
Dim lw As ListingWindow = theSession.ListingWindow
Const undoMarkName As String = "section view prefix size factor"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)
Const factor As Double = 1.0
For Each temp As Drawings.DraftingView In workPart.DraftingViews
If Not TypeOf (temp) Is Drawings.SectionView Then
Continue For
End If
Dim views1(0) As View
views1(0) = temp
Dim editViewSettingsBuilder1 As Drawings.EditViewSettingsBuilder
editViewSettingsBuilder1 = workPart.SettingsManager.CreateDrawingEditViewSettingsBuilder(views1)
Dim editsettingsbuilders1(0) As Drafting.BaseEditSettingsBuilder
editsettingsbuilders1(0) = editViewSettingsBuilder1
workPart.SettingsManager.ProcessForMutipleObjectsSettings(editsettingsbuilders1)
editViewSettingsBuilder1.ViewSectionLabel.LabelPrefix = "SECTION"
Dim nXObject1 As NXObject
nXObject1 = editViewSettingsBuilder1.Commit()
editViewSettingsBuilder1.Destroy()
Next
End Sub
End Module
re: process detail views
The following lines of code only allow the section views to be processed, all others will be skipped. Try changing the journal to allow detail views to be processed.
If Not TypeOf (temp) Is Drawings.SectionView Then
Continue For
End If
Ok I got it to work for both
Ok I got it to work for both views now. How would I make it ignore the Scale label that is added to the next line? I am using this to change the view letter to be bold and not the rest of the label.
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module2
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim ufSession As UFSession = ufSession.GetUFSession
Dim lw As ListingWindow = theSession.ListingWindow
Const undoMarkName As String = "section view prefix size factor"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)
Const factor As Double = 1.0
For Each temp As Drawings.DraftingView In workPart.DraftingViews
If Not TypeOf (temp) Is Drawings.SectionView Then
Continue For
End If
Dim views1(0) As View
views1(0) = temp
Dim editViewSettingsBuilder1 As Drawings.EditViewSettingsBuilder
editViewSettingsBuilder1 = workPart.SettingsManager.CreateDrawingEditViewSettingsBuilder(views1)
Dim editsettingsbuilders1(0) As Drafting.BaseEditSettingsBuilder
editsettingsbuilders1(0) = editViewSettingsBuilder1
workPart.SettingsManager.ProcessForMutipleObjectsSettings(editsettingsbuilders1)
editViewSettingsBuilder1.ViewSectionLabel.LabelPrefix = "SECTION"
Dim nXObject1 As NXObject
nXObject1 = editViewSettingsBuilder1.Commit()
editViewSettingsBuilder1.Destroy()
Next
For Each temp As Drawings.DraftingView In workPart.DraftingViews
If Not TypeOf (temp) Is Drawings.DetailView Then
Continue For
End If
Dim views1(0) As View
views1(0) = temp
Dim editViewSettingsBuilder1 As Drawings.EditViewSettingsBuilder
editViewSettingsBuilder1 = workPart.SettingsManager.CreateDrawingEditViewSettingsBuilder(views1)
Dim editsettingsbuilders1(0) As Drafting.BaseEditSettingsBuilder
editsettingsbuilders1(0) = editViewSettingsBuilder1
workPart.SettingsManager.ProcessForMutipleObjectsSettings(editsettingsbuilders1)
editViewSettingsBuilder1.ViewDetailLabel.LabelPrefix = "Detail"
Dim nXObject1 As NXObject
nXObject1 = editViewSettingsBuilder1.Commit()
editViewSettingsBuilder1.Destroy()
Next
End Sub
End Module
re: view label
I'm not quite sure what the code is supposed to do. You mention wanting to make the view letter bold, but all the code does is change the view prefix.
What do you want the code to do, exactly?