Submitted by HansHG on Wed, 03/18/2015 - 04:42
Forums:
Hello All,
I have a Problem with NXOpen to get the file name of a prt (master or idealized) in a fem file without having loaded it. It is visible in the GUI but not accessable via NXOPEN (leaf and fullpath works only when the file is already loaded).
Any suggestions?
Thanks
HansHG
Which functions ??
Which "leaf" and "fullpath" functions are you talking about? Can you show us your code, please.
details of question
The Journal below ist just a test script to ask for a property of a file which is not loaded. The relevant line is:
leaf = Session.parts.leaf
or could be
leaf = Session.parts.fullpath
which are methods of class baseparts.
Greetings HansHG
' NX 7.5.5.4
' Journal created by u8000558 on Fri Feb 27 17:25:10 2015 W. Europe Standard Time
'
Option Strict Off
Imports NXOpen
Imports System.Collections
Imports System
Imports System.IO
Imports System.Environment
Imports NXOpen.UF
Imports NXOpenUI
Imports NXOpen.Utilities
Imports NXOpen.CAE
Imports System.Windows.Forms
Imports System.Diagnostics
Module NXJournal
Sub Main
Dim theSession As Session = Session.GetSession()
Dim workFemPart As CAE.FemPart = CType(theSession.Parts.BaseWork, CAE.FemPart)
Dim displayFemPart As CAE.FemPart = CType(theSession.Parts.BaseDisplay, CAE.FemPart)
getProperties(displayFemPart)
End Sub
Sub getProperties(ByVal workFemPart As CAE.FemPart)
' get prt file from fem in NX
Dim theSession As Session = Session.GetSession()
Dim part1 As Part = CType(workFemPart.IdealizedPart, Part)
Dim leaf as String
leaf = Session.parts.leaf
Dim theUISession As UI = UI.GetUI
theUISession.NXMessageBox.Show("leaf", NXMessageBox.DialogType.Question, leaf)
End Sub
End Module
HansHG
re: associated CAD part
Try the .FullPathForAssociatedCadPart property.
Option Strict Off
Imports System
Imports NXOpen
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If
Dim workFemPart As CAE.FemPart = CType(theSession.Parts.BaseWork, CAE.FemPart)
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
lw.WriteLine("associated part: " & workFemPart.FullPathForAssociatedCadPart)
lw.Close()
End Sub
End Module
problem solved
Hello
thanks for that hint. I tried "FullPathForAssociatedCadPart" and it worked fine for me.
Many thanks and regards,
HansHG
HansHG