MC-Basic:WITH
Language: | [[::MC-Basic:WITH|English]] • [[::MC-Basic:WITH/zh-hans|中文(简体)]] |
---|
This command sets a default motion element (axis or group). Thereafter, the motion element is operated on without having to explicitly indicate the motion element name. The default motion element exists only in a With block, which is terminated by the End With keywords.
Syntax
With <element name>
Availability
All versions
Scope
Configuration, Task or Terminal
In the Configuration scope, the specified motion element becomes the default motion element for the system unless there is another WITH command inside other scopes.
In Config.prg or the terminal, the End With keywords are not required. In the task scope, the End With keywords are required. A WITH command used inside the terminal scope does not affect any programs or vice-versa.
Limitations
The WITH command cannot be set in run time. WITH commands cannot be nested.Each with block must be explicitly created and explicitly terminated before executing another with statement. A subroutine called from within a WITH block does not inherit the default motion element, so the element is not defined within the subroutine, and an error is flagged. A GOTO command is not allowed inside a WITH block; an error is flagged.
Examples
A1.VMax=5000
A1.Vord=5000
A1.VCruise=3000
A1.PEMax=10
A1.PESettle=0.01
Move A1 100
Can be simplified using:
With A1
VMax=5000
Vord=5000
VCruise=3000
PEMax=10
PESettle=0.01
Move 100
End With