Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Journal question: Direction to vector, 2 vectors to matrix for orientation 2

Status
Not open for further replies.

kukelyk

Industrial
Mar 21, 2005
315
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


----
kukelyk
 
Replies continue below

Recommended for you

What's your end goal?
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
 
Thanks for your interest!

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
 
Do you have access to the GTAC solution center website? If so, go there and search for:
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
 
I do not want to modify the original part, because we copy the electrode part to a different directory, and i would like to see, if the parts are the same..
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
 
I dont know about this solution center. It seems that it is a great gold mine

----
kukelyk
 
Determine the third axis using the cross product of what is your z axis with your x axis giving the y axis for the orientation matrix. The below VB code is a sub for determining the third axis

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 Function

Frank Swinkels
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor