Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Isometric And Trimetric view of current WCS? 2

Status
Not open for further replies.

pawelagh

Mechanical
Aug 7, 2012
6
Hi everyone, that's my first thread.

I have no idea how to write a journal that sets Isometric or Trimetric view of current WCS.
Default views are assigned with Csys. I can get the matrix of the Isometric view by recording a journal, but I don't know how to translate the matrix from main csys to wcs.

Any ideas?



 
Replies continue below

Recommended for you

For example Matrix3x3 for Trimetric View looks like:

matrix.Xx = 0,63121905864763
matrix.Xy = 0,775604602874429
matrix.Xz = 0
matrix.Yx = -0,291176881826266
matrix.Yy = 0,236971772169955
matrix.Yz = 0,926855114181588
matrix.Zx = 0,718873092756943
matrix.Zy = -0,585048612676443
matrix.Zz = 0,375419228750255

And my WCS matrix3x3 is:

WCS.Xx = 0
WCS.Xy = 1
WCS.Xz = 0
WCS.Yx = 0
WCS.Yy = 0
WCS.Yz = 1
WCS.Zx = 1
WCS.Zy = 0
WCS.Zz = 0





 
orient the view to current wcs,
goto PNT open the view navigator rmb on the modelview container create a new view set - activate the projections you like to have from the current view
 
To get the trimetric view of the work coordinate you need to matrix multiply the work coordinates matrix times the trimetric view matrix to get the new view matrix.

For the simple position of your wcs example which is such that the wcs x axis is the abs z axis, the wcs y axis is unchanged as the abs y axis and the wcs z axis is the abs x axis. Therefore in this case you need only interchange the trimetrc row 1 and row 3 in the trimetric matrix. Doing the matrix multiplication (in the correct order) will show you that you get the above result.

Is this what you are looking for or did you want the journal code?

Frank Swinkels
 
Thanks a lot!
I wrote a journal and it works fine, here is a code:
Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module NXJournal
Sub Main
Dim theSession As Session = Session.GetSession()
Dim theUFSession As UFSession = UFSession.GetUFSession()
Dim displayPart As Part = theSession.Parts.Display

Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow

Dim myWcs As CoordinateSystem = theSession.Parts.Display.WCS.CoordinateSystem

Dim myMtx As Matrix3x3 = myWcs.Orientation.Element
Dim currentView As View = displayPart.Views.WorkView()
Dim myMatrix As Matrix3x3 = currentView.Matrix()
Dim resultMtx As Matrix3x3
Dim TriMatrix As Matrix3x3

TriMatrix.Xx = 0.63121905864763
TriMatrix.Xy = 0.775604602874429
TriMatrix.Xz = 0
TriMatrix.Yx = -0.291176881826266
TriMatrix.Yy = 0.236971772169955
TriMatrix.Yz = 0.926855114181588
TriMatrix.Zx = 0.718873092756943
TriMatrix.Zy = -0.585048612676443
TriMatrix.Zz = 0.375419228750255  

resultMtx.Xx = TriMatrix.xx*myMtx.xx + TriMatrix.xy*myMtx.yx + TriMatrix.xz*myMtx.zx
resultMtx.Xy = TriMatrix.xx*myMtx.xy + TriMatrix.xy*myMtx.yy + TriMatrix.xz*myMtx.zy
resultMtx.Xz = TriMatrix.xx*myMtx.xz + TriMatrix.xy*myMtx.yz + TriMatrix.xz*myMtx.zz
resultMtx.Yx = TriMatrix.yx*myMtx.xx + TriMatrix.yy*myMtx.yx + TriMatrix.yz*myMtx.zx
resultMtx.Yy = TriMatrix.yx*myMtx.xy + TriMatrix.yy*myMtx.yy + TriMatrix.yz*myMtx.zy
resultMtx.Yz = TriMatrix.yx*myMtx.xz + TriMatrix.yy*myMtx.yz + TriMatrix.yz*myMtx.zz
resultMtx.Zx = TriMatrix.zx*myMtx.xx + TriMatrix.zy*myMtx.yx + TriMatrix.zz*myMtx.zx
resultMtx.Zy = TriMatrix.zx*myMtx.xy + TriMatrix.zy*myMtx.yy + TriMatrix.zz*myMtx.zy
resultMtx.Zz = TriMatrix.zx*myMtx.xz + TriMatrix.zy*myMtx.yz + TriMatrix.zz*myMtx.zz


displayPart.ModelingViews.WorkView.Orient(resultMtx)
displayPart.ModelingViews.WorkView.Fit()


End Sub
End Module
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor