NX Journal Vector selection dialog
2021/05/22 categories:NX Journal| tags:NX Journal|Python|
The processing contents are as follows.
- Display vector selection dialog
- User select vector
- View results
The result is displayed in the information window as follows.
<class 'int'> : 13
<class 'list'> : [0.0, 1.0, 0.0]
<class 'list'> : [0.0, 0.0, 0.0]
Code
import NXOpen
from NXOpen import UF
def main():
theSession = NXOpen.Session.GetSession()
lw = theSession.ListingWindow
lw.Open()
response, direction, origin = specify_vector('aaaaa')
lw.WriteLine( str(type(response)) + ' : ' + str(response) )
lw.WriteLine( str(type(direction)) + ' : ' + str(direction) )
lw.WriteLine( str(type(origin)) + ' : ' + str(origin) )
def specify_vector(message):
theUfSession = NXOpen.UF.UFSession.GetUFSession()
mode = NXOpen.UF.UFConstants.UF_UI_INFERRED
displayConehead = NXOpen.UF.UFConstants.UF_UI_DISP_TEMP_VECTOR
theUI = NXOpen.UI.GetUI()
theUI.LockAccess()
response, direction, origin = theUfSession.Ui.SpecifyVector(message, mode, displayConehead)
theUI.UnlockAccess()
return response, direction, origin
if __name__ == '__main__':
main()