Journal question: Direction to vector, 2 vectors to matrix for orientation
Journal question: Direction to vector, 2 vectors to matrix for orientation
(OP)
Hi.
In my code i have to directions:
Xdirection = workPart.Directions.CreateDirection(Linear_Edge, Sense.Forward, SmartObject.UpdateOption.AfterModeling)
Zdirection = workPart.Directions.CreateDirection(Planar_Face, Sense.Reverse, SmartObject.UpdateOption.AfterModeling)
for the orientation matrix, i need to vector3d type object.
The directions have vector property, so i tried this:
Xvec = Xdirection.vector
It throws error. what can be the problem?
I need then a YVec from the 2 above vector as Yvec=ZVec X XVec
but the Matrix functions not runs. How should I call them?
Dim orientation1 As Matrix3x3
UFSes.MTX3.initialize(Xvec,Yvec,orientation1)
Any help would be appreciated
In my code i have to directions:
Xdirection = workPart.Directions.CreateDirection(Linear_Edge, Sense.Forward, SmartObject.UpdateOption.AfterModeling)
Zdirection = workPart.Directions.CreateDirection(Planar_Face, Sense.Reverse, SmartObject.UpdateOption.AfterModeling)
for the orientation matrix, i need to vector3d type object.
The directions have vector property, so i tried this:
Xvec = Xdirection.vector
It throws error. what can be the problem?
I need then a YVec from the 2 above vector as Yvec=ZVec X XVec
but the Matrix functions not runs. How should I call them?
Dim orientation1 As Matrix3x3
UFSes.MTX3.initialize(Xvec,Yvec,orientation1)
Any help would be appreciated
----
kukelyk





RE: Journal question: Direction to vector, 2 vectors to matrix for orientation
It appears to me that you want to create a csys object. If this is the case, there might be easier methods.
www.nxjournaling.com
RE: Journal question: Direction to vector, 2 vectors to matrix for orientation
I would like to reposition my part in the manufacturing part.
The method is:
->Open part, find base faces in an unparametrized body (a substracted 20mm diameter cylinder on the EDM-electrode head), get directions and base point
-> create new parent. When i recorded the new parent journal, there was this:
<code>
Dim basePoint1 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim orientation1 As Matrix3x3
orientation1.Xx = 1.0
orientation1.Xy = 0.0
orientation1.Xz = 0.0
orientation1.Yx = 0.0
orientation1.Yy = 1.0
orientation1.Yz = 0.0
orientation1.Zx = 0.0
orientation1.Zy = 0.0
orientation1.Zz = 1.0
Dim partLoadStatus1 As PartLoadStatus
Dim component1 As Assemblies.Component
component1 = workPart.ComponentAssembly.AddMasterPartComponent(part1, "None", EDM_part_name, basePoint1, orientation1, -1, partLoadStatus1)
partLoadStatus1.Dispose()
</code>
So it seems the fastest to reposition the part at the beginning.
----
kukelyk
RE: Journal question: Direction to vector, 2 vectors to matrix for orientation
Sample NX Open .NET Visual Basic program : create wcs from face and longest edge
It sounds similar to what you want to do, the sample moves the WCS but you could create a csys object then do a move component: csys to csys to reposition your component.
www.nxjournaling.com
RE: Journal question: Direction to vector, 2 vectors to matrix for orientation
I will see this solution. They do it differently, with the endpoints of the longest line
My journal find the longest edge of the face next to the cylinder..this should be X axis, and the reverse vector of this planar face normal is Z axis
----
kukelyk
RE: Journal question: Direction to vector, 2 vectors to matrix for orientation
----
kukelyk
RE: Journal question: Direction to vector, 2 vectors to matrix for orientation
CODE -->
Public Shared Function Cross(ByVal v1 As Vector3d, ByVal v2 As Vector3d) As Vector3d Dim v As Vector3d v.X = (v1.Y * v2.Z - v1.Z * v2.Y) v.Y = (v1.Z * v2.X - v1.X * v2.Z) v.Z = (v1.X * v2.Y - v1.Y * v2.X) Return v End FunctionFrank Swinkels