Ehaviv
Computer
- Jul 2, 2003
- 1,012
Hi
This journal run OK in native mode. and I want to modify it so its work also in manager mod.
I tried as shown in bolt text but that fail to run.
Please help to make it run in manager.
Thank you in advanced.
This journal run OK in native mode. and I want to modify it so its work also in manager mod.
I tried as shown in bolt text but that fail to run.
Please help to make it run in manager.
Thank you in advanced.
Code:
' 010919_1654
Option Strict Off
'
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Module part_export_with_options
Dim cnt as Integer = 0
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim theUFSession As UFSession = UFSession.GetUFSession()
Dim abody() As TaggedObject = Nothing
Dim bodyTags As New List(Of Tag)
Dim options As UFPart.ExportOptions
Dim dp as Part = Nothing
Dim wp as Part = Nothing
Dim newExportParName As String = Nothing
Dim cnt As Integer = 0
Dim nowDateTime As String = Nothing
Dim sfxBnum As Integer
Dim rand As New Random()
Dim internal_part_name As String = Nothing
wp = theSession.Parts.Work
dp = theSession.Parts.display
nowDateTime = Format(Now, "_ddMMyy_hhmmss_")
sfxBnum = rand.Next(1000, 8000)
newExportParName = wp.FullPath.Replace(".prt", "_export" & nowDateTime & sfxBnum & ".prt") ' for native mode
[b] 'newExportParName = "DB/export" & nowDateTime & sfxBnum & "/-") ' 1 for manager mode
'Try
' ufs.UGmgr.ConvertNameFromCli(newExportParName, internal_part_name)
'Catch e As NXException
' lw.WriteFullLine("The Import process failed Message = " & e.Message)
'End Try
'newExportParName = internal_part_name ' 2 for manager mode
[/b]
If SelectBodies("select bodies", abody) = Selection.Response.Cancel Then
Return
End If
For Each temp As TaggedObject In abody
bodyTags.Add(temp.Tag)
Next
With options
.new_part = True
.params_mode = UFPart.ExportParamsMode.MaintainParams ' RemoveParams
.expression_mode = UFPart.ExportExpMode.CopyExpDeeply ' CopyExpShallowly
End With
theUFSession.Part.ExportWithOptions(newExportParName, _
bodyTags.ToArray.Length, bodyTags.ToArray, options)
End Sub
Function SelectBodies(ByVal prompt As String, ByRef selObj() As TaggedObject) As Selection.Response
Dim theUI As UI = UI.GetUI
Dim title As String = "Select one or more bodies"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
Dim selectionMask_array(0) As Selection.MaskTriple
With selectionMask_array(0)
.Type = UFConstants.UF_solid_type
.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_BODY
End With
Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObjects(prompt, _
title, scope, selAction, _
includeFeatures, keepHighlighted, selectionMask_array, selobj)
If resp = Selection.Response.Ok Then
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If
End Function
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Module