Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Bounding box in NXOpen

Status
Not open for further replies.

claforet

Mechanical
Apr 8, 2010
54
Hi,

I'm trying to get the bounding box around a part (or component, I've tried both) with the following code:

Imports System
Imports NXOpen
Imports NXOpen.Assemblies
Imports NXOpen.UF
Imports System.IO

Module NXJournal
Sub Main

Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()

Dim workPart As Part = theSession.Parts.Work

dim tggg as tag = workpart.tag
dim b(5) as double

ufs.modl.askboundingbox(tggg,b)

end sub
end module


When I run the code (I've tried single parts and assemblies) I get a memeory access violation saying that it attempted to read or write protected memory. Does anyone know what can be done to fix this?

Thanks.
 
Replies continue below

Recommended for you

I have used this function successfully in a journal, I'm pretty sure you have to pass a tag of a body. I don't believe the workpart.tag is valid input for the function (the workpart may contain multiple bodies).
 
I see. Thanks for the help, that makes sense. Do you know of a way to get the bounds of an asseembly using NXOpen (VB)?

Thanks.
 
I've never tried to get the bounds of an assembly. Do you have the 'wrap assembly' function available? Perhaps you can use the 'wrapped assembly' body with the bounding box function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor