Cancel
Showing results for
Did you mean:

# journal to kind of "cylindrical ponts"

Valued Contributor
Hi everyone, I have a little problem trying to automate a way to get some points. I have lots of points (defined by point expression) which are real verification points. Then I have a Circle which is the theoretical position of them. I need to create, points, each one aligned to origin and correspondent verification one, and distance must be: twice from verification point to circle. Find attached a video showing you a way I found how to do it, but it’s too tedious. For example, I had the idea to make point set, projecting verification ones o circle (but I can’t select all points together!!!!, have to select one by one) then I had to make a line between verification point and projected, and extend its final limit same distance Verification and projected have. Finally I had to create an “endpoint” over crated line… There must be an easy way to do this. Any idea? ...can´t upload files now (is not woking)... will try later!!!
4 REPLIES

# Re: journal to kind of "cylindrical ponts"

Gears Esteemed Contributor

I don't see any attachment, but from your description it sounds like a good job for a journal.

# Re: journal to kind of "cylindrical ponts"

Valued Contributor

# Re: journal to kind of "cylindrical ponts"

Siemens Phenom

I'm not sure exactly what you mean, so I just implemented a rough solution. It includes the math, but not the selection steps. I'll add the selections stuff after you confirm what you want.

The code uses SNAP functions. The same ideas would work using NX/Open functions, but rhe code would be somewhat longer.

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

Public Class MyProgram

Public Shared Sub Main()

' Replace following three lines with code to select refCircle
Dim center As New Position(30, 40, 0)

' Replace following with code to select verification points
Dim p1 = Point(36, 40, 0)
Dim p2 = Point(30, 44, 0)
Dim p3 = Point(35, 42, 0)
Dim p4 = Point(34, 44, 0)
Dim verPts As NX.Point() = {p1, p2, p3, p4}

' Cycle through the verification points, doing the adjustment
For Each pt In verPts
Dim dist = Position.Distance(pt.Position, center)
Dim diff = dist - radius
Dim vec1 = (pt.Position - center)/dist
Dim vec2 = (dist + diff)*vec1
Point(center + vec2)
Next

End Sub

End Classt ```