Hi,
I'm working on setting up an IronPython script to control a KMotion 6 axis machine. I have successfully executed individual axis control functions but am having difficulty executing CoordMotion functions such as StraightFeed and ArcFeed
Here is my reference code, I've been operating on trial and error as there is not much documentation to go off for scripting in Python,
import wpf,sys,clr,System,os.path
from System.Windows import Application, Window
from os.path import dirname
sys.path.append(dirname(dirname(dirname(dirname(os .path.abspath(__file__))))) + r"\KMotion\Release")
# clr.AddReference("KMotion_dotNet")
clr.AddReferenceToFileAndPath('C:\\KMotion433\\Kmo tion\\Release\\Kmotion_dotnet')
from KMotion_dotNet import KM_Controller
from KMotion_dotNet import KM_CoordMotion
from KMotion_dotNet import KM_Interpreter
KM = KM_Controller()
CM = KM_CoordMotion(KM)
MP = CM.MotionParams
MP.BreakAngle = 30
MP.MaxAccelX = 1
MP.MaxAccelY = 1
MP.MaxAccelZ = 1
MP.MaxAccelA = 1
MP.MaxAccelB = 1
MP.MaxAccelC = 1
MP.MaxVelX = 1
MP.MaxVelY = 1
MP.MaxVelZ = 1
MP.MaxVelA = 1
MP.MaxVelB = 1
MP.MaxVelC = 1
MP.CountsPerInchX = 100
MP.CountsPerInchY = 100
MP.CountsPerInchZ = 100
MP.CountsPerInchA = 100
MP.CountsPerInchB = 100
MP.CountsPerInchC = 100
MP.DegreesA = MP.DegreesB = MP.DegreesC = False
MP.ArcsToSegs = True
CM.SetTPParams()
SPEED = 0.5
CM.SetAxisDefinitions(0,1,2,3,4,5)
CM.ClearAbort()
CM.DoKMotionBufCmd('SetBitBuf0')
CM.StartTraverse(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, True, True)
CM.DoKMotionBufCmd('ClearBitBuf0')
# CM.ArcFeed(SPEED, CANON_PLANE_XY, 0.000, 0.500, 0.000, 0.250, DIR_CCW, 0.000, 0.000, 0.000, 0.000, 0, 0)
# CM.ArcFeed(SPEED, CANON_PLANE_XY, 0.000, 0.000, 0.000, 0.250, DIR_CCW, 0.000, 0.000, 0.000, 0.000, 0, 0)
CM.StraightFeed(SPEED, 0, 0.5, 0, 0, 0, 0, 0, 0)
CM.StraightFeed(SPEED, 0.5, 0.5, 0, 0, 0, 0, 1, 1)
CM.StraightFeed(SPEED, 0.5, 0, 0, 0, 0, 0, 2, 2)
CM.StraightFeed(SPEED, 0, 0, 0, 0, 0, 0, 3, 3)
CM.FlushSegments()
print(CM.BufferedSegments)
print(CM.TotalTimeInBuffer)
I would love some feedback or help on how to execute simple CoordMotion commands in Python!
Thank you