Hello everybody!
I'm trying to write a program that models several same spaced planes through a spline.
I had some troubles understanding how the 4 points for every datum plane are defined.
datumPlane1.SetCornerPoints(point1_1, point2_1, point3_1, point4_1)
I hope somebody could help me or show me how this task could be done.
I'm NX 4.0.4.2 user.
Thanks!
-----------------------------------------
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
' ----------------------------------------------
' Menu: Insert->Datum/Point->Datum Plane...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim nullFeatures_Feature As Features.Feature = Nothing
Dim datumPlaneBuilder1 As Features.DatumPlaneBuilder
datumPlaneBuilder1 = workPart.Features.CreateDatumPlaneBuilder(nullFeatures_Feature)
Dim plane1 As Plane
plane1 = datumPlaneBuilder1.GetPlane()
theSession.SetUndoMarkName(markId1, "Datum Plane")
plane1.SetMethod(PlaneTypes.MethodType.Frenet)
Dim geom1(0) As NXObject
Dim spline1 As Spline = CType(workPart.FindObject("HANDLE R-604"), Spline)
geom1(0) = spline1
plane1.SetGeometry(geom1)
plane1.SetPercent(False)
plane1.SetExpression("670")
plane1.Evaluate()
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Datum Plane")
Dim geom4(-1) As NXObject
plane1.SetGeometry(geom4)
Dim flip1 As Boolean
flip1 = plane1.Flip
Dim feature1 As Features.Feature
feature1 = datumPlaneBuilder1.CommitFeature()
Dim datumPlaneFeature1 As Features.DatumPlaneFeature = CType(feature1, Features.DatumPlaneFeature)
Dim datumPlane1 As DatumPlane
datumPlane1 = datumPlaneFeature1.DatumPlane
Dim point1_1 As Point3d = New Point3d(-474.091218289246, 2471.51918195185, 1335.49675525946)
Dim point2_1 As Point3d = New Point3d(-471.494657855252, 2471.28254083785, 1335.43073246696)
Dim point3_1 As Point3d = New Point3d(-471.249755535249, 2473.83135829555, 1335.92675316644)
Dim point4_1 As Point3d = New Point3d(-473.846315969243, 2474.06799940956, 1335.99277595895)
datumPlane1.SetCornerPoints(point1_1, point2_1, point3_1, point4_1)
datumPlane1.SetReverseSection(False)
theSession.DeleteUndoMark(markId2, Nothing)
datumPlaneBuilder1.Destroy()
I'm trying to write a program that models several same spaced planes through a spline.
I had some troubles understanding how the 4 points for every datum plane are defined.
datumPlane1.SetCornerPoints(point1_1, point2_1, point3_1, point4_1)
I hope somebody could help me or show me how this task could be done.
I'm NX 4.0.4.2 user.
Thanks!
-----------------------------------------
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
' ----------------------------------------------
' Menu: Insert->Datum/Point->Datum Plane...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim nullFeatures_Feature As Features.Feature = Nothing
Dim datumPlaneBuilder1 As Features.DatumPlaneBuilder
datumPlaneBuilder1 = workPart.Features.CreateDatumPlaneBuilder(nullFeatures_Feature)
Dim plane1 As Plane
plane1 = datumPlaneBuilder1.GetPlane()
theSession.SetUndoMarkName(markId1, "Datum Plane")
plane1.SetMethod(PlaneTypes.MethodType.Frenet)
Dim geom1(0) As NXObject
Dim spline1 As Spline = CType(workPart.FindObject("HANDLE R-604"), Spline)
geom1(0) = spline1
plane1.SetGeometry(geom1)
plane1.SetPercent(False)
plane1.SetExpression("670")
plane1.Evaluate()
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Datum Plane")
Dim geom4(-1) As NXObject
plane1.SetGeometry(geom4)
Dim flip1 As Boolean
flip1 = plane1.Flip
Dim feature1 As Features.Feature
feature1 = datumPlaneBuilder1.CommitFeature()
Dim datumPlaneFeature1 As Features.DatumPlaneFeature = CType(feature1, Features.DatumPlaneFeature)
Dim datumPlane1 As DatumPlane
datumPlane1 = datumPlaneFeature1.DatumPlane
Dim point1_1 As Point3d = New Point3d(-474.091218289246, 2471.51918195185, 1335.49675525946)
Dim point2_1 As Point3d = New Point3d(-471.494657855252, 2471.28254083785, 1335.43073246696)
Dim point3_1 As Point3d = New Point3d(-471.249755535249, 2473.83135829555, 1335.92675316644)
Dim point4_1 As Point3d = New Point3d(-473.846315969243, 2474.06799940956, 1335.99277595895)
datumPlane1.SetCornerPoints(point1_1, point2_1, point3_1, point4_1)
datumPlane1.SetReverseSection(False)
theSession.DeleteUndoMark(markId2, Nothing)
datumPlaneBuilder1.Destroy()