UGMasters
Automotive
- Jan 22, 2008
- 51
Hello Gentlemen,
this Journal gives me the min & Max x,y & z values of a selected solid.
I need help to make this suit my requirements
1.How to restrict to 4 decimal points
2.How to put these values in to the Expression
Regards
Girish
ption Strict Off
'Journal to calculate extreme values for X , Y & Z in relation to Absolute CSY_14-Sep-2020
Imports System
Imports NXOpen
Imports NXOpen.UI
Imports NXOpen.Utilities
Imports NXOpen.UF
Module make_bounding_block_of_selected_body_relative_to_wcs
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = s.ListingWindow()
Sub Main()
Dim a_body As NXOpen.Tag = NXOpen.Tag.Null
Dim csys As NXOpen.Tag = NXOpen.Tag.Null
Dim target As NXOpen.Tag = NXOpen.Tag.Null
Dim blockFeature As NXOpen.Tag = NXOpen.Tag.Null
Dim min_corner(2) As Double
Dim max_corner(2) As Double
Dim directions(2, 2) As Double
Dim distances(2) As Double
Dim X_Max(2) As Double
Dim edge_len(2) As Double
While select_a_body(a_body) = Selection.Response.Ok
ufs.Csys.AskWcs(csys)
ufs.Modl.AskBoundingBoxExact(a_body, csys, min_corner, directions, _
distances)
lw.Open()
'_____________________________________________________________________________Min Value extraction
'Get the Values for X ,Y & Z Minimum
'lw.WriteLine(" X Min " & _
'min_corner(0).ToString & ", Y Min " & _
'min_corner(1).ToString & ",Z Min " & _
' min_corner(2).ToString & ", ")
lw.WriteLine("-----------------")
lw.WriteLine(" X Min " & _
min_corner(0).ToString)
lw.WriteLine("Y Min " & _
min_corner(1).ToString)
lw.WriteLine("Z Min " & _
min_corner(2).ToString)
lw.WriteLine("-----------------")
'_____________________________________________________________________________Max Value
'Get the Values for X ,Y & Z Maximum
edge_len(0) = distances(0).ToString()
edge_len(1) = distances(1).ToString()
edge_len(2) = distances(2).ToString()
lw.WriteLine("X Max + " & _
((edge_len(0)) + (min_corner(0).ToString)))
lw.WriteLine("Y Max + " & _
((edge_len(1)) + (min_corner(1).ToString)))
lw.WriteLine("Z Max + " & _
((edge_len(2)) + (min_corner(2).ToString)))