View Label Parms

Getting an error says Invalid input parameter...

Module NXJournal
Dim ufs As UFSession = UFSession.GetUFSession()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Sub Main()

Dim views As DraftingView

For Each views In workPart.DraftingViews.ToArray()
Dim labelparms1 As UFDraw.ViewLabelParms = New UFDraw.ViewLabelParms
labelparms1.letter_format = ViewLabelLetterFormat.ViewLabelDashedLetter
labelparms1.letter_size_factor = 3
Dim viewtag As Tag = views.Tag
ufs.Draw.SetViewLabelParms(viewtag, labelparms1)

Next

End Sub

Any help would be thankful
Joe.

The "invalid parameter" error occurs in the .SetViewLabelParms method because you have passed in the tag of the view instead of the tag of the view label. You can access the view label tag by using the .AskViewLabel method. The .AskViewLabel method will throw an error if neither the view label nor the scale label is shown on the given view.

The code you posted sets the letter_format and the letter_size_factor, but all the other parameters are left unset. NX needs the other parameters as well to update the view label.

I suggest first using .AskViewLabelParms on the view label of interest; this will initialize all the data structures with the current parameters. Now you can change the parameters that you wish and finally use the .SetViewLabelParms method.