Hello,
I would like to be able to select individual dimensions, notes, or labels and updated them from inherited settings from drafting preferences.
I think I'm getting close, but no cigar.
Thank you for any help you can give me.
Mike Rowe
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display
Dim lw As ListingWindow = theSession.ListingWindow
'Dim mySelectedObjects as NXObject()
Dim mySelectedObjects as NXOpen.DisplayableObject
lw.Open
If SelectObjects("Hey, select multiple somethings", _
mySelectedObjects) = Selection.Response.Ok Then
lw.WriteLine("You selected " & mySelectedObjects.Length & " object(s)")
lw.WriteLine("")
For Each mySelObj As NXObject in mySelectedObjects
lw.WriteLine("Object Tag: " & mySelObj.Tag)
lw.WriteLine("Object Type: " & mySelObj.GetType.ToString)
lw.WriteLine("")
Next
End if
' The close method closes the text stream to the window,
' it does not close the window itself
' (use the .CloseWindow() method for that).
' Also, if you are using the listing window to write
' to a file, the close method will clean up and close the file.
lw.Close
End Sub
Dim editSettingsBuilder1 As NXOpen.Annotations.EditSettingsBuilder = Nothing
editSettingsBuilder1 = workPart.SettingsManager.CreateAnnotationEditSettingsBuilder(mySelectedObjects)
Dim editsettingsbuilders1(0) As NXOpen.Drafting.BaseEditSettingsBuilder
editsettingsbuilders1(0) = editSettingsBuilder1
workPart.SettingsManager.ProcessForMultipleObjectsSettings(editsettingsbuilders1)
editSettingsBuilder1.InheritSettingsFromPreferences()
Dim nXObject1 As NXOpen.NXObject = Nothing
nXObject1 = editSettingsBuilder1.Commit()
editSettingsBuilder1.Destroy()
'Sub DoUpdate
' DoUpdate()
'End Sub
'Dim nErrs1 As Integer
'nErrs1 = theSession.UpdateManager.DoUpdate(mySelectedObjects.Length)
Function SelectObjects(prompt As String, _
ByRef selObj as NXObject()) As Selection.Response
Dim theUI As UI = UI.GetUI
Dim typeArray() As Selection.SelectionType = _
{Selection.SelectionType.All, _
Selection.SelectionType.Faces, _
Selection.SelectionType.Edges, _
Selection.SelectionType.Features}
Dim resp As Selection.Response = theUI.SelectionManager.SelectObjects( _
prompt, "Selection", _
Selection.SelectionScope.AnyInAssembly, _
False, typeArray, selobj)
If resp = Selection.Response.ObjectSelected Or _
resp = Selection.Response.ObjectSelectedByName Or _
resp = Selection.Response.OK Then
Return Selection.Response.Ok
Else
return Selection.Response.Cancel
End If
End Function
End Module