NX bounding Dimensions
NX bounding Dimensions
(OP)
thread561-319996: NXOpen .Net - MeasureBodies performace very poor
hello all,
i would love help in some things :
i would like to retrive all the info that that journal gives in an Information window, and would like if i could select any part insteed only the work park, what im trying to do is to populate the "catalog/size" on BOM.
btw the dims displayed by this journal works on inclined solids ?
Thanks in advance.
hello all,
i would love help in some things :
i would like to retrive all the info that that journal gives in an Information window, and would like if i could select any part insteed only the work park, what im trying to do is to populate the "catalog/size" on BOM.
btw the dims displayed by this journal works on inclined solids ?
Thanks in advance.





RE: NX bounding Dimensions
www.nxjournaling.com
RE: NX bounding Dimensions
was tolded to our company to stay a bit longer on 8.5 due correction of bugs so i think we will be staying on 8.5 a bit longer; do you advise to upgrade ?
i saw that thread but it is to create a bounding box, but i just want the dimensions of the solid regarding if it is inclined or not, if the only way to achieve the dimensions result is by creating a bounding box, is it possible to create a journal that creates an "illusionary" box and return to me the dimensions ?
i have this journal:
CODE -->
Option Strict Off Imports System Imports System.Math Imports NXOpen Imports NXOpen.UI Imports NXOpen.Utilities Imports NXOpen.UF Module report_bounding_box_plus_block Dim s As Session = Session.GetSession() Dim ufs As UFSession = UFSession.GetUFSession() Dim theSession As Session = Session.GetSession() Dim workPart As Part = theSession.Parts.Work Dim displayPart As Part = theSession.Parts.Display Sub Main() Dim a_body As NXOpen.Tag Dim csys As NXOpen.Tag Dim min_corner(2) As Double Dim directions(2,2) As Double Dim distances(2) As Double Dim n As String = vbCrLf While select_a_body(a_body) = Selection.Response.Ok 'And _ ' select_a_csys(wcs) = Selection.Response.Ok ufs.Modl.AskBoundingBoxExact(a_body, csys, min_corner, directions, _ distances) ufs.Ui.OpenListingWindow() 'ufs.Ui.WriteListingWindow("Min_corner: " & _ ' min_corner(0).ToString & ", " & _ ' min_corner(1).ToString & ", " & _ ' min_corner(2).ToString & ", " & n) ' ufs.Ui.WriteListingWindow("Stock Size X: " & _ ' directions(0,0).ToString & ", " & _ ' directions(0,1).ToString & ", " & _ ' directions(0,2).ToString & ", " & n) ufs.Ui.WriteListingWindow("Stock Size X: " & _ Math.Round(distances(0),3).ToString & n) ' ufs.Ui.WriteListingWindow("Stock Size Y: " & _ ' directions(1,0).ToString & ", " & _ ' directions(1,1).ToString & ", " & _ ' directions(1,2).ToString & ", " & n) ufs.Ui.WriteListingWindow("Stock Size Y " & _ Math.Round(distances(1),3).ToString & n) ' ufs.Ui.WriteListingWindow("Z direction: " & _ ' directions(2,0).ToString & ", " & _ ' directions(2,1).ToString & ", " & _ ' directions(2,2).ToString & ", " & n) ufs.Ui.WriteListingWindow("Stock Size Z: " & _ Math.Round(distances(2),3).ToString & n & n) ' End While Dim msg As String Dim title As String Dim style As MsgBoxStyle Dim response As MsgBoxResult msg = "Want to create a block?" ' Define message. style = MsgBoxStyle.YesNo title = "Stock Size Bloco" ' Define title. ' Display the dialog for the user response = MsgBox(msg, style, title) If response = MsgBoxResult.No Then ' Exit Sub End If -------------------------------------------------------------- Dim coordinates1 As Point3d = New Point3d (min_corner(0), min_corner(1), min_corner(2)) Dim point1 As Point Dim T_Dim_X As String = Math.Round(distances(0),3) Dim T_Dim_Y As String = Math.Round(distances(1),3) Dim T_Dim_Z As String = Math.Round(distances(2),3) T_Dim_X = T_Dim_X.replace(",", ".") T_Dim_Y = T_Dim_Y.replace(",", ".") T_Dim_Z = T_Dim_Z.replace(",", ".") point1 = workPart.Points.CreatePoint(coordinates1) Dim nullFeatures_Feature As Features.Feature = Nothing Dim blockFeatureBuilder1 As Features.BlockFeatureBuilder blockFeatureBuilder1 = workPart.Features.CreateBlockFeatureBuilder(nullFeatures_Feature) Dim originPoint1 As Point3d = New Point3d (min_corner(0), min_corner(1), min_corner(2)) blockFeatureBuilder1.SetOriginAndLengths(originPoint1, T_Dim_X, _ T_Dim_Y, _ T_Dim_Z) ' Decimal.Round(distances(1),3), _ ' Decimal.Round(distances(2),3)) Dim feature1 As Features.Feature feature1 = blockFeatureBuilder1.CommitFeature() blockFeatureBuilder1.Destroy() Dim body2 As Body Dim LastBlock As Features.Block = CType (feature1,Features.Block) body2 = LastBlock.GetBodies (0) Dim displayModification1 As DisplayModification displayModification1 = theSession.DisplayManager.NewDisplayModification() displayModification1.ApplyToAllFaces = True displayModification1.NewColor = 6 displayModification1.NewTranslucency = 50 displayModification1.NewFont = DisplayableObject.ObjectFont.Dashed Dim objects1(0) As DisplayableObject objects1(0) = body2 displayModification1.Apply(objects1) displayModification1.Dispose() '--------------------------------------------------------------------------------- End While End Sub Function select_a_body(ByRef a_body As NXOpen.Tag) As Selection.Response Dim message As String Dim title As String = "Select a body" Dim scope As Integer = UFConstants.UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY Dim response As Integer Dim obj As NXOpen.Tag Dim view As NXOpen.Tag Dim cursor(2) As Double Dim ip As UFUi.SelInitFnT = AddressOf body_init_proc ufs.Ui.LockUgAccess(UFConstants.UF_UI_FROM_CUSTOM) Try ufs.Ui.SelectWithSingleDialog(message, title, scope, ip, _ Nothing, response, a_body, cursor, view) Finally ufs.Ui.UnlockUgAccess(UFConstants.UF_UI_FROM_CUSTOM) End Try If response <> UFConstants.UF_UI_OBJECT_SELECTED And _ response <> UFConstants.UF_UI_OBJECT_SELECTED_BY_NAME Then Return Selection.Response.Cancel Else ufs.Disp.SetHighlight(a_body, 0) Return Selection.Response.Ok End If End Function Function body_init_proc(ByVal select_ As IntPtr, _ ByVal userdata As IntPtr) As Integer Dim num_triples As Integer = 1 Dim mask_triples(0) As UFUi.Mask mask_triples(0).object_type = UFConstants.UF_solid_type mask_triples(0).object_subtype = UFConstants.UF_solid_body_subtype mask_triples(0).solid_type = UFConstants.UF_UI_SEL_FEATURE_BODY ufs.Ui.SetSelMask(select_, _ UFUi.SelMaskAction.SelMaskClearAndEnableSpecific, _ num_triples, mask_triples) Return UFConstants.UF_UI_SEL_SUCCESS End Function Function select_a_csys(ByRef csys As NXOpen.Tag) As Selection.Response Dim message As String Dim title As String = "Select a CSYS" Dim scope As Integer = UFConstants.UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY Dim response As Integer Dim obj As NXOpen.Tag Dim view As NXOpen.Tag Dim cursor(2) As Double Dim ip As UFUi.SelInitFnT = AddressOf csys_init_proc ufs.Ui.LockUgAccess(UFConstants.UF_UI_FROM_CUSTOM) Try ufs.Ui.SelectWithSingleDialog(message, title, scope, ip, _ Nothing, response, csys, cursor, view) Finally ufs.Ui.UnlockUgAccess(UFConstants.UF_UI_FROM_CUSTOM) End Try If response <> UFConstants.UF_UI_OBJECT_SELECTED And _ response <> UFConstants.UF_UI_OBJECT_SELECTED_BY_NAME Then Return Selection.Response.Cancel Else ufs.Disp.SetHighlight(csys, 0) Return Selection.Response.Ok End If End Function Function csys_init_proc(ByVal select_ As IntPtr, _ ByVal userdata As IntPtr) As Integer Dim num_triples As Integer = 1 Dim mask_triples(0) As UFUi.Mask mask_triples(0).object_type = UFConstants.UF_coordinate_system_type mask_triples(0).object_subtype = UFConstants.UF_csys_normal_subtype mask_triples(0).solid_type = 0 ufs.Ui.SetSelMask(select_, _ UFUi.SelMaskAction.SelMaskClearAndEnableSpecific, _ num_triples, mask_triples) Return UFConstants.UF_UI_SEL_SUCCESS End Function Public Function GetUnloadOption(ByVal dummy As String) As Integer GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY End Function End Modulebut on inclined objects don't work correct and creates a block larger than the max dimensions of it
here is an image that i think explains my problem
RE: NX bounding Dimensions
RE: NX bounding Dimensions
www.nxjournaling.com
RE: NX bounding Dimensions
This is because there is no optimizing function built into this feature. NX will create a bounding box which is parallel to the coordinate system and one of the new options in the NX903 feature is the ability to manually rotate.
i.e if you attempt to create the absolute minimum box using a program, you also need to write your own optimization routine to indirect rotate the coordinate system.
Regards,
Tomas
RE: NX bounding Dimensions
thanks for the helping so far
NX8.5 User
RE: NX bounding Dimensions
on that thread cowski i tryed to run those journals but did not happen anything dunno why. is there a way to see a "log" ?
NX8.5 User
RE: NX bounding Dimensions
To check the NX log file after running the journal, go to Help -> log file and scroll to the bottom (or very close to it). You should either find a message that the journal executed successfully or error messages.
www.nxjournaling.com
RE: NX bounding Dimensions
www.nxjournaling.com
RE: NX bounding Dimensions
RE: NX bounding Dimensions
NX8.5 User