lklo
Industrial
- Nov 24, 2010
- 226
Hi gyus -
I was just testing upfront a comming project...
I need to be able to extract the Coordinates from a Point Measurement Feature in NX...
This should be quite straight forward - but seems NOT to be, for me.....
My approach is to cycle through each feature...
If the Feature Type is "Point Measurement", then simply do the Job of extract Point Value from Feature....
Maybe another approcah can be using the workparts MeasureManager...*???
Thanks...
Regards Lklo
I was just testing upfront a comming project...
I need to be able to extract the Coordinates from a Point Measurement Feature in NX...
This should be quite straight forward - but seems NOT to be, for me.....
My approach is to cycle through each feature...
If the Feature Type is "Point Measurement", then simply do the Job of extract Point Value from Feature....
Maybe another approcah can be using the workparts MeasureManager...*???
Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
'Imports NXOpen.Drawings
'Imports NXOpen.Assemblies
'Imports NXOpen.PDM
'Imports System.Collections
'Imports System.Collections.Generic
'Imports NXOpen.Annotations
'Imports System.Text
'Imports NXOpen.Utilities
'Imports System.Text.RegularExpressions
'Imports System.Diagnostics
'Imports NXOpen.Routing
Imports NXOpen.Features
Module Lkl_rename_My_MODULE
Dim theSession As Session = Session.GetSession()
Dim theUI As UI = UI.GetUI()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim ufs As UFSession = UFSession.GetUFSession()
Dim output_To_NXListingWindow As Boolean = True
Dim output_To_NXLogFile As Boolean = True
Dim FeaturesInPart As Features.FeatureCollection = workPart.Features
Sub Main()
ufs.Ui.ExitListingWindow() ' close windows before displaying it again
'START HERE
For Each myFeature As Feature In FeaturesInPart
If myFeature.FeatureType = "Point Measurement" Then
NX("Type: " & myFeature.FeatureType)
NX("Need a 3D point or similar - for this Point Measurement Feature")
End If
Next
End Sub
'=========================== NX LISTING WINDOW FUNCTION=======================================
Public Sub NX(ByVal input As String) '' output variable listwindow - just for building VB
If output_To_NXListingWindow Then
Dim displayPart As Part = theSession.Parts.Display
Dim lw As ListingWindow = theSession.ListingWindow()
lw.Open()
lw.WriteLine(input)
End If
End Sub
'===============================================================================================
'=========================== NX WRITE TO LOGFILE FUNCTION=======================================
Public Sub NX_log(ByVal input As String) '' output variable listwindow - just for building VB
If output_To_NXLogFile Then
theSession.LogFile.WriteLine(input)
End If
End Sub
'================================================================================================
'=========================== NX UNLOAD FUNCTION ================================================
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination ' typically used in Checkmate only
End Function
'================================================================================================
End Module
Thanks...
Regards Lklo