76 lines
2.8 KiB
Python
76 lines
2.8 KiB
Python
|
|
# NX 2412
|
|||
|
|
# Journal created by antoi on Sat Nov 15 12:43:19 2025 Eastern Standard Time
|
|||
|
|
#
|
|||
|
|
import math
|
|||
|
|
import NXOpen
|
|||
|
|
def main(args) :
|
|||
|
|
|
|||
|
|
theSession = NXOpen.Session.GetSession() #type: NXOpen.Session
|
|||
|
|
workPart = theSession.Parts.Work
|
|||
|
|
displayPart = theSession.Parts.Display
|
|||
|
|
# ----------------------------------------------
|
|||
|
|
# Menu: Tools->Utilities->Expressions...
|
|||
|
|
# ----------------------------------------------
|
|||
|
|
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
|
|||
|
|
|
|||
|
|
theSession.SetUndoMarkName(markId1, "Expressions Dialog")
|
|||
|
|
|
|||
|
|
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Edit Expression")
|
|||
|
|
|
|||
|
|
expression1 = workPart.Expressions.FindObject("support_angle")
|
|||
|
|
unit1 = workPart.UnitCollection.FindObject("Degrees")
|
|||
|
|
workPart.Expressions.EditExpressionWithUnits(expression1, unit1, "20")
|
|||
|
|
|
|||
|
|
markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Expressions")
|
|||
|
|
|
|||
|
|
markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Make Up to Date")
|
|||
|
|
|
|||
|
|
objects1 = [NXOpen.NXObject.Null] * 1
|
|||
|
|
objects1[0] = expression1
|
|||
|
|
theSession.UpdateManager.MakeUpToDate(objects1, markId4)
|
|||
|
|
|
|||
|
|
markId5 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "NX update")
|
|||
|
|
|
|||
|
|
nErrs1 = theSession.UpdateManager.DoUpdate(markId5)
|
|||
|
|
|
|||
|
|
theSession.DeleteUndoMark(markId5, "NX update")
|
|||
|
|
|
|||
|
|
theSession.DeleteUndoMark(markId4, None)
|
|||
|
|
|
|||
|
|
theSession.DeleteUndoMark(markId3, None)
|
|||
|
|
|
|||
|
|
theSession.SetUndoMarkName(markId1, "Expressions")
|
|||
|
|
|
|||
|
|
markId6 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
|
|||
|
|
|
|||
|
|
theSession.SetUndoMarkName(markId6, "Expressions Dialog")
|
|||
|
|
|
|||
|
|
# ----------------------------------------------
|
|||
|
|
# Dialog Begin Expressions
|
|||
|
|
# ----------------------------------------------
|
|||
|
|
markId7 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Expressions")
|
|||
|
|
|
|||
|
|
theSession.DeleteUndoMark(markId7, None)
|
|||
|
|
|
|||
|
|
markId8 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Expressions")
|
|||
|
|
|
|||
|
|
markId9 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Make Up to Date")
|
|||
|
|
|
|||
|
|
markId10 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "NX update")
|
|||
|
|
|
|||
|
|
nErrs2 = theSession.UpdateManager.DoUpdate(markId10)
|
|||
|
|
|
|||
|
|
theSession.DeleteUndoMark(markId10, "NX update")
|
|||
|
|
|
|||
|
|
theSession.DeleteUndoMark(markId9, None)
|
|||
|
|
|
|||
|
|
theSession.DeleteUndoMark(markId8, None)
|
|||
|
|
|
|||
|
|
theSession.SetUndoMarkName(markId6, "Expressions")
|
|||
|
|
|
|||
|
|
# ----------------------------------------------
|
|||
|
|
# Menu: Tools->Automation->Journal->Stop Recording
|
|||
|
|
# ----------------------------------------------
|
|||
|
|
|
|||
|
|
if __name__ == '__main__':
|
|||
|
|
main(sys.argv[1:])
|