EasyManua.ls Logo

Newport MKS HXP Series - HXP Command Interface Examples; Python Script Example for HXP Commands

Newport MKS HXP Series
108 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
HXP Command Interface Manual
3.0 Examples
3.1 Python Script
#========================================================================
=
# Newport Proprietary and Confidential Newport Corporation 2011
#
# No part of this file in any format, with or without modification
# shall be used, copied or distributed without the express written
# consent of Newport Corporation.
#
# Description: This is a sample Python Script to illustrate how to
execute
# "query” commands.
#========================================================================
#========================================================================
#Initialization Start The script within Initialization Start and
#Initialization End is needed for #properly
#Command Interface DLL for HXP #instrument. The user should copy this
code as
#is and specify correct paths here.
import sys
import time
#Command Interface DLL can be found here.
sys.path.append(r'C:\Program Files (x86)\Newport\MotionControl\HXP\Bin')
# The CLR module provide functions for interacting with the underlying
# .NET runtime
import clr
# Add reference to assembly and import names from namespace (IronPython)
clr.AddReferenceToFile("Newport.HXP.CommandInterface.dll")
from CommandInterface HXP import *
import System
#========================================================================
# Instrument Initialization
# The key should have double slashes since
# (one of them is escape character)
address="192.168.33.3"
port=5001
# Create an HXP instance
hxp = HXP()
print '--------------- General data ---------------'
# Connect and open a socket
result = hxp.
OpenInstrument(address, port, 1000)
if result == 0 :
print 'Connection ', address, ":", port, " => Successful"
else:
print 'Connection ', address, ":", port, " => failure ", result
# Get controller revision information
result, response, errString = hxp.FirmwareVersionGet()
if result == 0 :
print 'Controller version: ', response
else:
print 'Error=>',errString
EDH0318En1042 — 12/18 94

Table of Contents

Related product manuals