×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

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

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

(OP)

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"

(OP)
cowski
You're right
I made the same mistake second time

Thank you

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

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.

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

(OP)
petulf

Thank you for your good notice

Greetings

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources