' NX 2008
' Journal created by shojaee on Sat Dec 10 19:47:20 2022 W. Europe Standard Time
'
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
' ----------------------------------------------
' Menu: Analysis->Measure...
' ----------------------------------------------
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
theSession.SetUndoMarkName(markId1, "Measure Dialog")
workPart.MeasureManager.SetPartTransientModification()
Dim scCollector1 As NXOpen.ScCollector = Nothing
scCollector1 = workPart.ScCollectors.CreateCollector()
scCollector1.SetMultiComponent()
workPart.MeasureManager.SetPartTransientModification()
Dim selectionIntentRuleOptions1 As NXOpen.SelectionIntentRuleOptions = Nothing
selectionIntentRuleOptions1 = workPart.ScRuleFactory.CreateRuleOptions()
selectionIntentRuleOptions1.SetSelectedFromInactive(False)
Dim faces1(0) As NXOpen.Face
Dim fillHole1 As NXOpen.Features.FillHole =
CType(workPart.Features.FindObject("FILLHOLE(29)"), NXOpen.Features.FillHole)
Dim face1 As NXOpen.Face = CType(fillHole1.FindObject("FACE 1
{(7.2042160658739,11.5189138284897,12.7194830708951) FILLHOLE(29)}"), NXOpen.Face)
faces1(0) = face1
Dim faceDumbRule1 As NXOpen.FaceDumbRule = Nothing
faceDumbRule1 = workPart.ScRuleFactory.CreateRuleFaceDumb(faces1,
selectionIntentRuleOptions1)
selectionIntentRuleOptions1.Dispose()
Dim rules1(0) As NXOpen.SelectionIntentRule
rules1(0) = faceDumbRule1
scCollector1.ReplaceRules(rules1, False)
workPart.MeasureManager.SetPartTransientModification()
Dim scCollector2 As NXOpen.ScCollector = Nothing
scCollector2 = workPart.ScCollectors.CreateCollector()
scCollector2.SetMultiComponent()
Dim markId2 As NXOpen.Session.UndoMarkId = Nothing
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible,
"Measure")
Dim markId3 As NXOpen.Session.UndoMarkId = Nothing
markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible,
"Measurement Apply")
workPart.MeasureManager.ClearPartTransientModification()
Dim markId4 As NXOpen.Session.UndoMarkId = Nothing
markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible,
"Measurement Update")
Dim sellist1(0) As NXOpen.NXObject
sellist1(0) = face1
Dim ptanchor1 As NXOpen.Point3d = New NXOpen.Point3d(0.0, 0.0, 0.0)
Dim boxpoints1() As NXOpen.Point3d
Dim dir1() As NXOpen.Point3d
Dim edgelength1() As Double
Dim ptorigin1 As NXOpen.Point3d = Nothing
Dim ptextreme1 As NXOpen.Point3d = Nothing
Dim pdvolume1 As Double = Nothing
theSession.Measurement.GetBoundingBoxProperties(sellist1, 0, ptanchor1, False,
boxpoints1, dir1, edgelength1, ptorigin1, ptextreme1, pdvolume1)
workPart.MeasureManager.SetPartTransientModification()
theSession.DeleteUndoMark(markId3, "Measurement Apply")
Dim datadeleted1 As Boolean = Nothing
datadeleted1 = theSession.DeleteTransientDynamicSectionCutData()
theSession.DeleteUndoMark(markId2, Nothing)
theSession.SetUndoMarkName(markId1, "Measure")
scCollector1.Destroy()
scCollector2.Destroy()
workPart.MeasureManager.ClearPartTransientModification()
theSession.DeleteUndoMark(markId4, Nothing)
Dim markId5 As NXOpen.Session.UndoMarkId = Nothing
markId5 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
theSession.SetUndoMarkName(markId5, "Measure Dialog")
workPart.MeasureManager.SetPartTransientModification()
Dim scCollector3 As NXOpen.ScCollector = Nothing
scCollector3 = workPart.ScCollectors.CreateCollector()
scCollector3.SetMultiComponent()
workPart.MeasureManager.SetPartTransientModification()
' ----------------------------------------------
' Dialog Begin Measure
' ----------------------------------------------
scCollector3.Destroy()
workPart.MeasureManager.ClearPartTransientModification()
theSession.UndoToMark(markId5, Nothing)
theSession.DeleteUndoMark(markId5, Nothing)
theSession.CleanUpFacetedFacesAndEdges()
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module