Hi vpt.se,
TOUCHSPEED already exists in my part program - I just want to be able to modify the value berfore I execute it.
I already do something similar to set other values in my part program, like this...
Private WithEvents mobjCurrentPart As PCDLRN.PartProgram
Dim pcdCommand As PCDLRN.Command
Dim strID As String
Dim lRAAngle As Long
lRAAngle = 45
For Each pcdCommand In mobjCurrentPart.Commands
If pcdCommand.IsFlowControl = True Then
strID = pcdCommand.GetText(DEST_EXPR, 0)
Select Case strID
Case "ANGLE"
Call pcdCommand.PutText(QUOTES & lRAAngle & QUOTES, SRC_EXPR, 0)
End Select
Call pcdCommand.ReDraw
End If
Next pcdCommand
Problem is TOUCHSPEED can't be set in the same way as it seems it's type is not FlowControl (i.e. pcdCommand.IsFlowControl).
Dim DmisApp As Object
Dim DmisPart As Object
Dim DmisCommands As Object
Dim DmisCommand As Object
Sub Main
Set DmisApp = CreateObject("PCDLRN.Application")
Set DmisPart = DmisApp.ActivePartProgram
Set DmisCommands = DmisPart.Commands
CommandCount = DmisCommands.Count
Set DmisCommand = DmisCommands.Item(CommandCount)
DmisCommands.InsertionPointAfter DmisCommand
' Set Move Speed = 100
Set DmisCommand = DmisCommands.Add(MOVE_SPEED, TRUE)
DmisCommand.Marked = TRUE
retval = DmisCommand.PutText ("100", F_MOVESPEED, 0)
' Set Touch Speed = 4
Set DmisCommand = DmisCommands.Add(TOUCH_SPEED, TRUE)
DmisCommand.Marked = TRUE
retval = DmisCommand.PutText ("4", F_TOUCHSPEED, 0)
' Set Scan Speed = 50
Set DmisCommand = DmisCommands.Add(SCAN_SPEED, TRUE)
DmisCommand.Marked = TRUE
retval = DmisCommand.PutText ("50", F_SCANSPEED, 0)
' Set Max Acceleration
Set DmisCommand = DmisCommands.Add(OPTIONMOTION, TRUE)
DmisCommand.Marked = TRUE
' X = 1000
retval = DmisCommand.PutText ("2500", F_MAXACCELX, 0)
' Y = 1000
retval = DmisCommand.PutText ("2500", F_MAXACCELY, 0)
' Z = 1000
retval = DmisCommand.PutText ("2500", F_MAXACCELZ, 0)
If Not mdTouchSpeed = 0 Then
For Each pcdCommand In mobjCurrentPart.Commands
If pcdCommand.Type = TOUCH_SPEED Then
Call pcdCommand.PutText(mdTouchSpeed, F_TOUCHSPEED, 0)
Call pcdCommand.ReDraw
End If
Next pcdCommand
End If