×
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

NX10 journal not showing dialog box

NX10 journal not showing dialog box

NX10 journal not showing dialog box

(OP)
Hi All,

I'm trying to record a journal to display "derived curve - isoparametric curve" which has a green dot meaning it's a supported command. It records fine but when I try to play it back the dialog box does not display on screen. Nothing happens. Does anyone no how to get this working.

CODE:

Option Strict Off
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

' ----------------------------------------------
' Menu: Insert->Derived Curve->Isoparametric Curve...
' ----------------------------------------------
Dim markId1 As NXOpen.Session.UndoMarkId
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")

Dim nullNXOpen_Features_IsoparametricCurves As NXOpen.Features.IsoparametricCurves = Nothing


If Not workPart.Preferences.Modeling.GetHistoryMode Then
Throw(New Exception("Create or edit of a Feature was recorded in History Mode but playback is in History-Free Mode."))
End If

Dim isoparametricCurvesBuilder1 As NXOpen.Features.IsoparametricCurvesBuilder
isoparametricCurvesBuilder1 = workPart.Features.CreateIsoparametricCurvesBuilder(nullNXOpen_Features_IsoparametricCurves)

isoparametricCurvesBuilder1.Direction = NXOpen.Features.IsoparametricCurvesBuilder.DirectionTypes.IsoV

isoparametricCurvesBuilder1.Number = 2

isoparametricCurvesBuilder1.IsSpacingEnabled = True

isoparametricCurvesBuilder1.Spacing = 50.0

isoparametricCurvesBuilder1.Associative = False

theSession.SetUndoMarkName(markId1, "Isoparametric Curve Dialog")

' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------

End Sub
End Module

Thanks,
Rick D

Win7 64 bit w/NX9.0.3.4 MP9 and NX10.0.3
Vericut 7.4

RE: NX10 journal not showing dialog box

Journals do not display the standard NX UI dialog box of the command that you are running.

www.nxjournaling.com

RE: NX10 journal not showing dialog box

(OP)
Thanks Cowski,

Haven't done a journal in a while and think I forgot that they need a selection method and simple dialog from within VB. Now if I can only get the selection to work.

Rick D

Win7 64 bit w/NX9.0.3.4 MP9 and NX10.0.3
Vericut 7.4

RE: NX10 journal not showing dialog box

Do you need to select faces, or something else?

www.nxjournaling.com

RE: NX10 journal not showing dialog box

(OP)
Hi Cowski,

Yes I need to select a cylindrical face (hole).

Thanks,
Rick D

Win7 64 bit w/NX9.0.3.4 MP9 and NX10.0.3
Vericut 7.4

RE: NX10 journal not showing dialog box

Below is one way to limit selection to cylindrical faces:

CODE

Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF

Module Module3

    Dim theSession As Session = Session.GetSession()
    Dim theUfSession As UFSession = UFSession.GetUFSession()
    Dim lw As ListingWindow = theSession.ListingWindow

    Sub Main()

        If IsNothing(theSession.Parts.BaseWork) Then
            'active part required
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Const undoMarkName As String = "NXJ journal"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

        Dim selFace As Face
        If SelectFace("Select a face", selFace) = Selection.Response.Cancel Then
            Return
        End If


        lw.WriteLine("face tag: " & selFace.Tag.ToString)
	if selFace.IsOccurrence then
	    lw.writeline("owning component: " & selFace.OwningComponent.DisplayName)
	    lw.writeline("component part file: " & selFace.OwningComponent.Prototype.OwningPart.FullPath)
	else
	    lw.writeline("owning part: " & selFace.OwningPart.FullPath)
	end if

        lw.Close()

    End Sub

    Function SelectFace(ByVal prompt As String, ByRef selObj As TaggedObject) As Selection.Response

        Dim theUI As UI = UI.GetUI
        Dim title As String = "Select a face"
        Dim includeFeatures As Boolean = False
        Dim keepHighlighted As Boolean = False
        Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
        Dim cursor As Point3d
        Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
        Dim selectionMask_array(0) As Selection.MaskTriple

        With selectionMask_array(0)
            .Type = UFConstants.UF_solid_type
            .SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_CYLINDRICAL_FACE

        End With

        Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt, _
         title, scope, selAction, _
         includeFeatures, keepHighlighted, selectionMask_array, _
         selObj, cursor)
        If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
            Return Selection.Response.Ok
        Else
            Return Selection.Response.Cancel
        End If

    End Function


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image immediately after execution within NX
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

    End Function

End Module 

www.nxjournaling.com

RE: NX10 journal not showing dialog box

(OP)
Thanks Cowski I will give it a try

Rick D

Win7 64 bit w/NX9.0.3.4 MP9 and NX10.0.3
Vericut 7.4

RE: NX10 journal not showing dialog box

(OP)
Hi Cowski,

Got this to work. A bit messy but working

Rick D



Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF


Module Module3


Public selFace As Face
Public cursor As Point3d


Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow





Sub Main()

If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If




Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
'lw.Open()



'Dim selFace As Face
If SelectFace("Select a face", selFace) = Selection.Response.Cancel Then
Return
End If


'lw.WriteLine("face tag: " & selFace.Tag.ToString)
'if selFace.IsOccurrence then
'lw.writeline("owning component: " & selFace.OwningComponent.DisplayName)
'lw.writeline("component part file: " & selFace.OwningComponent.Prototype.OwningPart.FullPath)
'else
'lw.writeline("owning part: " & selFace.OwningPart.FullPath)
'end if

'lw.Close()

'MsgBox("Here")


Dim nullNXOpen_Features_IsoparametricCurves As NXOpen.Features.IsoparametricCurves = Nothing

Dim isoparametricCurvesBuilder1 As NXOpen.Features.IsoparametricCurvesBuilder


isoparametricCurvesBuilder1 = workPart.Features.CreateIsoparametricCurvesBuilder(nullNXOpen_Features_IsoparametricCurves)

isoparametricCurvesBuilder1.Direction = NXOpen.Features.IsoparametricCurvesBuilder.DirectionTypes.IsoV

isoparametricCurvesBuilder1.Number = 2

isoparametricCurvesBuilder1.IsSpacingEnabled = True

isoparametricCurvesBuilder1.Spacing = 50.0

isoparametricCurvesBuilder1.Associative = False


Dim face1 As NXOpen.Face = selFace
Dim point1 As NXOpen.Point3d = cursor

isoparametricCurvesBuilder1.SelectObject.SetValue(face1, workPart.ModelingViews.WorkView, point1)

isoparametricCurvesBuilder1.UpdateIsoparametricCurves()

Dim nXObject1 As NXOpen.NXObject
nXObject1 = isoparametricCurvesBuilder1.Commit()

End Sub


Function SelectFace(ByVal prompt As String, ByRef selObj As TaggedObject) As Selection.Response

Dim theUI As UI = UI.GetUI
Dim title As String = "Select a face"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
'Dim cursor As Point3d
Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
Dim selectionMask_array(0) As Selection.MaskTriple

With selectionMask_array(0)
.Type = UFConstants.UF_solid_type
.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_CYLINDRICAL_FACE

End With

Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt, _
title, scope, selAction, _
includeFeatures, keepHighlighted, selectionMask_array, _
selObj, cursor)
If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If


End Function

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

End Function



'End Sub
End Module

Win7 64 bit w/NX9.0.3.4 MP9 and NX10.0.3
Vericut 7.4

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