Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Assemblies
Module Intersect1
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
Dim ufs As UFSession = UFSession.GetUFSession()
lw.Open()
Dim myVectors(-1) As TaggedObject
If SelectVectors("Select Vectors", myVectors) = Selection.Response.Cancel Then
Return
End If
Dim mybody As Body = Nothing
Dim mystartpoint(2) As Double
Dim myintersectpoint(2) As Double
Dim myfaceparms(1) As Double
Dim intersectdata1 As NXOpen.UF.UFCurve.IntersectInfo = Nothing
Dim intersectfound1 As Integer = Nothing
For Each tempVector As Line In myVectors
lw.WriteLine("X "+tempVector.StartPoint.X.ToString)
lw.WriteLine("Y "+tempVector.StartPoint.Y.ToString)
lw.WriteLine("Z "+tempVector.StartPoint.Z.ToString)
Next
End Sub
Function SelectVectors(ByVal prompt As String, ByRef selObj() As TaggedObject) As Selection.Response
Dim theUI As UI = UI.GetUI
Dim title As String = "Select Vectors"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
Dim selectionMask_array(0) As Selection.MaskTriple
With selectionMask_array(0)
.Type = UFConstants.UF_line_type
.Subtype = 0
End With
Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObjects(prompt, _
title, scope, selAction, _
includeFeatures, keepHighlighted, selectionMask_array, _
selObj)
If resp = Selection.Response.Ok Then
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If
End Function
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image when the NX session terminates
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
End Function
End Module