Current process for applying section curves in 100mm intervals to objects in NX6 for 3 vectors is as follows:
1 - Start Section Curve Command
2 - Set Type to Parallel Planes
3 - Select Objects
4 - Specify Plane as "YC-ZC Plane" (X - Axis)
5 - Set Plane Location:
>Start = -10000mm
>End = -10000mm
>Step = -100mm
6 - Settings:
>Associative = Unchecked
>Group Objects = Unchecked
>Output Sampled Points = Unchecked
>Curve Fit = Cubic
>Join Curves = No
>Tolerance = .001in
7 - Apply
8 - Select Objects
9 - Specify Plane as "XC-ZC Plane" (Y - Axis)
10 - Set Plane Location:
>Start = -10000mm
>End = -10000mm
>Step = -100mm
11 - Apply
12 - Select Objects
13 - Specify Plane as "XC-YC Plane" (Z - Axis)
14 - Set Plane Location:
>Start = -10000mm
>End = -10000mm
>Step = -100mm
15 - OK
Now that we are all on the same page with the process, below is a journal file I created to perform this task with the push of a button. I like the results but, there are a few issues I would like to correct. Any suggestions are welcome.
Issue No. 1 - I want to limit the selection to only what is visible (same as ). Current Journal will section all objects. Even those on hidden layers.
Issue No. 2 - It seems very inefficient for the task performed (Sloppy).
' NX 6.0.3.6
' Journal created by JohnBC on Tue Oct 02 12:15:14 2012 Eastern Daylight Time
'
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->Curve from Bodies->Section...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim nullFeatures_Feature As Features.Feature = Nothing
Dim sectionCurveBuilder1 As Features.SectionCurveBuilder
sectionCurveBuilder1 = workPart.Features.CreateSectionCurveBuilder(nullFeatures_Feature)
Dim origin1 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal1 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane1 As Plane
plane1 = workPart.Planes.CreatePlane(origin1, normal1, SmartObject.UpdateOption.WithinModeling)
Dim section1 As Section
section1 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim unit1 As Unit = CType(workPart.UnitCollection.FindObject("Inch"), Unit)
Dim expression1 As Expression
expression1 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim section2 As Section
section2 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression2 As Expression
expression2 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim origin2 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal2 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane2 As Plane
plane2 = workPart.Planes.CreatePlane(origin2, normal2, SmartObject.UpdateOption.WithinModeling)
sectionCurveBuilder1.BasePlane = plane2
Dim section3 As Section
section3 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression3 As Expression
expression3 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim section4 As Section
section4 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression4 As Expression
expression4 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
sectionCurveBuilder1.ChordalTolerance = 0.001
sectionCurveBuilder1.Tolerance = 0.001
sectionCurveBuilder1.Type = Features.SectionCurveBuilder.PlaneType.Parallel
sectionCurveBuilder1.StartDistance = -393.700787401575
sectionCurveBuilder1.EndDistance = 393.70078740157
sectionCurveBuilder1.StepDistance = 3.93700787401575
sectionCurveBuilder1.Associative = False
theSession.SetUndoMarkName(markId1, "Section Curve Dialog")
section1.DistanceTolerance = 0.001
section1.ChainingTolerance = 0.00095
section2.DistanceTolerance = 0.001
section2.ChainingTolerance = 0.00095
section3.DistanceTolerance = 0.001
section3.ChainingTolerance = 0.00095
section4.DistanceTolerance = 0.001
section4.ChainingTolerance = 0.00095
section1.DistanceTolerance = 0.001
section1.ChainingTolerance = 0.00095
section2.DistanceTolerance = 0.001
section2.ChainingTolerance = 0.00095
section3.DistanceTolerance = 0.001
section3.ChainingTolerance = 0.00095
section4.DistanceTolerance = 0.001
section4.ChainingTolerance = 0.00095
' ----------------------------------------------
' Menu: Edit->Selection->Select All
' ----------------------------------------------
Dim objects1() As DisplayableObject = theSession.Parts.Work.Bodies.ToArray()
Dim added1 As Boolean
added1 = sectionCurveBuilder1.ObjectsToSection.Add(objects1)
Dim geom1(-1) As NXObject
plane2.SetGeometry (geom1)
plane2.SetMethod (PlaneTypes.MethodType.FixedX)
Dim geom2(-1) As NXObject
plane2.SetGeometry (geom2)
Dim origin3 As Point3d = New Point3d(0.0, 0.0, 0.0)
plane2.Origin = origin3
Dim normal3 As Vector3d = New Vector3d(1.0, 0.0, 0.0)
plane2.Normal = normal3
plane2.SetAlternate (PlaneTypes.AlternateType.One)
plane2.Evaluate()
sectionCurveBuilder1.StartDistance = -393.700787401575
sectionCurveBuilder1.EndDistance = 393.700787401575
sectionCurveBuilder1.StepDistance = 3.93700787401575
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Section Curve")
Dim nXObject1 As NXObject
nXObject1 = sectionCurveBuilder1.Commit()
Dim objects2() As NXObject
objects2 = sectionCurveBuilder1.GetCommittedObjects()
theSession.DeleteUndoMark(markId2, Nothing)
theSession.SetUndoMarkName(markId1, "Section Curve")
sectionCurveBuilder1.Destroy()
section2.Destroy()
section4.Destroy()
workPart.Expressions.Delete (expression2)
plane1.DestroyPlane()
workPart.Expressions.Delete (expression4)
plane2.DestroyPlane()
section1.Destroy()
section3.Destroy()
workPart.Expressions.Delete (expression1)
workPart.Expressions.Delete (expression3)
Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim sectionCurveBuilder2 As Features.SectionCurveBuilder
sectionCurveBuilder2 = workPart.Features.CreateSectionCurveBuilder(nullFeatures_Feature)
Dim origin4 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal4 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane3 As Plane
plane3 = workPart.Planes.CreatePlane(origin4, normal4, SmartObject.UpdateOption.WithinModeling)
Dim section5 As Section
section5 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression5 As Expression
expression5 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim section6 As Section
section6 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression6 As Expression
expression6 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim origin5 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal5 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane4 As Plane
plane4 = workPart.Planes.CreatePlane(origin5, normal5, SmartObject.UpdateOption.WithinModeling)
sectionCurveBuilder2.BasePlane = plane4
Dim section7 As Section
section7 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression7 As Expression
expression7 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim section8 As Section
section8 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression8 As Expression
expression8 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
sectionCurveBuilder2.ChordalTolerance = 0.001
sectionCurveBuilder2.Tolerance = 0.001
sectionCurveBuilder2.Type = Features.SectionCurveBuilder.PlaneType.Parallel
sectionCurveBuilder2.StartDistance = -393.700787401575
sectionCurveBuilder2.EndDistance = 393.700787401575
sectionCurveBuilder2.StepDistance = 3.93700787401575
sectionCurveBuilder2.Associative = False
theSession.SetUndoMarkName(markId3, "Section Curve Dialog")
section5.DistanceTolerance = 0.001
section5.ChainingTolerance = 0.00095
section6.DistanceTolerance = 0.001
section6.ChainingTolerance = 0.00095
section7.DistanceTolerance = 0.001
section7.ChainingTolerance = 0.00095
section8.DistanceTolerance = 0.001
section8.ChainingTolerance = 0.00095
section5.DistanceTolerance = 0.001
section5.ChainingTolerance = 0.00095
section6.DistanceTolerance = 0.001
section6.ChainingTolerance = 0.00095
section7.DistanceTolerance = 0.001
section7.ChainingTolerance = 0.00095
section8.DistanceTolerance = 0.001
section8.ChainingTolerance = 0.00095
' ----------------------------------------------
' Menu: Edit->Selection->Select All
' ----------------------------------------------
Dim objects3() As DisplayableObject = theSession.Parts.Work.Bodies.ToArray()
Dim added2 As Boolean
added2 = sectionCurveBuilder2.ObjectsToSection.Add(objects3)
Dim geom3(-1) As NXObject
plane4.SetGeometry (geom3)
plane4.SetMethod (PlaneTypes.MethodType.FixedY)
Dim geom4(-1) As NXObject
plane4.SetGeometry (geom4)
Dim origin6 As Point3d = New Point3d(0.0, 0.0, 0.0)
plane4.Origin = origin6
Dim normal6 As Vector3d = New Vector3d(0.0, 1.0, 0.0)
plane4.Normal = normal6
plane4.SetAlternate (PlaneTypes.AlternateType.One)
plane4.Evaluate()
Dim markId4 As Session.UndoMarkId
markId4 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Section Curve")
Dim nXObject2 As NXObject
nXObject2 = sectionCurveBuilder2.Commit()
Dim objects4() As NXObject
objects4 = sectionCurveBuilder2.GetCommittedObjects()
theSession.DeleteUndoMark(markId4, Nothing)
theSession.SetUndoMarkName(markId3, "Section Curve")
sectionCurveBuilder2.Destroy()
section6.Destroy()
section8.Destroy()
workPart.Expressions.Delete (expression6)
plane3.DestroyPlane()
workPart.Expressions.Delete (expression8)
plane4.DestroyPlane()
section5.Destroy()
section7.Destroy()
workPart.Expressions.Delete (expression5)
workPart.Expressions.Delete (expression7)
Dim markId5 As Session.UndoMarkId
markId5 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim sectionCurveBuilder3 As Features.SectionCurveBuilder
sectionCurveBuilder3 = workPart.Features.CreateSectionCurveBuilder(nullFeatures_Feature)
Dim origin7 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal7 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane5 As Plane
plane5 = workPart.Planes.CreatePlane(origin7, normal7, SmartObject.UpdateOption.WithinModeling)
Dim section9 As Section
section9 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression9 As Expression
expression9 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim section10 As Section
section10 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression10 As Expression
expression10 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim origin8 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal8 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane6 As Plane
plane6 = workPart.Planes.CreatePlane(origin8, normal8, SmartObject.UpdateOption.WithinModeling)
sectionCurveBuilder3.BasePlane = plane6
Dim section11 As Section
section11 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression11 As Expression
expression11 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim section12 As Section
section12 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression12 As Expression
expression12 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
sectionCurveBuilder3.ChordalTolerance = 0.001
sectionCurveBuilder3.Tolerance = 0.001
sectionCurveBuilder3.Type = Features.SectionCurveBuilder.PlaneType.Parallel
sectionCurveBuilder3.StartDistance = -393.700787401575
sectionCurveBuilder3.EndDistance = 393.700787401575
sectionCurveBuilder3.StepDistance = 3.93700787401575
sectionCurveBuilder3.Associative = False
theSession.SetUndoMarkName(markId5, "Section Curve Dialog")
section9.DistanceTolerance = 0.001
section9.ChainingTolerance = 0.00095
section10.DistanceTolerance = 0.001
section10.ChainingTolerance = 0.00095
section11.DistanceTolerance = 0.001
section11.ChainingTolerance = 0.00095
section12.DistanceTolerance = 0.001
section12.ChainingTolerance = 0.00095
section9.DistanceTolerance = 0.001
section9.ChainingTolerance = 0.00095
section10.DistanceTolerance = 0.001
section10.ChainingTolerance = 0.00095
section11.DistanceTolerance = 0.001
section11.ChainingTolerance = 0.00095
section12.DistanceTolerance = 0.001
section12.ChainingTolerance = 0.00095
' ----------------------------------------------
' Menu: Edit->Selection->Select All
' ----------------------------------------------
Dim objects5() As DisplayableObject = theSession.Parts.Work.Bodies.ToArray()
Dim added3 As Boolean
added3 = sectionCurveBuilder3.ObjectsToSection.Add(objects5)
Dim geom5(-1) As NXObject
plane6.SetGeometry (geom5)
plane6.SetMethod (PlaneTypes.MethodType.FixedZ)
Dim geom6(-1) As NXObject
plane6.SetGeometry (geom6)
Dim origin9 As Point3d = New Point3d(0.0, 0.0, 0.0)
plane6.Origin = origin9
Dim normal9 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
plane6.Normal = normal9
plane6.SetAlternate (PlaneTypes.AlternateType.One)
plane6.Evaluate()
Dim markId6 As Session.UndoMarkId
markId6 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Section Curve")
Dim nXObject3 As NXObject
nXObject3 = sectionCurveBuilder3.Commit()
Dim objects6() As NXObject
objects6 = sectionCurveBuilder3.GetCommittedObjects()
theSession.DeleteUndoMark(markId6, Nothing)
theSession.SetUndoMarkName(markId5, "Section Curve")
sectionCurveBuilder3.Destroy()
section10.Destroy()
section12.Destroy()
workPart.Expressions.Delete (expression10)
plane5.DestroyPlane()
workPart.Expressions.Delete (expression12)
plane6.DestroyPlane()
section9.Destroy()
section11.Destroy()
workPart.Expressions.Delete (expression9)
workPart.Expressions.Delete (expression11)
Dim markId7 As Session.UndoMarkId
markId7 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim sectionCurveBuilder4 As Features.SectionCurveBuilder
sectionCurveBuilder4 = workPart.Features.CreateSectionCurveBuilder(nullFeatures_Feature)
Dim origin10 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal10 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane7 As Plane
plane7 = workPart.Planes.CreatePlane(origin10, normal10, SmartObject.UpdateOption.WithinModeling)
Dim section13 As Section
section13 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression13 As Expression
expression13 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim section14 As Section
section14 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression14 As Expression
expression14 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim origin11 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal11 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane8 As Plane
plane8 = workPart.Planes.CreatePlane(origin11, normal11, SmartObject.UpdateOption.WithinModeling)
sectionCurveBuilder4.BasePlane = plane8
Dim section15 As Section
section15 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression15 As Expression
expression15 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim section16 As Section
section16 = workPart.Sections.CreateSection(0.00095, 0.001, 0.5)
Dim expression16 As Expression
expression16 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
sectionCurveBuilder4.ChordalTolerance = 0.001
sectionCurveBuilder4.Tolerance = 0.001
sectionCurveBuilder4.Type = Features.SectionCurveBuilder.PlaneType.Parallel
sectionCurveBuilder4.StartDistance = -393.700787401575
sectionCurveBuilder4.EndDistance = 393.700787401575
sectionCurveBuilder4.StepDistance = 3.93700787401575
sectionCurveBuilder4.Associative = False
theSession.SetUndoMarkName(markId7, "Section Curve Dialog")
section13.DistanceTolerance = 0.001
section13.ChainingTolerance = 0.00095
section14.DistanceTolerance = 0.001
section14.ChainingTolerance = 0.00095
section15.DistanceTolerance = 0.001
section15.ChainingTolerance = 0.00095
section16.DistanceTolerance = 0.001
section16.ChainingTolerance = 0.00095
section13.DistanceTolerance = 0.001
section13.ChainingTolerance = 0.00095
section14.DistanceTolerance = 0.001
section14.ChainingTolerance = 0.00095
section15.DistanceTolerance = 0.001
section15.ChainingTolerance = 0.00095
section16.DistanceTolerance = 0.001
section16.ChainingTolerance = 0.00095
sectionCurveBuilder4.Destroy()
section14.Destroy()
section16.Destroy()
workPart.Expressions.Delete (expression14)
workPart.Expressions.Delete (expression16)
section13.Destroy()
section15.Destroy()
workPart.Expressions.Delete (expression13)
workPart.Expressions.Delete (expression15)
theSession.UndoToMark(markId7, Nothing)
theSession.DeleteUndoMark(markId7, Nothing)
workPart.FacetedBodies.DeleteTemporaryFacesAndEdges()
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module
Enjoy the Journal if it pertains to you, and let me know if there are any suggestions.
Regards,
Singsonite
RE: Making 100mm section curves for X, Y, Z on Visible Objects
Correction to post...
Issue No. 1 - I want to limit the selection to only what is visible (same as Select All).
Singsonite
re: section curves
Below is some code to create the section curves. It is mostly just a cleanup of the recorded code. We could make it more concise by creating a subroutine or function and passing in the plane we want to section rather than running through very similar code 3 times, but it works...
[vbnet]
Option Strict Off
Imports System
Imports System.Collections.Generic
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
'start, end, and step distances in mm
Dim sectionStart As Double = -10000
Dim sectionEnd As Double = 10000
Dim sectionStep As Double = 100
'tolerances in mm
Dim myTolerance As Double = 0.0254
Dim myChordalTolerance As Double = 0.0254
Dim partUnits As Integer = workPart.PartUnits
'0 = inch
'1 = metric
'if in inch file, convert distances and tolerances to inches
If partUnits = 0 Then
sectionStart /= 25.4
sectionEnd /= 25.4
sectionStep /= 25.4
myTolerance /= 25.4
myChordalTolerance /= 25.4
End If
'collect the visible objects
Dim myVisibleObjects As New List(Of DisplayableObject)
Dim layerState As NXOpen.Layer.State
For Each tempObj As DisplayableObject In workPart.Bodies.ToArray
layerState = workPart.Layers.GetState(tempObj.Layer)
If (Not tempObj.IsBlanked) AndAlso (layerState = Layer.State.Selectable Or layerState = Layer.State.WorkLayer) Then
myVisibleObjects.Add(tempObj)
End If
Next
If myVisibleObjects.Count = 0 Then
Exit Sub
End If
' ----------------------------------------------
' Menu: Insert->Curve from Bodies->Section...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim nullFeatures_Feature As Features.Feature = Nothing
Dim sectionCurveBuilder1 As Features.SectionCurveBuilder
sectionCurveBuilder1 = workPart.Features.CreateSectionCurveBuilder(nullFeatures_Feature)
Dim origin2 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal2 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane2 As Plane
plane2 = workPart.Planes.CreatePlane(origin2, normal2, SmartObject.UpdateOption.WithinModeling)
sectionCurveBuilder1.BasePlane = plane2
sectionCurveBuilder1.ChordalTolerance = myChordalTolerance
sectionCurveBuilder1.Tolerance = myTolerance
sectionCurveBuilder1.Type = Features.SectionCurveBuilder.PlaneType.Parallel
sectionCurveBuilder1.StartDistance = sectionStart
sectionCurveBuilder1.EndDistance = sectionEnd
sectionCurveBuilder1.StepDistance = sectionStep
sectionCurveBuilder1.Associative = False
theSession.SetUndoMarkName(markId1, "Section Curve Dialog")
Dim added1 As Boolean
added1 = sectionCurveBuilder1.ObjectsToSection.Add(myVisibleObjects.ToArray)
plane2.SetMethod(PlaneTypes.MethodType.FixedX)
Dim geom2(-1) As NXObject
plane2.SetGeometry(geom2)
Dim origin3 As Point3d = New Point3d(0.0, 0.0, 0.0)
plane2.Origin = origin3
Dim normal3 As Vector3d = New Vector3d(1.0, 0.0, 0.0)
plane2.Normal = normal3
plane2.SetAlternate(PlaneTypes.AlternateType.One)
plane2.Evaluate()
Try
Dim nXObject1 As NXObject
nXObject1 = sectionCurveBuilder1.Commit()
Dim objects2() As NXObject
objects2 = sectionCurveBuilder1.GetCommittedObjects()
Catch ex As Exception
Finally
theSession.SetUndoMarkName(markId1, "Section Curve X")
sectionCurveBuilder1.Destroy()
plane2.DestroyPlane()
End Try
Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim sectionCurveBuilder2 As Features.SectionCurveBuilder
sectionCurveBuilder2 = workPart.Features.CreateSectionCurveBuilder(nullFeatures_Feature)
Dim origin5 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal5 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane4 As Plane
plane4 = workPart.Planes.CreatePlane(origin5, normal5, SmartObject.UpdateOption.WithinModeling)
sectionCurveBuilder2.BasePlane = plane4
sectionCurveBuilder2.ChordalTolerance = myChordalTolerance
sectionCurveBuilder2.Tolerance = myTolerance
sectionCurveBuilder2.Type = Features.SectionCurveBuilder.PlaneType.Parallel
sectionCurveBuilder2.StartDistance = sectionStart
sectionCurveBuilder2.EndDistance = sectionEnd
sectionCurveBuilder2.StepDistance = sectionStep
sectionCurveBuilder2.Associative = False
theSession.SetUndoMarkName(markId3, "Section Curve Dialog")
Dim added2 As Boolean
added2 = sectionCurveBuilder2.ObjectsToSection.Add(myVisibleObjects.ToArray)
plane4.SetMethod(PlaneTypes.MethodType.FixedY)
Dim geom4(-1) As NXObject
plane4.SetGeometry(geom4)
Dim origin6 As Point3d = New Point3d(0.0, 0.0, 0.0)
plane4.Origin = origin6
Dim normal6 As Vector3d = New Vector3d(0.0, 1.0, 0.0)
plane4.Normal = normal6
plane4.SetAlternate(PlaneTypes.AlternateType.One)
plane4.Evaluate()
Try
Dim nXObject2 As NXObject
nXObject2 = sectionCurveBuilder2.Commit()
Dim objects4() As NXObject
objects4 = sectionCurveBuilder2.GetCommittedObjects()
Catch ex As Exception
Finally
theSession.SetUndoMarkName(markId3, "Section Curve Y")
sectionCurveBuilder2.Destroy()
plane4.DestroyPlane()
End Try
Dim markId5 As Session.UndoMarkId
markId5 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim sectionCurveBuilder3 As Features.SectionCurveBuilder
sectionCurveBuilder3 = workPart.Features.CreateSectionCurveBuilder(nullFeatures_Feature)
Dim origin8 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal8 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane6 As Plane
plane6 = workPart.Planes.CreatePlane(origin8, normal8, SmartObject.UpdateOption.WithinModeling)
sectionCurveBuilder3.BasePlane = plane6
sectionCurveBuilder3.ChordalTolerance = myChordalTolerance
sectionCurveBuilder3.Tolerance = myTolerance
sectionCurveBuilder3.Type = Features.SectionCurveBuilder.PlaneType.Parallel
sectionCurveBuilder3.StartDistance = sectionStart
sectionCurveBuilder3.EndDistance = sectionEnd
sectionCurveBuilder3.StepDistance = sectionStep
sectionCurveBuilder3.Associative = False
theSession.SetUndoMarkName(markId5, "Section Curve Dialog")
Dim added3 As Boolean
added3 = sectionCurveBuilder3.ObjectsToSection.Add(myVisibleObjects.ToArray)
plane6.SetMethod(PlaneTypes.MethodType.FixedZ)
Dim geom6(-1) As NXObject
plane6.SetGeometry(geom6)
Dim origin9 As Point3d = New Point3d(0.0, 0.0, 0.0)
plane6.Origin = origin9
Dim normal9 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
plane6.Normal = normal9
plane6.SetAlternate(PlaneTypes.AlternateType.One)
plane6.Evaluate()
Try
Dim nXObject3 As NXObject
nXObject3 = sectionCurveBuilder3.Commit()
Dim objects6() As NXObject
objects6 = sectionCurveBuilder3.GetCommittedObjects()
Catch ex As Exception
Finally
theSession.SetUndoMarkName(markId5, "Section Curve Z")
sectionCurveBuilder3.Destroy()
plane6.DestroyPlane()
workPart.FacetedBodies.DeleteTemporaryFacesAndEdges()
End Try
End Sub
End Module[/vbnet]
re: Section Curves
Excellent! Works brilliantly!
Thank you,
Singsonite