×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# NX9 Bounding Box function6

 Forum Search FAQs Links MVPs

## NX9 Bounding Box function

3
(OP)
Seen posts here and had customers ask about bounding box functionality in NX.
The answer was to use Journals/NX Open/Grip etc to solve the problem.

NX has a function called Create Box that existed in the Wizards (Mold, Die or Electrode).
Without one of those Wizard licenses, you couldn't use it.

Saw an IR recently (see image below) which says that from NX9.0.3 onwards, you only need a solid modeling license to use the function.

Thought it was pretty neat function so we've made a video to show how to access it and how it works: https://vimeo.com/116116872
Also did some testing and NX9.0.2 can also do the same.
NX10 version of Create Box is better as well.

Anthony Galante
Senior Support Engineer

NX3 to NX10 with almost every MR (21versions)

Nice

Regards
Greg

### RE: NX9 Bounding Box function

Is there any way of getting the dimensions of the solid belonging to create box? there seems to be no attributes or expressions associated with it, and the knowledge fusion class used to create the feature shows only the inputs points, vectors, and hostpointers but not the output. Thus I suspect that the only way to get the length x width x height of the bounding box is to actually create associative measures or PMI dimensions?

### RE: NX9 Bounding Box function

(OP)
@petulf, no way that I could see. There is another function that works very similar to Create Box but you need a wizard license. It reports on the dialog the 3 dimensions and creates an attribute with an a value like 300 x 340 x 356.

@phillpd, NX9 or NX10? I ask because in my playing with it I've seen no errors in NX9 but I did get an error in NX10, not the same as yours though.

Anthony Galante
Senior Support Engineer

NX3 to NX10 with almost every MR (21versions)

### RE: NX9 Bounding Box function

Maybe someone could help me with this, petulf is trying to do something that I have been somewhat doing

What I do sometimes is create the box, then create 3 associative dimensions and call them sz1, sz2 and sz3

Now I have 3 expressions that I can use that will automatically update

On my drawing I can use <X.4@sz1> X <X.4@sz2> X <X.4@sz3> to show the sizes

But is there any way to get these to an attribute so they show up on my bom in the format sz1 X sx2 X sz3 (I do not want 3 columns in my BOM)

Thanks

Brian Marchand-Die Designer
http://www.armotool.com/
NX 9.0.2.5 / PDW
Dell Precision T7610 w/Xeon ES-2609
16G Ram - Nvidia Quadro K5000
Win 7 Pro x64

### RE: NX9 Bounding Box function

Anthony, I'm running NX9.0.3.4 MP03.

It does work in NX10

NX 9.0.3.4
NX 10 (Testing)
Windows 7 64 (Windows 8.1 Tablet)

### RE: NX9 Bounding Box function

When I use command finder, I do not see Mold box or Create box
any suggestions? I currently use a journal from Cohens NXcustom setup to make a bounding box, but i'm interested in an actual command

### RE: NX9 Bounding Box function

Robnewcomb:
Do you run 902 or later ?
As Anthony noted in the first post, its in 902 and later.

Regards,
Tomas

### RE: NX9 Bounding Box function

PhoeNX: Yes mold wizard has the stock size tool but it is not associative, it only runs the bounding box function and then as you say stores the result into two attribute strings but it will not update if the underlying objects are changed.

phillipd: Create box uses knowledge fusion functions so i would start troubleshooting there, i run the same version and it works.

bmarchand: You could create an expression that concatenates the expressions using the stringvalue() function, the following example uses referenced attributes but measurement expressions will work the same way.

We currently use our own NXOpen program to get a complete list of stocksizes as we find the current NX bounding box tools to be lacking. This solution is not optimal as the values are not associative thus we do not want to push them directly into drawings and teamcenter.

What I would like to see in an NX bounding box feature
• Be contained in one fully associative feature.
• Outputs the bounding box dimensions into attributes and or expressions, so that the values can be used downstream in drafting and teamcenter.
• Can reference abs, wcs or a datum csys feature as the bounding box frame reference.
• Optional creation of solid, i.e. so that it is only visible from within the feature dialog.
Our current plan is to create a knowledge fusion feature for this, but it would be oh so much better to be able to do this with native NX feature modeling.

### RE: NX9 Bounding Box function

I am running 9.0.3.4 MP2

heres the journal i run

#### CODE --> vb

Option Strict Off

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 directions(2, 2) As Double
Dim distances(2) As Double
Dim edge_len(2) As String

While select_a_body(a_body) = Selection.Response.Ok

ufs.Modl.AskBoundingBoxExact(a_body, csys, min_corner, directions, _
distances)

lw.Open()

lw.WriteLine("Min_corner: " & _
min_corner(0).ToString & ", " & _
min_corner(1).ToString & ", " & _
min_corner(2).ToString & ", ")

lw.WriteLine("X direction: " & _
directions(0, 0).ToString & ", " & _
directions(0, 1).ToString & ", " & _
directions(0, 2).ToString & ", ")
lw.WriteLine("X distance: " & _
distances(0).ToString)

lw.WriteLine("Y direction: " & _
directions(1, 0).ToString & ", " & _
directions(1, 1).ToString & ", " & _
directions(1, 2).ToString & ", ")
lw.WriteLine("Y distance: " & _
distances(1).ToString)

lw.WriteLine("Z direction: " & _
directions(2, 0).ToString & ", " & _
directions(2, 1).ToString & ", " & _
directions(2, 2).ToString & ", ")
lw.WriteLine("Z distance: " & _
distances(2).ToString)

edge_len(0) = distances(0).ToString()
edge_len(1) = distances(1).ToString()
edge_len(2) = distances(2).ToString()

ufs.Modl.CreateBlock(FeatureSigns.Nullsign, _
target, min_corner, edge_len, blockFeature)
End While

End Sub

Function select_a_body(ByRef a_body As NXOpen.Tag) As Selection.Response

Dim message As String = "Select a body"
Dim title As String = "Select a body"
Dim scope As Integer = UFConstants.UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY
Dim response As Integer

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

Return UFConstants.UF_UI_SEL_SUCCESS

End Function

Public Function GetUnloadOption(ByVal dummy As String) As Integer

End Function

End Module 

### RE: NX9 Bounding Box function

petulf, could you show aw an example--I tried the function but cannot get it to accept a 3 expressions in same stringfunction

Brian Marchand-Die Designer
http://www.armotool.com/
NX 9.0.2.5 / PDW
Dell Precision T7610 w/Xeon ES-2609
16G Ram - Nvidia Quadro K5000
Win 7 Pro x64

### RE: NX9 Bounding Box function

Another technique for associatively collecting the three dimensions of the bounding box would be to put an associative Datum CSYS on one corner of the bounding box and then create an associative Point Measurement [also new in NX 9] on the opposite corner of the block, RELATIVE to the Datum CSYS. This will give you an accurate set of dimensions for the box, regardless of orientation or size changes:

...and with the Point Measurement feature, you can choose whether to get just one "Point" expression for the answer, or optionally create all three components dimensions as individual "Number" expressions as well:

Just another thought.

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)

### RE: NX9 Bounding Box function

Let me try again with those images...

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)

### RE: NX9 Bounding Box function

petulf: I suspect you could get awfully close to your desired end state with a UDF -- particularly using the NX 10 version of the bounding box -- and with the technique I showed.

(Target body and orientation CSYS selections as two inputs,
extract faces as input for bounding box,
create Bounding Box feature,
create Datum CSYS feature,
create Point Measurement,
which creates expressions...)

...and avoiding the ongoing maintenance of a programmatic solution would probably be worth the tradeoffs.

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)

### RE: NX9 Bounding Box function

(OP)
@robnewcomb, make sure you're in modeling when using command finder.
Otherwise, the attached ribbon bar file will add a ribbon tab with the right Create Box function.

To automatically load a RTB file at NX startup, put it in the startup folder pointed to via the USER,GROUP or SITE DIR variables.

I made a video showing how I would do that for the USER variable UGII_USER_DIR.

RTB File

Video file

Anthony Galante
Senior Support Engineer

NX3 to NX10 with almost every MR (21versions)

### RE: NX9 Bounding Box function

TaylorAnderson

That is a great Idea

How would I get the values to a single attribute so I can add a column to my bom and have "value X value X value"

petulf suggested stringvalue() but I haven't figured out how yet

Thanks

Brian Marchand-Die Designer
http://www.armotool.com/
NX 9.0.2.5 / PDW
Dell Precision T7610 w/Xeon ES-2609
16G Ram - Nvidia Quadro K5000
Win 7 Pro x64

### RE: NX9 Bounding Box function

Taylor: Good idea and had completely missed the point measurement feature which is sure to come in handy. To bad that create box reference csys is not associative and the object selection does not use selection rules as input but directly references the object tags. Thus it is not possible to create an associative udf (extract feature face will not help) that takes a body and csys feature as input. An improvement request for the create box feature might be in order?

I have included a test part that tries to create what we want with out of the box features, the non-associative nature of create box is the only obstacle.

bmarchand: Check out the included nx9 part for an example of how to convert numbers to strings.

### RE: NX9 Bounding Box function

petulf,
I think most of what you want may already exist (as a custom, freely available solution from GTAC). Search the GTAC solution center for nx_api3871 (VB version) or nx_api4910 (C# version).

#### Quote (Amy Webster)

This application implements a new feature type called Bounding Box. This
wireframe feature is made up of 12 lines which correspond to the edges of the
smallest box which will contain all of the selected geometry. The box is
oriented with respect to a selected coordinate system. This box is associative
and will change size as the contents are modified.

The geometry to be contained in the box and the orientation of the box can be
changed at any time by editting the feature.

If you want an associative solid block for a machining blank for example, just
create one by selecting diagonal corners of the wireframe box. This
application does not do this because a UDO Feature cannot link to or own a
solid body or feature. See PR 1798592.

This application must be run as a dll. An NX Open .NET Author or NX Open
Toolkits Author license is required. Tools-> Journal-> Play will only work
once. Put the boundingBox.dll in any "startup" folder, e.g.
UGII_USER_DIR\startup. Put the boundingBox.dlx in any "application" folder,
e.g. UGII_USER_DIR\application.

### RE: NX9 Bounding Box function

Brian:

So, after making sure I was using a string expression, Stringvalue() worked for me when I set it up like this:

stringvalue(p17) + " x " + stringvalue(p18) + " x " + stringvalue(p19)

...but it doesn't give me control over the number of decimals displayed. For my oblique bounding box, this resulted in a string something like:

42.208055775 x 33.351831883 x 41.032078484

...and that may be less than desirable.

Using the format() function like this:

format("%0.1f",p17 ) + " x " + format("%0.1f",p18 ) + " x " + format("%0.1f",p19 )

...gave me control over the number of decimal places displayed, for a result more like this:

42.2 x 33.4 x 41.0

Once you've got the string attribute sorted out, then go over into the Part Attributes dialog, and pull the expression value into a string attribute with the "Link to Expression" button:

Once you've selected your string expression and pushed Apply or OK, the selected expression and the value should be visible over there, too:

(...and the "Link to Expression" button will switch to a "Break Expression Link" button.)

Make sense? Does that help?

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)

### RE: NX9 Bounding Box function

Cowski: Thanks! that example program works and is very similar to the one we run now to generate a list of stock sizes except for the whole UDO part. Interestingly the example program seems to have problems with parts that use delete body as it pre-selects all bodies even if the body has been deleted by "delete body", and these bodies cannot be deselected. It would be feasible to customize this example program to do exactly what we want, but we currently have a policy to not use UDO nxopen features due to downstream process issues.

### RE: NX9 Bounding Box function

Note that for NX 10.0, the size of the Bounding Box IS associative to the model as it now remembers the Selection Method used when the 'Box' was originally created. Besides, we've added an option to simply select a Solid Body so any changes to that body will be reflected in the Bounding Box size.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Digital Factory
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.

### RE: NX9 Bounding Box function

John: Good news but is the reference csys also associative in NX10?

### RE: NX9 Bounding Box function

petulf:

It looks like the NX 10 version of the Create Box feature does what you want.

The orientation can associatively reference a selected CSYS, and the object selection uses selection intent rules now, so you can set up an arbitrary single body as a simple input:

I was able to create a UDF with just the two selection inputs, like this:

...that seems to hang together like a champ when applied to a couple of other parts.

(See the attached video clip.)

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)

### RE: NX9 Bounding Box function

If you mean, can you define something other than the WCS, which is what the pre-NX 10.0 Create Box used, such as an existing CSYS object, to define the orientation of the 'box' and if I edit the orientation of this CSYS, will the 'box' reorient and resize so as to still bound the selected object and be oriented relative to the selected CSYS, the answer is YES. You can even associate the color of the 'Box' solid body to the color of the selected object, as shown below:

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Digital Factory
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.

### RE: NX9 Bounding Box function

Taylor: great news! this will simplify our workflow immensely when we switch over to nx 10 sometime in Q2 :)

### RE: NX9 Bounding Box function

Cool. Glad to help, petulf.

And kudos to PhoeNX for pointing out this feature. It had slipped under my radar, even though I've wanted this function for years.

I've had to write a couple of KF bounding boxes over the years to create certain specific tools, and this will be WAAAAY better.

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)

### RE: NX9 Bounding Box function

To use this function with NX9, "Mold Wizard" has to be installed

NX 9.0.3.4
NX 10 (Testing)
Windows 7 64 (Windows 8.1 Tablet)

### RE: NX9 Bounding Box function

#### CODE -->

BUTTON MW_TOOLS_BOX
LABEL Create a Bounding Box 
I manually edited my personal.tbr and it works nicely. It's faster and more accurate than the Journal I've been running

I don't have or have access to Mold Wizard, We do not do mold design

### RE: NX9 Bounding Box function

I don't use/need Mold Wizard, but didn't include it with our Custom install ... The function will error out when creating the Box.

I've subsequently installed Mold Wizard, and now the function works.

With NX10, it will work even without Mold Wizard being installed.

NX 9.0.3.4
NX 10 (Testing)
Windows 7 64 (Windows 8.1 Tablet)

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!

#### Resources

White Paper â€“ Your Construction ERP RFP Checklist
Selecting business software for a medium to enterprise-sized construction concern is extremely challenging in large part because most enterprise resource planning (ERP) suites originated in the world of repetitive manufacturing and are therefore a poor fit for a project and asset-centric business. However, midsize to large contractors need the predictable, auditable processes that ERP delivers. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!