turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Siemens PLM Community
- NX Customization and Programming
- NX Programming & Customization Forum
- Extract Y coordinate if X coordinate is known from...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-16-2017 02:26 AM

8 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-16-2017 09:50 AM

Note in a general case, there may also be 0 or (more than 1) intersection point.

If you don't KNOW the spline characteristics, you may want to check for these cases as well.

Offhand, other than walking the spline's parameter (to find the "U" value where the point on the spline at that U is the desired X), I don't know of a better way than you are doing.

Production:NX10.0.3.5 MP5 + patch/TC11.2

I'd rather be e-steemed than e-diseaseled

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-24-2017 04:52 AM

Intersection is the only way to do this. To find the y value at x=k, you can either intersect the spline with the line x=k, or intersect with the plane x=k.

You can get the equation of the spline in the form x = x(t) y = y(t), and use numerical methods to solve the equation x(t) = k. But, in effect, you'd just be re-implementing NX's intersection function.

yamada

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-30-2017 10:48 AM

How can we get those equations?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-30-2017 11:27 PM

Have you tried getting the coordinates of spline in this way?

Dim MyPoint As Point4d = MySpline.GetPoles(i)

where i is the no of poles the spline is having.

Regards,

Abhi

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-31-2017 09:46 PM

An NX spline is just a standard NURBS (Non-uniform Rational B-Spline). You can find the equation in many places on the 'net. One example is this Wikipedia page.

The equation involves

- 3D control points (poles). There are n of these.
- Weight values, one for each pole, so there are n of these.
- An order value, k. If the degree of the curve is m, then k = m+1.
- Knot values. There are n+k of these

You can get all of the above data by calling NX/Open functions.

But, again, once you have the equation, you still have to do an intersection calculation to get the y corresponding to a given x. Better to use the NX intersection algorithm, rather than one you write yourself.

yamada

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

4 weeks ago

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

4 weeks ago - last edited 4 weeks ago

If you have a SNAP license, then you can use Snap.Compute.Intersect(curve, plane).

Here, the plane is a Snap.Geom.Surface.Plane object, so it's just a transient object in your code, not a real NX plane. So, creating it takes no time at all, and you don't have to delete it after you're done.

Here's an example program from the SNAP Reference Guide

Imports Snap, Snap.Create Public Class MyProgram Public Shared Sub Main() ' Create a spline with many wiggles Dim points(10) As Position For i As Integer = 0 to 10 points(i) = New Position(i, (10.0*(-1)^i)/(i+5), 0) Next Dim wiggle As NX.Spline = SplineThroughPoints(points, 3) Dim top As New Geom.Surface.Plane( {0,1,0}, 1) ' Get intersections between the spline and the plane Dim intPoints As Position() = Compute.Intersect(wiggle, top) ' Output the intersection points For Each pt As Position in intPoints InfoWindow.WriteLine(pt.ToString("F6")) Point(pt) Next End Sub End Class ' Results: The output in the NX Information window are ... ' ( 0.053355 , 1.000000 , 0.000000 ) ' ( 1.566558 , 1.000000 , 0.000000 ) ' ( 2.161501 , 1.000000 , 0.000000 ) ' ( 3.798708 , 1.000000 , 0.000000 ) ' ( 4.093433 , 1.000000 , 0.000000 )

Actually, creating a "real" plane isn't all that bad. If you delete the plane after you're done, it will cause an Update, and your performance will suffer. But there are two ways to reduce this problem.

(1) Save all the planes you create, and delete them all at once. That way, you only have to endure one Update, or

(2) Set a mark before you start creating planes, and then Undo to that mark after you're done. The Undo will be much faster than an Update. In fact, in general, this is a very useful technique in lots of situations, so it's a good idea to learn how to do it.

yamada

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

4 weeks ago - last edited 4 weeks ago

Follow Siemens PLM Software

© 2017 Siemens Product Lifecycle Management Software Inc