' NX 7.5.0.32 ' Journal created by Zoran on Mon Mar 07 21:25:08 2011 Mitteleuropäische Zeit ' Option Strict Off Imports System Imports NXOpen Module NXJournal Sub Main Dim theSession As Session = Session.GetSession() Dim workPart As Part = theSession.Parts.Work Dim displayPart As Part = theSession.Parts.Display Dim markId1 As Session.UndoMarkId markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Redefine Feature") Dim markId2 As Session.UndoMarkId markId2 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Redefine Feature") Dim datumPlaneFeature1 As Features.DatumPlaneFeature = CType(workPart.Features.FindObject("DATUM_PLANE(5)"), Features.DatumPlaneFeature) datumPlaneFeature1.MakeCurrentFeature() Dim markId3 As Session.UndoMarkId markId3 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Start") If Not workPart.Preferences.Modeling.GetHistoryMode Then Throw(New Exception("Create or edit of a Feature was recorded in History Mode but playback is in History-Free Mode.")) End If Dim datumPlaneBuilder1 As Features.DatumPlaneBuilder datumPlaneBuilder1 = workPart.Features.CreateDatumPlaneBuilder(datumPlaneFeature1) Dim plane1 As Plane plane1 = datumPlaneBuilder1.GetPlane() Dim section1 As Section section1 = workPart.Sections.CreateSection(0.02413, 0.0254, 0.5) Dim unit1 As Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit) Dim expression1 As Expression expression1 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1) Dim section2 As Section section2 = workPart.Sections.CreateSection(0.02413, 0.0254, 0.5) Dim expression2 As Expression expression2 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1) Dim coordinates1 As Point3d = New Point3d(0.0, 0.0, 0.0) Dim point1 As Point point1 = workPart.Points.CreatePoint(coordinates1) Dim coordinates2 As Point3d = New Point3d(5.80826817261362, 300.0, -19.1917318273864) Dim point2 As Point point2 = workPart.Points.CreatePoint(coordinates2) workPart.Points.DeletePoint(point1) theSession.SetUndoMarkName(markId3, "Datum Plane Dialogfenster") plane1.SetMethod(PlaneTypes.MethodType.Distance) plane1.SetUpdateOption(SmartObject.UpdateOption.WithinModeling) plane1.SetMethod(PlaneTypes.MethodType.Distance) Dim geom1(0) As NXObject Dim datumPlane1 As DatumPlane = CType(workPart.Datums.FindObject("DATUM_CSYS(0) XY plane"), DatumPlane) geom1(0) = datumPlane1 plane1.SetGeometry(geom1) plane1.SetFlip(False) plane1.SetReverseSide(False) Dim expression3 As Expression expression3 = plane1.Expression expression3.RightHandSide = "330" plane1.SetAlternate(PlaneTypes.AlternateType.One) plane1.Evaluate() Dim coordinates3 As Point3d = New Point3d(5.80826817261362, 330.0, -19.1917318273864) Dim point3 As Point point3 = workPart.Points.CreatePoint(coordinates3) workPart.Points.DeletePoint(point2) Dim markId4 As Session.UndoMarkId markId4 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Datum Plane") Dim corner1_1 As Point3d = New Point3d(313.399717988762, 330.0, 288.399717988762) Dim corner2_1 As Point3d = New Point3d(313.399717988762, 330.0, -326.783181643535) Dim corner3_1 As Point3d = New Point3d(-301.783181643535, 330.0, -326.783181643535) Dim corner4_1 As Point3d = New Point3d(-301.783181643535, 330.0, 288.399717988762) datumPlaneBuilder1.SetCornerPoints(corner1_1, corner2_1, corner3_1, corner4_1) Dim flip1 As Boolean flip1 = plane1.Flip Dim feature1 As Features.Feature feature1 = datumPlaneBuilder1.CommitFeature() Dim datumPlaneFeature2 As Features.DatumPlaneFeature = CType(feature1, Features.DatumPlaneFeature) Dim datumPlane2 As DatumPlane datumPlane2 = datumPlaneFeature2.DatumPlane datumPlane2.SetReverseSection(False) theSession.DeleteUndoMark(markId4, Nothing) theSession.SetUndoMarkName(markId3, "Datum Plane") datumPlaneBuilder1.Destroy() Try ' Ausdruck wird immer noch verwendet. workPart.Expressions.Delete(expression2) Catch ex As NXException ex.AssertErrorCode(1050029) End Try section2.Destroy() Try ' Ausdruck wird immer noch verwendet. workPart.Expressions.Delete(expression1) Catch ex As NXException ex.AssertErrorCode(1050029) End Try section1.Destroy() theSession.DeleteUndoMark(markId3, Nothing) Dim nErrs1 As Integer nErrs1 = theSession.UpdateManager.DoUpdate(markId2) datumPlaneFeature2.MakeCurrentFeature() theSession.DeleteUndoMark(markId2, Nothing) ' ---------------------------------------------- ' Menü: Werkzeuge->Journal->Stop Recording ' ---------------------------------------------- End Sub End Module