Hy alltogether,
i tried to sync the Routing attributes from the part to the assembly.
It works pretty good if i use properties inside NX.
I recordet a Journal to see what happend and have a look into net.ref.
What i tried out is the following Code but it didn´t work.
Sub Main(ByVal args() As String)
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim cw As ComponentAssembly = workPart.ComponentAssembly
If Not IsNothing(cw.RootComponent) Then
For Each child As Component In cw.RootComponent.GetChildren()
Dim objects1(0) As NXObject
objects1(0) = child
Dim assembliesGeneralPropertiesBuilder1 As Assemblies.AssembliesGeneralPropertiesBuilder
assembliesGeneralPropertiesBuilder1 = workPart.PropertiesManager.CreateAssembliesGeneralPropertiesBuilder(objects1)
assembliesGeneralPropertiesBuilder1.SynchronizeAttributes()
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Komponente Eigenschaften")
theSession.DeleteUndoMark(markId2, Nothing)
Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Komponente Eigenschaften")
Dim nXObject1 As NXObject
nXObject1 = assembliesGeneralPropertiesBuilder1.Commit()
'workPart.PartPreviewMode = BasePart.PartPreview.None
Dim id1 As Session.UndoMarkId
id1 = theSession.GetNewestUndoMark(Session.MarkVisibility.Visible)
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(id1)
theSession.DeleteUndoMark(markId3, Nothing)
theSession.SetUndoMarkName(id1, "Komponente Eigenschaften")
assembliesGeneralPropertiesBuilder1.Destroy()
Next
End If
End Sub
Can somebody help please.
Thanks Hagen

re: synchronize attributes
I'm not familiar with the routing application. Do the routing attributes show up as part attributes or are they applied directly to the routing objects?
Yes, if you open item as
Yes, if you open item as display part or sync attributes you can see it under properties - attributes.
I work also with workpart.getuserattribute and everthing is fine.
If I reopen assembly and rightklick the part, choose property - attribute it is empty.
In this case I need to sync them to the assembly.
I hope I discribed it in the right way.
Thanks Hagen
NX 9 and Team Center 10
re: synchronize attributes
When you right click on a subassembly in the assembly navigator and choose: properties -> assembly -> synchronize subassembly properties, there are options for "layers", "display", and "attributes". Is this the same 'synchronize attributes' that you want to accomplish with the API?
Or did you have something else in mind?
Yes this is exactly what I
Yes this is exactly what I want to do.
NX 9 and Team Center 10
re: synchronize attributes
From what I can see, the "synchronize attributes" command is only valid to use on subassemblies. The code below looks for subassmeblies in the currently displayed part and runs the "synchronize attributes" command on them.
Thank you so much.
Thank you so much.
The code works great. The only thing is that you raise an exception if a subassembly is unload.
This is not important for me and i can solve my self if nessesary.
Is only an information if somebody else will use it.
Thanks Hagen
NX 9 and Team Center 10
re: synchronize attributes
Yes, I noticed that during my testing, but forgot to mention it in the description above. Thanks for the reminder.