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
RE: Create center points from many arcs by selecting all
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 ClassThe 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