I am looking for a solution to capture the values of perimeter and area contained in the face measurement feature and bounding box of flat solid.
Here is a little Journal I have written and I need help to store these values in variables x1 and x2. Also if there is a idea to get bounding box for parent feature, it will be welcome !
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Features
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Module MCH_Module
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = s.ListingWindow
Dim theSession As Session = Session.GetSession()
Sub Main()
If s.Parts.Work Is Nothing Then
MsgBox("Pas de Part Active !!!", MsgBoxStyle.Critical)
Exit Sub
End If
Dim wp As Part = s.Parts.Work
Dim face_measure As String
For Each fonction As Feature In wp.Features
'===========================================================
' FACE MEASUREMENT Feature
'===========================================================
If fonction.FeatureType = "FACE_MEASUREMENT" Then
ufs.Modl.AskFeatName(fonction.Tag, face_measure)
lw.WriteLine("measure feature tage = " & face_measure)
Dim unit1 As Unit = CType(wp.UnitCollection.FindObject("SquareMilliMeter"), Unit)
Dim unit2 As Unit = CType(wp.UnitCollection.FindObject("MilliMeter"), Unit)
'Dim x1, x2 As Double
...
...
'x1 = measure1.Area
'x2 = measure1.Perimeter
'lw.WriteLine( & measure1)
'lw.WriteLine("Perimeter :" & x2)
End If
Next
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module
Thanks in advance
moh23
NX8.5
Here is a little Journal I have written and I need help to store these values in variables x1 and x2. Also if there is a idea to get bounding box for parent feature, it will be welcome !
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Features
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Module MCH_Module
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = s.ListingWindow
Dim theSession As Session = Session.GetSession()
Sub Main()
If s.Parts.Work Is Nothing Then
MsgBox("Pas de Part Active !!!", MsgBoxStyle.Critical)
Exit Sub
End If
Dim wp As Part = s.Parts.Work
Dim face_measure As String
For Each fonction As Feature In wp.Features
'===========================================================
' FACE MEASUREMENT Feature
'===========================================================
If fonction.FeatureType = "FACE_MEASUREMENT" Then
ufs.Modl.AskFeatName(fonction.Tag, face_measure)
lw.WriteLine("measure feature tage = " & face_measure)
Dim unit1 As Unit = CType(wp.UnitCollection.FindObject("SquareMilliMeter"), Unit)
Dim unit2 As Unit = CType(wp.UnitCollection.FindObject("MilliMeter"), Unit)
'Dim x1, x2 As Double
...
...
'x1 = measure1.Area
'x2 = measure1.Perimeter
'lw.WriteLine( & measure1)
'lw.WriteLine("Perimeter :" & x2)
End If
Next
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module
Thanks in advance
moh23
NX8.5