Hallo met,
Du brauchst noch einen Dialog zur Positionsangabe, dessen Ergebnis dann dem PosPoint zugewiesen wird. Anbei ein Beispiel. Oder versuch' doch mal, während einer Positionsangabe ein Journal aufzuzeichnen.
Gruß, Michael
Option Strict Off
Imports System
Imports System.Windows.Forms
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Module specify_screen_position
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Sub Main()
Dim n As String = vbCrLf
Dim screenpos As Point3d
ufs.Ui.OpenListingWindow()
While SelectPoint(screenpos) = Selection.Response.Ok
ufs.Ui.WriteListingWindow("X:" & screenpos.X.ToString() & n & _
"Y:" & screenpos.Y.ToString() & n & _
"Z:" & screenpos.Z.ToString() & n & n)
End While
End Sub
' Prompts the user to select a position on the screen
Function SelectPoint(ByRef screenpos As Point3d) As Selection.Response
Dim view_tag As NXOpen.Tag
Dim point(2) As Double
Dim response As Integer
ufs.Ui.LockUgAccess(NXOpen.UF.UFConstants.UF_UI_FROM_CUSTOM)
Try
' Hier evtl. SpecifyScreenPosition ersetzen
ufs.Ui.SpecifyScreenPosition("Select location", _
Nothing, IntPtr.Zero, point, view_tag, response)
Finally
ufs.Ui.UnlockUgAccess(NXOpen.UF.UFConstants.UF_UI_FROM_CUSTOM)
End Try
If response <> NXOpen.UF.UFConstants.UF_UI_PICK_RESPONSE Then _
Return Selection.Response.Cancel
screenpos.X = point(0)
screenpos.Y = point(1)
screenpos.Z = point(2)
Dim viewTag As NXOpen.Tag = s.Parts.Work.Views.WorkView.Tag
Dim myColor As UFObj.DispProps
myColor.color = 186
ufs.Disp.DisplayTemporaryPoint(viewTag, UFDisp.ViewType.UseCursor, _
point, myColor, UFDisp.PolyMarker.Asterisk)
Return Selection.Response.Ok
End Function
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Module
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP