Hi all,
I am trying to journal the HORRIFICALLY DIFFICULT task of replacing our old NX6 title blocks with our new NX9 title blocks while keeping links to part attributes in the master model alive. (Siemens need to make this easier!!!! Like add a feature to select a new template in "edit sheet", but I digress) When importing our new drawing template into our old drawings it creates a Datum coordinate systems in the drawing file. In the journal I select the datums and delete them. The trouble comes when an old file has previous entities in its history and the Datum created isn't DATUM_CSYS(1) but is DATUM_CSYS(2) or DATUM_CSYS(3). The journal errors out and says it can't find the object. I need a solution to either skip to end of program and write a message to the user to delete the datums by hand, or a way to select all datum_csys in the drawing no matter how many there are or what they are named in the journal. I was attempting to use IF THEN to skip to the end of the program but the journal would always error out on the "Dim datumCsys1 As Features.DatumCsys = CType(workPart.Features.FindObject("DATUM_CSYS(1)"), Features.DatumCsys)" line saying object not found.
' ----------------------------------------------
' Menu: Edit->Delete...
' ----------------------------------------------
Dim notifyOnDelete7 As Boolean
notifyOnDelete7 = theSession.Preferences.Modeling.NotifyOnDelete
theSession.UpdateManager.ClearErrorList()
Dim markId60 As Session.UndoMarkId
markId60 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Delete")
Dim objects4(0) As NXObject
Dim datumCsys1 As Features.DatumCsys = CType(workPart.Features.FindObject("DATUM_CSYS(1)"), Features.DatumCsys)
objects4(0) = datumCsys1
Dim nErrs7 As Integer
nErrs7 = theSession.UpdateManager.AddToDeleteList(objects4)
Dim notifyOnDelete8 As Boolean
notifyOnDelete8 = theSession.Preferences.Modeling.NotifyOnDelete
Dim nErrs8 As Integer
nErrs8 = theSession.UpdateManager.DoUpdate(markId60)
' ----------------------------------------------
' Menu: Edit->Delete...
' ----------------------------------------------
I am trying to journal the HORRIFICALLY DIFFICULT task of replacing our old NX6 title blocks with our new NX9 title blocks while keeping links to part attributes in the master model alive. (Siemens need to make this easier!!!! Like add a feature to select a new template in "edit sheet", but I digress) When importing our new drawing template into our old drawings it creates a Datum coordinate systems in the drawing file. In the journal I select the datums and delete them. The trouble comes when an old file has previous entities in its history and the Datum created isn't DATUM_CSYS(1) but is DATUM_CSYS(2) or DATUM_CSYS(3). The journal errors out and says it can't find the object. I need a solution to either skip to end of program and write a message to the user to delete the datums by hand, or a way to select all datum_csys in the drawing no matter how many there are or what they are named in the journal. I was attempting to use IF THEN to skip to the end of the program but the journal would always error out on the "Dim datumCsys1 As Features.DatumCsys = CType(workPart.Features.FindObject("DATUM_CSYS(1)"), Features.DatumCsys)" line saying object not found.
' ----------------------------------------------
' Menu: Edit->Delete...
' ----------------------------------------------
Dim notifyOnDelete7 As Boolean
notifyOnDelete7 = theSession.Preferences.Modeling.NotifyOnDelete
theSession.UpdateManager.ClearErrorList()
Dim markId60 As Session.UndoMarkId
markId60 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Delete")
Dim objects4(0) As NXObject
Dim datumCsys1 As Features.DatumCsys = CType(workPart.Features.FindObject("DATUM_CSYS(1)"), Features.DatumCsys)
objects4(0) = datumCsys1
Dim nErrs7 As Integer
nErrs7 = theSession.UpdateManager.AddToDeleteList(objects4)
Dim notifyOnDelete8 As Boolean
notifyOnDelete8 = theSession.Preferences.Modeling.NotifyOnDelete
Dim nErrs8 As Integer
nErrs8 = theSession.UpdateManager.DoUpdate(markId60)
' ----------------------------------------------
' Menu: Edit->Delete...
' ----------------------------------------------