Zoes
Mechanical
- Sep 30, 2011
- 46
Hi,
Wondering how can I extend the code bellow to recognise all design features in a model?
Will be quite useful for a simple model to recognise that there is a block and then validate its dimensions for example.
Thank you in advance![[smile2] [smile2] [smile2]](/data/assets/smilies/smile2.gif)
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.BlockStyler
Imports NXOpen.UF
Module NXJournal
Sub Main
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim theSession As Session = Session.GetSession()
Dim theUI As NXOpen.UI = NXOpen.UI.GetUI()
Dim theLW As NXOpen.ListingWindow = theSession.ListingWindow()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim theNXMessageBox As NXMessageBox = theUI.NXMessageBox
Dim block1 As Features.Block = CType(workPart.Features.FindObject("BLOCK(1)"), Features.Block)
Dim block_found As Features.Block = block1
If block_found IsNot Nothing Then
theUI.NXMessageBox.Show("Track Block", NXMessageBox.DialogType.Information, "Block exists")
Else
theUI.NXMessageBox.Show("Track Block", NXMessageBox.DialogType.Information, "Block does not exists")
End If
End Sub
End Module
Wondering how can I extend the code bellow to recognise all design features in a model?
Will be quite useful for a simple model to recognise that there is a block and then validate its dimensions for example.
Thank you in advance
![[smile2] [smile2] [smile2]](/data/assets/smilies/smile2.gif)
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.BlockStyler
Imports NXOpen.UF
Module NXJournal
Sub Main
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim theSession As Session = Session.GetSession()
Dim theUI As NXOpen.UI = NXOpen.UI.GetUI()
Dim theLW As NXOpen.ListingWindow = theSession.ListingWindow()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim theNXMessageBox As NXMessageBox = theUI.NXMessageBox
Dim block1 As Features.Block = CType(workPart.Features.FindObject("BLOCK(1)"), Features.Block)
Dim block_found As Features.Block = block1
If block_found IsNot Nothing Then
theUI.NXMessageBox.Show("Track Block", NXMessageBox.DialogType.Information, "Block exists")
Else
theUI.NXMessageBox.Show("Track Block", NXMessageBox.DialogType.Information, "Block does not exists")
End If
End Sub
End Module