NXOpen - How to Determine if a part is already open
NXOpen - How to Determine if a part is already open
(OP)
Dear Forum,
I am looking for a snippet of NXOpen code to determine if a part is already open.
I use the following lines of code to initially open the part:
Dim part1 As NXOpen.BasePart
Dim partLoadStatus1 As NXOpen.PartLoadStatus
part1 = theSession.Parts.OpenBaseDisplay(mWorkingFolder & "\" & "example.prt", partLoadStatus1)
partLoadStatus1.Dispose()
If I run this code of a part is already open NX blows up. I need to first check whether the part is open in NX before opening.
I am looking for a snippet of NXOpen code to determine if a part is already open.
I use the following lines of code to initially open the part:
Dim part1 As NXOpen.BasePart
Dim partLoadStatus1 As NXOpen.PartLoadStatus
part1 = theSession.Parts.OpenBaseDisplay(mWorkingFolder & "\" & "example.prt", partLoadStatus1)
partLoadStatus1.Dispose()
If I run this code of a part is already open NX blows up. I need to first check whether the part is open in NX before opening.





RE: NXOpen - How to Determine if a part is already open
www.nxjournaling.com
RE: NXOpen - How to Determine if a part is already open
You can also use something like this:
((ufs.Part.IsLoaded(fileName))
CODE -->
If ((ufs.Part.IsLoaded(fileName)) <> 1) Then ufs.Part.OpenQuiet(fileName, tags, ls) 'openQuiet partTag = ufs.Part.AskPartTag(fileName) ufs.Assem.SetWorkPartQuietly(partTag, pre_tags) Else partTag = ufs.Part.AskPartTag(fileName) ' replaced "Displayed part" to "Quiet open part" ufs.Assem.SetWorkPartQuietly(partTag, pre_tags) End If