Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 783

SynchronizeAttributes

$
0
0

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


Viewing all articles
Browse latest Browse all 783

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>