Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Journal to select endpoints

Status
Not open for further replies.

zyxcba

Mechanical
Joined
Aug 12, 2013
Messages
4
Location
US
I'd like to create a journal in NX 7.5 that makes several arcs and then connects their endpoints to create a profile. I wrote a journal to create the arcs (simplified version below, the final version will have hundreds) but since I don't know exact coordinates of the arc endpoints, I haven't figured out a way to create lines connecting the arcs. Is there a way to designate the endpoint of an arc in a journal without the user selecting it? 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

Dim angleStart As Double
angleStart = 0

Dim ptCenter As New Point3d(0, 0, 0)

Dim arcStep As Double
arcStep = 0.4

Do

DrawArc(angleStart, angleStart + arcStep, 4, ptCenter)

angleStart = angleStart + arcStep + 0.2

DrawArc(angleStart, angleStart + arcStep, 3, ptCenter)

angleStart = angleStart + arcStep + 0.2
arcStep = arcStep + 0.1

Loop Until angleStart > Math.pi

End Sub

Sub DrawArc(ByVal arcStart As Double, ByVal arcEnd As Double, ByVal radius As Double, ByVal ptCenter As Point3d)

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display

Dim nxMatrix1 As NXMatrix = CType(workPart.NxMatrices.FindObject("WCS"),NXMatrix)

Dim arc1 As Arc
arc1 = workPart.Curves.CreateArc(ptCenter, nxMatrix1, radius, arcStart, arcEnd)

End Sub

End Module
 
That's amazing, thank you so much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top