Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX11 Journal - Orient WCS to Plane of 3 Points 1

Status
Not open for further replies.

jmarkus

Mechanical
Jul 11, 2001
377
I'm trying to set my coordinate system (WCS) XY plane to match the plane defined by 3 points: point_coord(3),point_coord(3),point_coord(3).

My code is:
Code:
Dim matrix1 As NXOpen.Matrix3x3 = Nothing
matrix1.Xx = point_coord(0).coordinates.X
matrix1.Xy = point_coord(0).coordinates.Y
matrix1.Xz = point_coord(0).coordinates.Z
matrix1.Yx = point_coord(1).coordinates.X
matrix1.Yy = point_coord(1).coordinates.Y
matrix1.Yz = point_coord(1).coordinates.Z
'How do I get the Z point?
matrix1.Zx = point_coord(2).coordinates.X
matrix1.Zy = point_coord(2).coordinates.Y
matrix1.Zz = point_coord(2).coordinates.Z
workPart.WCS.SetOriginAndMatrix(point_coord(4).coordinates, matrix1)

But as you can see, I'm confused...The Z in the matrix would be the point defining the normal to the plane, but I don't know how to get that...

How can I get this WCS oriented using 3 points?

Thanks,
Jeff
 
Replies continue below

Recommended for you

So that made sense to me...until I realized I don't know how to define a vector by 2 points...seems like it would be straightforward but I looked through my NX11 NXOpen .Net API References and User Function Reference and I couldn't figure it out...

I thought it would be the difference between two points like:
Code:
dim Xvec as Vector3 = XPt - OriginPt

But apparently I can't perform subtraction on points...

J

 
Subtract the co-ordinates of points. See below image.

Clipboard01_ebkswv.jpg


Suresh
 
Thanks Suresh. I thought there was a more elegant way than explicitly working with the coordinates, but that makes sense.

Jeff
 
Using points you could create a direction and obtain its vector. But subtracting point co-ordinates is easier for your purpose.

Direction CreateDirection(Point startPoint, Point endPoint, SmartObject.UpdateOption updateOption)
Vector3d Direction.Vector

Suresh
 
The SNAP library has arithmetic for points and vectors. So, in particular, you can get a vector by subtracting one point from another. Snap requires an extra license, but there's a free subset called MiniSnap that includes all the Snap point and vector functions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor