×
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

Make workpart through journal

Make workpart through journal

Make workpart through journal

(OP)
Dear all,

When I try to run this journal, it should make the subassembly as the workpart, before the message in the msgbox displays. I cannot make it work. The message displays before the subassembly becomes the workpart. Can anyone help me out here?

---------------------------------
' NX 11.0.0.33
' Journal created by spada on Mon Jan 23 20:52:55 2017 GTB Standard Time
'
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String)

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work

Dim displayPart As NXOpen.Part = theSession.Parts.Display

Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Make Work Part")

Dim component1 As NXOpen.Assemblies.Component = CType(workPart.ComponentAssembly.RootComponent.FindObject("COMPONENT SUBASM-A 1"), NXOpen.Assemblies.Component)

Dim partLoadStatus1 As NXOpen.PartLoadStatus = Nothing
theSession.Parts.SetWorkComponent(component1, NXOpen.PartCollection.RefsetOption.Entire, NXOpen.PartCollection.WorkComponentOption.Visible, partLoadStatus1)

workPart = theSession.Parts.Work ' SUBASM-A
partLoadStatus1.Dispose()
theSession.SetUndoMarkName(markId1, "Make Work Part")

' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
msgbox("This should display after the subassembly becomes workpart")
End Sub

End Module

RE: Make workpart through journal

I would try calling the .DoUpdate and/or the .UpdateDisplay methods after changing the work part and before displaying the message box.

www.nxjournaling.com

RE: Make workpart through journal

(OP)
Thank you cowski,

I managed to use DisplayPart.ModelingViews.WorkView.UpdateDisplay() but sometimes it seems to update the display to the first feature. I couldn't use the .DoUpdate method.

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