Showing results for 
Search instead for 
Do you mean 
Reply

journal to kind of "cylindrical ponts"

[ Edited ]
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"

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"

[ Edited ]
 

Re: journal to kind of "cylindrical ponts"

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)
      Dim radius = 5.0
      Dim refCircle = Circle(center, radius)

      ' 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 
山田
yamada

Re: journal to kind of "cylindrical ponts"

[ Edited ]
mmm, interesting and simple! I will try to edit this to my prupose... (I am not a programmer, but I will give it a try and let you know if I was able to do it) Thank you very much for your response! https://youtu.be/kUutew1aY9s HERE IS A LINK OF WHAT I WANTED (HAVE TO DO IT THIS WAY BECAUSE I STILL CAN´T UPLOAD FILES HERE..) PROBABLY YAMADA PROCESS FOR DOING THIS IS EASIER, BUT I DIDNT KNOW HOW TO DO IT IN A WAY IT COULD BE REPRODUCED IN A JOURNAL THANKS AGAIN!!!!!