×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*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.

Students Click Here

Jobs

Create center points from many arcs by selecting all

Create center points from many arcs by selecting all

Create center points from many arcs by selecting all

(OP)
Hi everyone, I came across with this thread (NX VB Journal - Create CenterPoint of an Arc) about create points in a previously created arc but it´s necessary select one by one, how can I do it by selecting all circles at the same time, is that possible? I´d like to create spheres on these points as well. Thanks in advance! (I´m working on NX-9.0)

RE: Create center points from many arcs by selecting all

I don't know, how do it in vb, I can do it in C, Ugopen. Not so difficult.

RE: Create center points from many arcs by selecting all

Here's how you do with VB code that calls SNAP functions. If you wanted to call NX/Open functions, instead, the basic idea would be the same, but the code would be somewhat longer.

CODE --> vb

Option Infer On
Imports Snap, Snap.Create, Snap.UI

Public Class MyProgram

    Public Shared Sub Main()

      ' Create a selection dialog, and allow selection of multiple arcs
      Dim dialog = Selection.SelectObject("Select arcs")
      dialog.SetCurveFilter(Snap.NX.ObjectTypes.Type.Arc)
      dialog.AllowMultiple = True

      ' Display the dialog and get a result
      Dim result = dialog.Show()

      ' Cycle through the selected arcs
      If result.Response <> Response.Cancel And result.Response <> Response.Back Then
         For Each obj In result.Objects
            Dim arc As NX.Arc = CType(obj, Snap.NX.Arc)    ' Cast to type Arc
            Dim center As Position = arc.Center            ' Get center
            Point(center)                                  ' Create point
            Sphere(center, arc.Diameter)                   ' Create sphere
         Next
      End If

    End Sub

End Class 

The code creates spheres, too, and the diameter of each sphere is set equal to the diameter of the corresponding arc. If that's not what you want, the modifications should be quite simple.

RE: Create center points from many arcs by selecting all

(OP)
Hi Bubbak, that's exactly what I need with exception the spheres but it´s no problem, thank you so much for help me, it will be very useful to me, I really appreciate your help!

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.

Reply To This Thread

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

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


Resources