Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations Ron247 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

journal when compiling throw error "DeleteUserAttributes not belong to NXObject"

Status
Not open for further replies.

Ehaviv

Computer
Jul 2, 2003
1,012
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
 
Replies continue below

Recommended for you

If it runs as a journal but not as compiled code, I'd first check to make sure the project references the correct version of the NX dll files. If it references the NX 7.5 (or older) dll files, the .DeleteUserAttributes method won't be found.

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
 

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
 
cowski
You're right
I made the same mistake second time

Thank you
 
I avoid this problem by creating a project for each NX release within the solution where one project is the master and the others get linked source files. It is then possible to build the application for all target versions in one click without messing about with the references.
 
petulf

Thank you for your good notice

Greetings
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor