×
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

NXOpen AssembliesGeneralPropertiesBuilder

NXOpen AssembliesGeneralPropertiesBuilder

NXOpen AssembliesGeneralPropertiesBuilder

(OP)
Hi all together,

i try to find a way to syncron the part attributes to the assembly.

In this case i found AssembliesGeneralPropertiesBuilder and tried out the following code but it doesn´t work.

CODE --> vb

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

RE: NXOpen AssembliesGeneralPropertiesBuilder

For anyone else interested, some working code can be found here.

www.nxjournaling.com

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