Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 783

How to pass my current monitor view as input parameter for Mapping Functions

$
0
0

I would like to find the location of all the Parts available in an Assembly on my monitor screen. After doing my research/asking for guidance, I was able to get someone told me these functions could help me do it. I tried to search for example of how to use NXOpen.View because I need to pass aView as View to input parameter of the function but I could not really find an example.

How can I declare my current monitor view of the assembly as View in order to pass it these Function inputs?

Function MapView2Abs(ByVal aView As View, ByVal loc As Point3d)Dim vmx As Matrix3x3 = aView.MatrixDim vw()AsDouble={0, 0, 0, vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}Dimabs()AsDouble={0, 0, 0, 1, 0, 0, 0, 1, 0}Dim mx(11)AsDoubleDim irc AsIntegerDim c()AsDouble={loc.X, loc.Y, loc.Z} 
        ufs.Trns.CreateCsysMappingMatrix(vw, abs, mx, irc)
        ufs.Trns.MapPosition(c, mx) 
        MapView2Abs =New Point3d(c(0), c(1), c(2))EndFunction 
    Function Reverse(ByVal forward As Point3d)
        Reverse =New Point3d(-forward.X, -forward.Y, -forward.Z)EndFunction 
    Function MapAbs2View(ByVal aView As View, ByVal loc As Point3d)Dim vmx As Matrix3x3 = aView.Matrix 
        Dim origin_abs As Point3d = MapView2Abs(aView, Reverse(aView.Origin)) 
        Dim vw()AsDouble={origin_abs.X, origin_abs.Y, origin_abs.Z, _
                              vmx.Xx, vmx.Xy, vmx.Xz, vmx.Yx, vmx.Yy, vmx.Yz}Dimabs()AsDouble={0, 0, 0, 1, 0, 0, 0, 1, 0}Dim mx(11)AsDoubleDim irc AsIntegerDim c()AsDouble={loc.X, loc.Y, loc.Z} 
        ufs.Trns.CreateCsysMappingMatrix(abs, vw, mx, irc)
        ufs.Trns.MapPosition(c, mx) 
        MapAbs2View =New Point3d(c(0), c(1), c(2))EndFunction

Viewing all articles
Browse latest Browse all 783

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>