Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to capture the values of perimeter and area from face measurement in NX Journal

Status
Not open for further replies.

moh23

Computer
Joined
Sep 20, 2013
Messages
1
Location
FR
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
 
An associative face measurement will create expressions with the area and perimeter; you can access the expressions associated with the measure feature to get the values.

www.nxjournaling.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top