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

Start a new feature after switching a module (where that feature is compatible)

$
0
0

I was trying to Start a new feature after switching a module. for my case it was to start 'Move Face' after switching to 'Modeling' module. But I wanted the journal to stop after it just start the 'move face' command and stay there (for user to start working). So I recorded the journal for starting 'Move face' command. And added the coded to switch to modeling module. But when I play the edited journal, it just switches module, and does not start the moveface feature. Please suggest where I am doing wrong and what can be the solution. Thanks.

Imports System
Imports NXOpen
Imports NXOpen.UF
 
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
 
        ' ----------------------------------------------
        '   Switch to MODELING Module
        ' ----------------------------------------------
 
 
        Dim theUfSession As UFSession = UFSession.GetUFSession
        ' Dim lw As ListingWindow = theSession.ListingWindow
        Dim theUI As UI = UI.GetUI
        If IsNothing(theSession.Parts.Work) Then
            'active part required
            Return
        End If
 
        Dim currentModuleId As Integer
        theUfSession.UF.AskApplicationModule(currentModuleId)
 
        Select Case currentModuleId
            Case Is = UFConstants.UF_APP_MODELING
                '':::: take no action ::::
            Case Else
                theUI.MenuBarManager.ApplicationSwitchRequest("UG_APP_MODELING")
        End Select
 
 
' ----------------------------------------------
'   Menu: Insert->Synchronous Modeling->Move Face...
' ----------------------------------------------
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
 
Dim nullNXOpen_Features_AdmMoveFace As NXOpen.Features.AdmMoveFace = Nothing
 
Dim admMoveFaceBuilder1 As NXOpen.Features.AdmMoveFaceBuilder = Nothing
admMoveFaceBuilder1 = workPart.Features.CreateAdmMoveFaceBuilder(nullNXOpen_Features_AdmMoveFace)
 
admMoveFaceBuilder1.FaceToMove.RelationScope = 511
 
admMoveFaceBuilder1.Motion.DistanceAngle.OrientXpress.AxisOption = NXOpen.GeometricUtilities.OrientXpressBuilder.Axis.Passive
 
admMoveFaceBuilder1.Motion.DistanceAngle.OrientXpress.PlaneOption = NXOpen.GeometricUtilities.OrientXpressBuilder.Plane.Passive
 
admMoveFaceBuilder1.Motion.AlongCurveAngle.AlongCurve.IsPercentUsed = True
 
admMoveFaceBuilder1.Motion.AlongCurveAngle.AlongCurve.Expression.RightHandSide = "0"
 
admMoveFaceBuilder1.Motion.AlongCurveAngle.AlongCurve.Expression.RightHandSide = "0"
 
admMoveFaceBuilder1.Motion.OrientXpress.AxisOption = NXOpen.GeometricUtilities.OrientXpressBuilder.Axis.Passive
 
admMoveFaceBuilder1.Motion.OrientXpress.PlaneOption = NXOpen.GeometricUtilities.OrientXpressBuilder.Plane.Passive
 
admMoveFaceBuilder1.FaceToMove.CoplanarEnabled = False
 
admMoveFaceBuilder1.FaceToMove.CoplanarAxesEnabled = False
 
admMoveFaceBuilder1.FaceToMove.CoaxialEnabled = False
 
admMoveFaceBuilder1.FaceToMove.EqualDiameterEnabled = False
 
admMoveFaceBuilder1.FaceToMove.TangentEnabled = False
 
admMoveFaceBuilder1.FaceToMove.SymmetricEnabled = False
 
admMoveFaceBuilder1.FaceToMove.OffsetEnabled = False
 
admMoveFaceBuilder1.FaceToMove.UseFaceBrowse = True
 
admMoveFaceBuilder1.Motion.DeltaEnum = NXOpen.GeometricUtilities.ModlMotion.Delta.ReferenceAcsWorkPart
 
theSession.SetUndoMarkName(markId1, "Move Face Dialog")
 
' ----------------------------------------------
'   Menu: Tools->Journal->Pause Recording
' ----------------------------------------------
 
End Sub
End Module

Viewing all articles
Browse latest Browse all 787

Trending Articles



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