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 JAE on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

ufs.Modl.UniteBodies

Status
Not open for further replies.

EngProgrammer

Aerospace
Joined
Jan 14, 2015
Messages
150
Location
US
I want to programmatically subtract a collection of solid bodies from a block. I am looking at using ufs.Modl.UniteBodies which an example is found on the GTAC solution center (
However, this only gives the boolean operation of two bodies. I need to cycle through a collection of bodies and perform a boolean operation.

Any ideas?
 
Set up a simple example file and record a journal while performing the desired operation. The code NX generates should give you a good starting point.

www.nxjournaling.com
 
If you record a journal,the recorded code will make use of a BooleanBuilder object, so you will see how these work. The BooleanBuilder has a ToolBody Builder, which lets you specify several tool bodies.

Or you can call NXOpen.UF.UFModl.SubtractBodies several times.

Or, if you have a SNAP license, just call Snap.Create.Subtract -- it allows you to input several tool bodies. Here's some example code:
Code:
Imports Snap, Snap.Create

Public Class MyProgram

   Public Shared Sub Main()

      Dim d As Double = 10

      Dim ball  As NX.Body = Sphere(0, 0 ,0, d)
      Dim left  As NX.Body = Sphere(-d/2, 0, 0, 9)
      Dim right As NX.Body = Sphere( d/2, 0, 0, 9)

      ' Subtract the two smaller spheres from the larger one
      Dim cut As NX.Boolean = Subtract(ball, left, right)

   End Sub

End Class
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top