' NX 1946
' Journal created by donalke on Tue Jan 12 10:26:25 2021 Pacific Standard Time
'
Imports System
Imports NXOpen
Module NXJournalOUT?B
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 markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
Dim objects1(0) As NXOpen.NXObject
objects1(0) = workPart

Dim attributePropertiesBuilder1 As NXOpen.AttributePropertiesBuilder = Nothing
attributePropertiesBuilder1 = theSession.AttributeManager.CreateAttributePropertiesBuilder(workPart, objects1, NXOpen.AttributePropertiesBuilder.OperationType.None)
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.DataType = NXOpen.AttributePropertiesBaseBuilder.DataTypeOptions.String
attributePropertiesBuilder1.Units = "MilliMeter"

Dim objects2(0) As NXOpen.NXObject
objects2(0) = workPart
Dim massPropertiesBuilder1 As NXOpen.MassPropertiesBuilder = Nothing
massPropertiesBuilder1 = workPart.PropertiesManager.CreateMassPropertiesBuilder(objects2)
Dim selectNXObjectList1 As NXOpen.SelectNXObjectList = Nothing
selectNXObjectList1 = massPropertiesBuilder1.SelectedObjects
Dim objects3() As NXOpen.NXObject
objects3 = selectNXObjectList1.GetArray()
massPropertiesBuilder1.LoadPartialComponents = True
massPropertiesBuilder1.Accuracy = 0.98999999999999999
Dim objects4(0) As NXOpen.NXObject
objects4(0) = workPart
Dim previewPropertiesBuilder1 As NXOpen.PreviewPropertiesBuilder = Nothing
previewPropertiesBuilder1 = workPart.PropertiesManager.CreatePreviewPropertiesBuilder(objects4)
Dim objects5(0) As NXOpen.NXObject
objects5(0) = workPart
attributePropertiesBuilder1.SetAttributeObjects(objects5)
attributePropertiesBuilder1.Units = "MilliMeter"
theSession.SetUndoMarkName(markId1, "Displayed Part Properties Dialog")
attributePropertiesBuilder1.DateValue.DateItem.Day = NXOpen.DateItemBuilder.DayOfMonth.Day12
attributePropertiesBuilder1.DateValue.DateItem.Month = NXOpen.DateItemBuilder.MonthOfYear.Jan
attributePropertiesBuilder1.DateValue.DateItem.Year = "2021"
attributePropertiesBuilder1.DateValue.DateItem.Time = "00:00:00"
previewPropertiesBuilder1.StorePartPreview = True
previewPropertiesBuilder1.StoreModelViewPreview = True
previewPropertiesBuilder1.ModelViewCreation = NXOpen.PreviewPropertiesBuilder.ModelViewCreationOptions.OnViewSave
' ----------------------------------------------
' Dialog Begin Displayed Part Properties
' ----------------------------------------------
attributePropertiesBuilder1.Title = ""
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.StringValue = ""
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.StringValue = ""
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.Category = "checked_out_user"
attributePropertiesBuilder1.Title = "CHECKED_OUT_BY"
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.StringValue = "Mayer, David"
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.IsArray = False
Dim markId2 As NXOpen.Session.UndoMarkId = Nothing
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Delete Attribute")
attributePropertiesBuilder1.Title = "CHECKED_OUT_BY"
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.Delete(workPart)
attributePropertiesBuilder1.Category = ""
attributePropertiesBuilder1.Title = ""
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.StringValue = ""
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.StringValue = ""
attributePropertiesBuilder1.IsArray = False
attributePropertiesBuilder1.IsArray = False
Dim markId3 As NXOpen.Session.UndoMarkId = Nothing
markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Displayed Part Properties")
theSession.DeleteUndoMark(markId3, Nothing)
Dim markId4 As NXOpen.Session.UndoMarkId = Nothing
markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Displayed Part Properties")
Dim updateoption1 As NXOpen.MassPropertiesBuilder.UpdateOptions = Nothing
updateoption1 = massPropertiesBuilder1.UpdateOnSave
Dim nXObject1 As NXOpen.NXObject = Nothing
nXObject1 = massPropertiesBuilder1.Commit()
workPart.PartPreviewMode = NXOpen.BasePart.PartPreview.OnSave
Dim nXObject2 As NXOpen.NXObject = Nothing
nXObject2 = previewPropertiesBuilder1.Commit()
Dim id1 As NXOpen.Session.UndoMarkId = Nothing
id1 = theSession.GetNewestUndoMark(NXOpen.Session.MarkVisibility.Visible)
Dim nErrs1 As Integer = Nothing
nErrs1 = theSession.UpdateManager.DoUpdate(id1)
theSession.DeleteUndoMark(markId4, Nothing)
theSession.SetUndoMarkName(markId1, "Displayed Part Properties")
attributePropertiesBuilder1.Destroy()
massPropertiesBuilder1.Destroy()
previewPropertiesBuilder1.Destroy()
theSession.DeleteUndoMark(id1, Nothing)
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module
