Ehaviv
Computer
- Jul 2, 2003
- 1,012
Hi
This statement ufs.Obj.DeleteObject(newCsys.Tag) Cause no error and no delete
can someone helpe.
after I the journal move the Csys to a new WCS location
I want to the delete the traling csys.
Thank you
This statement ufs.Obj.DeleteObject(newCsys.Tag) Cause no error and no delete
can someone helpe.
after I the journal move the Csys to a new WCS location
I want to the delete the traling csys.
Thank you
Code:
'
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports System.Windows.Forms
Module nxj_dynamic_csys_dialog_function
Sub Main (pattern_type() As String)
showDynamicCsysDialog
while ContinueOrRepeate() = 2 'Continue=1, Repeat=2
showDynamicCsysDialog
End while
End Sub
Sub showDynamicCsysDialog()
Dim s As NXOpen.Session = NXOpen.Session.GetSession()
'Dim workPart As NXOpen.Part = s.Parts.Work
Dim ufs As UFSession = UFSession.GetUFSession()
Dim displayPart As NXOpen.Part = s.Parts.Display
Dim theUI As UI = UI.GetUI()
Dim markId1 As NXOpen.Session.UndoMarkId
markId1 = s.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
If IsNothing(displayPart) Then
'active part required
Return
End If
'9 element orientation matrix of specified csys
'arrays are zero based
Dim myCsys(8) As Double
'3 element array: origin point of specified csys
Dim myOrigin(2) As Double
'tag variable used as input/output for the .SpecifyCsys method
'passing a null tag into the function uses the current WCS as the starting csys
Dim newCsysTag As Tag = Tag.Null
'variable to hold the user specified coordinate system
Dim newCsys As CartesianCoordinateSystem
Dim response As Integer
'If you want to know the option the user used to specify the csys, pass in a variable.
'The initial value of the variable will control the default option shown to the user.
'After the function returns, this variable will hold the actual option used.
'optional message to user
'MessageBox.Show("Orient manipulator to the desired location/orientation", _
'"Specify Coordinate System", MessageBoxButtons.OK, MessageBoxIcon.Information)
theUI.LockAccess()
'if you don't care what option was used to specify the csys, simply pass in an integer
'that specified the default method to show to the user
response = ufs.Ui.SpecifyCsys("Specify Desired Orientation", 5, myCsys, myOrigin, newCsysTag)
theUI.UnlockAccess()
If response = Selection.Response.Ok Then
'get CartesianCoordinateSystem object from tag
newCsys = Utilities.NXObjectManager.Get(newCsysTag)
displayPart.WCS.SetCoordinateSystem(newCsys)
Else
Return
End If
[b]ufs.Obj.DeleteObject(newCsys.Tag)[/b]
End Sub
Public Function ContinueOrRepeate() As Integer
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim titleString As String = "NX Manager Clone Assembly === By Elbaz Haviv"
Dim resp As Integer
Dim messages(0) As String
messages(0) = "Click Repeate to show dynamic Csys again" & vbCrLf & _
"Or Click Continue if WCS is set to bottom left corner" & vbCrLf & _
"and you are ready to select and mark components"
Dim but As UFUi.MessageButtons
but.button1 = True
but.label1 = "Continue"
but.response1 = 1
but.button2 = True
but.label2 = "Repeate Dynamic Csys"
but.response2 = 2
theUfSession.Ui.MessageDialog(titleString, UiMessageDialogType.UiMessageQuestion, _
messages, messages.Length, False, but, resp)
Return(resp)
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