Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX10 journal not showing dialog box 1

Status
Not open for further replies.

bongoman

Mechanical
Sep 14, 2006
78
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
 
Replies continue below

Recommended for you

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
 
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
 
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
 
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
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor