×
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

NX Journal ID Symbol GetAssociativity

NX Journal ID Symbol GetAssociativity

NX Journal ID Symbol GetAssociativity

(OP)
Hy at all,

i have a little problem with my Journal.
I have a drawing with a lot of id symbols created by the user manuel. Now i whant to modify the part is associated with the symbol.
There is no Attribute created to the part or somthimg else i can identify it. So i need to get it via the id symbol to create an attribute.


I tried it with the following code but didn´t work.

CODE --> vb

Imports System.Collections
Imports NXOpen
Imports NXOpen.Annotations
Imports NXOpen.UF
Public Class test
	' class members
	Private Shared theSession As Session
	Private Shared theUI As UI
	Private Shared theUfSession As UFSession
	Private Shared lw As ListingWindow

	Public Shared Function Main(args As String()) As Integer
		theSession = Session.GetSession()
		theUI = UI.GetUI()
		theUfSession = UFSession.GetUFSession()
		lw = theSession.ListingWindow

		Try
			Dim idCol As IdSymbolCollection = theSession.Parts.Work.Annotations.IdSymbols
			Dim ids As IdSymbol
			Dim iEnum1 As IEnumerator = idCol.GetEnumerator()
			iEnum1.Reset()
			While iEnum1.MoveNext()
				ids = DirectCast(iEnum1.Current, IdSymbol)
				lw.Open()
				lw.WriteLine(vbLf & "Symbol: " + ids.Tag.ToString())

				Dim idsb As IdSymbolBuilder = idCol.CreateIdSymbolBuilder(ids)
				lw.WriteLine(" Text: " + idsb.UpperText)
				idsb.Destroy()

				lw.WriteLine(" Number of Associativities: " + ids.NumberOfAssociativities)
				For i As Integer = 1 To ids.NumberOfAssociativities
					Dim assoc As Associativity = ids.GetAssociativity(i)
					Dim obj As NXObject = assoc.FirstObject
					lw.WriteLine(" Assoc No." + i + ": " + obj.ToString())
					lw.WriteLine("  Owning Part: " + obj.OwningPart.FullPath)
					If obj.IsOccurrence Then
						lw.WriteLine("  Owning Component: " + obj.OwningComponent.Name)
					End If
				Next
			End While
		Catch ex As NXOpen.NXException
			UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.[Error], ex.Message)
		End Try
		Return 0
	End Function

	Public Shared Function GetUnloadOption(arg As String) As Integer
		Return System.Convert.ToInt32(Session.LibraryUnloadOption.Immediately)
	End Function

End Class 

Thanks Hagen

RE: NX Journal ID Symbol GetAssociativity

There is some code here that you may find of interest:
http://nxjournaling.com/content/move-parts-list-ca...

The journal was written to work with "Pre-NX 8.5 Exact" drafting views. If you are using the newer "exact" drafting views, it may give incorrect or unexpected results in some situations (depending on what the ID symbol is attached to).

www.nxjournaling.com

RE: NX Journal ID Symbol GetAssociativity

(OP)
Hey cowski,

Sorry I forgot to write the version.

I'm using NX 9 and TC 10.

Now I don't know how to modify the code to get it working.
I started with nx journal a few days before.
It is hard to understand the net.ref.
Can you help me?

Thanks Hagen

RE: NX Journal ID Symbol GetAssociativity

(OP)
Hy cowski,

thanks for helping me.

I take the code from nxjournaling and modify it for me.
Now it works fine.

I also tried to get an account on nxjournaling but i never recived a mail. So i can not loggin.

Thanks Hagen

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