Zmiana w Journal-u
: 01 sty 2016, 22:37
Witam, w sieci znalazłem bardzo przydatny dla mnie journal ale chciałbym wprowadzić drobną zmianę niestety kompletnie nie znam się na VB.
Journal kopiuje do schowka współrzedne punktu jednak robi to w jeden lini a chciałbym aby współrzędne znajdowały się jedna pod drugą
Journal kopiuje do schowka współrzedne punktu jednak robi to w jeden lini a chciałbym aby współrzędne znajdowały się jedna pod drugą
Kod: Zaznacz cały
April 3, 2014
'select points on screen, copy information to clipboard
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports System.Windows.Forms
Imports NXOpen
Imports NXOpen.UF
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If
Dim workPart As Part = theSession.Parts.Work
Dim pointValues As New List(Of String)
Dim response1 As Integer = Nothing
Dim mode1() As Integer = {0, 0}
Dim pointDisplayMode As Integer = 0
Dim objectpoint(2) As Double
Do
theUfSession.Ui.LockUgAccess(NXOpen.UF.UFConstants.UF_UI_FROM_CUSTOM)
response1 = theUfSession.Ui.PointSubfunction("Select Point", mode1, pointDisplayMode, objectpoint)
theUfSession.Ui.UnlockUgAccess(NXOpen.UF.UFConstants.UF_UI_FROM_CUSTOM)
If response1 = 5 Then
Dim myPtVal As String = "X = " & objectpoint(0).ToString("N2") & " Y = " & objectpoint(1).ToString("N2") & " Z = " & objectpoint(2).ToString("N2")
If pointValues.Contains(myPtVal) Then
Exit Do
Else
pointValues.Add(myPtVal)
End If
End If
Loop Until response1 <> 5
Dim myStringBuilder As New Text.StringBuilder
For Each pt As String In pointValues
myStringBuilder.Append(pt)
myStringBuilder.AppendLine()
Next
Clipboard.SetText(myStringBuilder.ToString)
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image when the NX session terminates
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
'----Other unload options-------
'Unloads the image immediately after execution within NX
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
'Unloads the image explicitly, via an unload dialog
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
'-------------------------------
End Function
End Module