Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

how can i put a sphere of the same size on multiple points quickly

Status
Not open for further replies.

burgerlord

Mechanical
Mar 18, 2016
4
i found an old thread that has a journal to put a sphere of the specified size on multiple points but when i try to run it in nx9.0 it asks me for the sphere diameter and then it does nothing it acts like it is done running but no spheres are created on the points?

here is the code that i found in the old thread

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpenUI

Module Module1
Dim s As Session = Session.GetSession()
Dim ui As UI = UI.GetUI()
Dim disppart As Part = s.Parts.Display
Sub Main()

Dim pnts As PointCollection = disppart.Points
Dim dia1 As Double = NXInputBox.GetInputNumber("Enter Sphere Diameter")
For Each pnt As Point In pnts
createSphere(pnt, dia1)
Next

End Sub
Public Sub createSphere(ByVal pnt As Point, ByVal dia1 As Double)

Dim nullFeatures_Sphere As Features.Sphere = Nothing
Dim sphereBuilder1 As Features.SphereBuilder
sphereBuilder1 = disppart.Features.CreateSphereBuilder(nullFeatures_Sphere)
sphereBuilder1.CenterPoint = pnt
sphereBuilder1.Diameter.RightHandSide = dia1.ToString
Dim nXObject1 As NXObject
nXObject1 = sphereBuilder1.Commit()
sphereBuilder1.Destroy()

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer

GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

End Function

End Module
 
Replies continue below

Recommended for you

I'm using NX 9.0.3.4; the journal posted above works. What value are you entering for the sphere diameter? Perhaps try a larger value so the spheres are easier to see?

www.nxjournaling.com
 
I use a value of 8 really weird it is working now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor