journal when compiling throw error "DeleteUserAttributes not belong to NXObject"
journal when compiling throw error "DeleteUserAttributes not belong to NXObject"
(OP)
Hi
The following journal run ok
but when compiling to dll throw this error
"DeleteUserAttributes not belong to NXObject"
and in nx85 reference show is belong
DeleteUserAttributes Method (type, option)
Namespaces ► NXOpen ► NXObject ► DeleteUserAttributes(NXObject.AttributeType,Update.Option)
The code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Utilities
Imports NXOpen.UF
Module delete_body_attributes
Sub Main()
Dim s As Session = Session.GetSession()
Dim lw As ListingWindow = s.ListingWindow()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim markId1 As Session.UndoMarkId
markId1 = s.SetUndoMark(Session.MarkVisibility.Visible, "Report Body Attributes")
lw.Open()
ufs.Ui.ExitListingWindow() ' Clear and close the window
For each body1 As Body in s.Parts.Display.Bodies
Dim body_object As NXObject = body1
Try
body_object.DeleteUserAttributes(NXObject.AttributeType.String, Update.Option.Now)
Catch ex As Exception
lw.WriteLine("Exception Error = " &ex.ToString())
End Try
Next
MsgBox("All Bodies String Attribute Type * Deleted * ")
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Module
The following journal run ok
but when compiling to dll throw this error
"DeleteUserAttributes not belong to NXObject"
and in nx85 reference show is belong
DeleteUserAttributes Method (type, option)
Namespaces ► NXOpen ► NXObject ► DeleteUserAttributes(NXObject.AttributeType,Update.Option)
The code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Utilities
Imports NXOpen.UF
Module delete_body_attributes
Sub Main()
Dim s As Session = Session.GetSession()
Dim lw As ListingWindow = s.ListingWindow()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim markId1 As Session.UndoMarkId
markId1 = s.SetUndoMark(Session.MarkVisibility.Visible, "Report Body Attributes")
lw.Open()
ufs.Ui.ExitListingWindow() ' Clear and close the window
For each body1 As Body in s.Parts.Display.Bodies
Dim body_object As NXObject = body1
Try
body_object.DeleteUserAttributes(NXObject.AttributeType.String, Update.Option.Now)
Catch ex As Exception
lw.WriteLine("Exception Error = " &ex.ToString())
End Try
Next
MsgBox("All Bodies String Attribute Type * Deleted * ")
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Module





RE: journal when compiling throw error "DeleteUserAttributes not belong to NXObject"
Side note: you do not need to convert the body object to type "NXObject", because the body object also has the .DeleteUserAttributes method.
www.nxjournaling.com
RE: journal when compiling throw error "DeleteUserAttributes not belong to NXObject"
Thank you cowski
I'm afraid That I'm doing a second time the same mistake that
You helped me to get out of it (I'l check it)
Yes you right in your Side note
Thank you
RE: journal when compiling throw error "DeleteUserAttributes not belong to NXObject"
You're right
I made the same mistake second time
Thank you
RE: journal when compiling throw error "DeleteUserAttributes not belong to NXObject"
RE: journal when compiling throw error "DeleteUserAttributes not belong to NXObject"
Thank you for your good notice
Greetings