• DuetAPI
  • DuetAPIClient
  • DuetControlServer
  • DuetWebServer
Show / Hide Table of Contents
  • DuetAPI
    • CodeChannel
  • DuetAPI.Commands
    • Acknowledge
    • AddHttpEndpoint
    • AddUserSession
    • BaseCommand
    • BaseResponse
    • Cancel
    • CheckPassword
    • Code
    • CodeFlags
    • CodeParameter
    • CodeParameterConverter
    • CodeParserBuffer
    • CodeParserException
    • CodeType
    • Command
    • Command<T>
    • ErrorResponse
    • EvaluateExpression
    • Flush
    • GetFileInfo
    • GetObjectModel
    • HttpResponseType
    • Ignore
    • InstallPlugin
    • InstallSystemPackage
    • InvalidateChannel
    • KeywordType
    • LockObjectModel
    • PatchObjectModel
    • ReceivedHttpRequest
    • ReloadPlugin
    • RemoveHttpEndpoint
    • RemoveUserSession
    • Resolve
    • ResolvePath
    • Response<T>
    • SendHttpResponse
    • SetNetworkProtocol
    • SetObjectModel
    • SetPluginData
    • SetPluginProcess
    • SetUpdateStatus
    • SimpleCode
    • StartPlugin
    • StartPlugins
    • StopPlugin
    • StopPlugins
    • SyncObjectModel
    • UninstallPlugin
    • UninstallSystemPackage
    • UnlockObjectModel
    • WriteMessage
  • DuetAPI.Connection
    • ConnectionMode
    • Defaults
    • IncompatibleVersionException
    • InterceptionMode
    • SubscriptionMode
  • DuetAPI.Connection.InitMessages
    • ClientInitMessage
    • CodeStreamInitMessage
    • CommandInitMessage
    • InterceptInitMessage
    • PluginServiceInitMessage
    • ServerInitMessage
    • SubscribeInitMessage
  • DuetAPI.ObjectModel
    • Accelerometer
    • AccessLevel
    • AnalogSensor
    • AnalogSensorType
    • AnalogSensorTypeConverter
    • Axis
    • BeepRequest
    • Board
    • BoardState
    • Build
    • BuildObject
    • ClosedLoop
    • Compatibility
    • CoreKinematics
    • CurrentMove
    • DeltaKinematics
    • DeltaTower
    • DeserializationFailedEventArgs
    • DeserializationFailedEventHandler
    • DirectDisplay
    • Directories
    • DistanceUnit
    • DistanceUnitConverter
    • Driver
    • DriverSettings
    • Endstop
    • EndstopType
    • Extruder
    • ExtruderNonlinear
    • Fan
    • FanThermostaticControl
    • FilamentMonitor
    • FilamentMonitorStatus
    • FilamentMonitorType
    • GCodeFileInfo
    • GCodeFileInfoConverter
    • GpInputPort
    • GpOutputPort
    • HangprinterKinematics
    • Heat
    • Heater
    • HeaterModel
    • HeaterModelPID
    • HeaterMonitor
    • HeaterMonitorAction
    • HeaterMonitorCondition
    • HeaterState
    • HttpEndpoint
    • HttpEndpointType
    • IGrowingModelCollection
    • IModelCollection
    • IModelDictionary
    • IModelObject
    • InputChannel
    • InputChannelState
    • Inputs
    • InputShaping
    • InputShapingType
    • Job
    • Kinematics
    • KinematicsName
    • KinematicsNameConverter
    • LaserFilamentMonitor
    • LaserFilamentMonitorCalibrated
    • LaserFilamentMonitorConfigured
    • Layer
    • Limits
    • LogLevel
    • MachineMode
    • MachineStatus
    • Message
    • MessageBox
    • MessageBoxMode
    • MessageType
    • Microstepping
    • MinMaxCurrent<T>
    • ModelCollection<T>
    • ModelDictionary<TValue>
    • ModelDictionaryConverter
    • ModelGrowingCollection<T>
    • ModelObject
    • MotorsIdleControl
    • Move
    • MoveCalibration
    • MoveCompensation
    • MoveCompensationType
    • MoveDeviations
    • MoveQueueItem
    • MoveRotation
    • MoveSegmentation
    • Network
    • NetworkInterface
    • NetworkInterfaceType
    • NetworkProtocol
    • NetworkState
    • ObjectModel
    • ObjectModelConverter
    • Plugin
    • PluginManifest
    • PolarKinematics
    • Probe
    • ProbeGrid
    • ProbeType
    • PulsedFilamentMonitor
    • PulsedFilamentMonitorCalibrated
    • PulsedFilamentMonitorConfigured
    • RestorePoint
    • RotatingMagnetFilamentMonitor
    • RotatingMagnetFilamentMonitorCalibrated
    • RotatingMagnetFilamentMonitorConfigured
    • SbcPropertyAttribute
    • Scanner
    • ScannerStatus
    • ScaraKinematics
    • Sensors
    • SessionType
    • Skew
    • Spindle
    • SpindleState
    • StallDetectSettings
    • State
    • ThumbnailInfo
    • ThumbnailInfoFormat
    • TiltCorrection
    • TimesLeft
    • Tool
    • ToolRetraction
    • ToolState
    • UserSession
    • Volume
    • ZLeadscrewKinematics
  • DuetAPI.Utility
    • DriverId
    • DriverIdJsonConverter
    • FileLists
    • Heightmap
    • JsonCamelCaseStringEnumConverter
    • JsonCharEnumConverter
    • JsonHelper
    • JsonLowerCaseStringEnumConverter
    • JsonPolymorphicWriteOnlyConverter<T>
    • JsonRegexListConverter
    • JsonShortDateTimeConverter
    • RequiredPermissionsAttribute
    • SbcPermissions
    • SbcPermissionsConverter
  • DuetAPIClient
    • BaseCommandConnection
    • BaseConnection
    • CodeStreamConnection
    • CommandConnection
    • HttpEndpointConnection
    • HttpEndpointUnixSocket
    • HttpEndpointUnixSocket.EndpointRequestReceived
    • InterceptConnection
    • InternalServerException
    • SubscribeConnection
  • DuetControlServer
    • Program
    • Settings
  • DuetControlServer.Codes
    • GCodes
    • Keywords
    • MCodes
    • TCodes
  • DuetControlServer.Commands
    • AddHttpEndpoint
    • AddUserSession
    • CheckPassword
    • Code
    • EvaluateExpression
    • Flush
    • GetFileInfo
    • GetObjectModel
    • IConnectionCommand
    • InstallPlugin
    • InstallSystemPackage
    • InvalidateChannel
    • LockObjectModel
    • PatchObjectModel
    • ReloadPlugin
    • RemoveHttpEndpoint
    • RemoveUserSession
    • ResolvePath
    • SetNetworkProtocol
    • SetObjectModel
    • SetPluginData
    • SetPluginProcess
    • SetUpdateStatus
    • SimpleCode
    • StartPlugin
    • StartPlugins
    • StopPlugin
    • StopPlugins
    • SyncObjectModel
    • UninstallPlugin
    • UninstallSystemPackage
    • UnlockObjectModel
    • WriteMessage
  • DuetControlServer.FileExecution
    • Job
    • Macro
  • DuetControlServer.Files
    • CodeBlock
    • CodeFile
    • FileDirectory
    • FilePath
    • InfoParser
  • DuetControlServer.Files.ImageProcessing
    • IconImageParser
    • ImageParser
    • ImageProcessingException
  • DuetControlServer.IPC
    • Connection
    • LockManager
    • Server
  • DuetControlServer.IPC.Processors
    • Base
    • CodeInterception
    • CodeStream
    • Command
    • ModelSubscription
    • PluginService
  • DuetControlServer.Model
    • Expressions
    • Filter
    • ItemPathNode
    • Observer
    • Observer.PropertyPathChanged
    • PeriodicUpdater
    • PropertyChangeType
    • Provider
    • Updater
  • DuetControlServer.SPI
    • DataTransfer
    • EvaluateExpressionRequest
    • Interface
    • Interface.MovementLock
    • VariableRequest
  • DuetControlServer.SPI.Channel
    • LockRequest
    • Manager
    • Processor
    • State
  • DuetControlServer.SPI.Communication
    • Consts
  • DuetControlServer.SPI.Communication.FirmwareRequests
    • AbortFileHeader
    • CodeBufferUpdateHeader
    • DoCodeHeader
    • EvaluationResultHeader
    • ExecuteMacroHeader
    • FileChunkHeader
    • FileHandleHeader
    • OpenFileHeader
    • PrintPausedHeader
    • PrintPausedReason
    • ReadFileHeader
    • Request
    • SeekFileHeader
  • DuetControlServer.SPI.Communication.SbcRequests
    • AssignFilamentHeader
    • BooleanHeader
    • CodeFlags
    • CodeHeader
    • CodeParameter
    • DeleteLocalVariableHeader
    • FileChunkHeader
    • FileDataHeader
    • GetObjectModelHeader
    • MacroCompleteHeader
    • OpenFileResult
    • PrintStartedHeader
    • PrintStoppedHeader
    • Request
    • SetObjectModelHeader
    • SetVariableHeader
  • DuetControlServer.SPI.Communication.Shared
    • CodeChannelHeader
    • DataType
    • HeightMapHeader
    • MessageHeader
    • MessageTypeFlags
    • PacketHeader
    • PrintStoppedReason
    • StringHeader
    • TransferHeader
    • TransferResponse
  • DuetControlServer.SPI.Serialization
    • Reader
    • Writer
  • DuetControlServer.Utility
    • CRC16
    • CRC32
    • Firmware
    • Logger
    • PriorityThreadRunner
  • DuetWebServer
    • Program
    • Startup
  • DuetWebServer.Authorization
    • Policies
    • SessionKeyAuthenticationHandler
    • SessionKeyAuthenticationSchemeOptions
  • DuetWebServer.Controllers
    • MachineController
    • WebSocketController
  • DuetWebServer.FileProviders
    • DuetFileProvider
  • DuetWebServer.Middleware
    • CustomEndpointMiddleware
    • FallbackMiddleware
    • HttpEndpointConnection
  • DuetWebServer.Services
    • ModelObserver
    • SessionExpiry
  • DuetWebServer.Singletons
    • IModelProvider
    • IModelProvider.WebDirectoryChanged
    • ISessionStorage
    • ModelProvider
    • SessionStorage

Class Macro

Class representing a macro being executed

Inheritance
System.Object
Macro
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: DuetControlServer.FileExecution
Assembly: DuetControlServer.dll
Syntax
public sealed class Macro : IDisposable

Constructors

Macro(String, String, CodeChannel, Boolean, Int32)

Constructor of a macro

Declaration
public Macro(string fileName, string physicalFile, CodeChannel channel, bool isNested = false, int sourceConnection = 0)
Parameters
Type Name Description
System.String fileName

Filename of the macro

System.String physicalFile

Physical path of the macro

CodeChannel channel

Code requesting the macro

System.Boolean isNested

Whether the code was started from a G/M/T-code

System.Int32 sourceConnection

Original IPC connection requesting this macro file

Properties

CancellationToken

Cancellation token that is triggered when the file is cancelled/aborted

Declaration
public CancellationToken CancellationToken { get; }
Property Value
Type Description
System.Threading.CancellationToken

Channel

Channel on which this macro is running

Declaration
public CodeChannel Channel { get; }
Property Value
Type Description
CodeChannel

FileName

Name of the file being executed

Declaration
public string FileName { get; }
Property Value
Type Description
System.String

FileOpened

Indicates if the macro file could be opened

Declaration
public bool FileOpened { get; }
Property Value
Type Description
System.Boolean

IsAborted

Indicates if the macro file has been aborted

Declaration
public bool IsAborted { get; }
Property Value
Type Description
System.Boolean

IsConfig

Whether this file is config.g or config.g.bak

Declaration
public bool IsConfig { get; }
Property Value
Type Description
System.Boolean

IsConfigOverride

Whether this file is config-override.g

Declaration
public bool IsConfigOverride { get; }
Property Value
Type Description
System.Boolean

IsExecuting

Indicates if the macro file is being executed

Declaration
public bool IsExecuting { get; set; }
Property Value
Type Description
System.Boolean

IsNested

Indicates if this macro was started from a G/M/T-code

Declaration
public bool IsNested { get; }
Property Value
Type Description
System.Boolean

IsPausable

Indicates if this macro can be aborted on a pause request

Declaration
public bool IsPausable { get; set; }
Property Value
Type Description
System.Boolean

JustStarted

Indicates if the macro file has just started

Declaration
public bool JustStarted { get; set; }
Property Value
Type Description
System.Boolean

SourceConnection

IPC connection that (indirectly) requested this macro file

Declaration
public int SourceConnection { get; }
Property Value
Type Description
System.Int32

Methods

Abort()

Abort this macro

Declaration
public void Abort()

AbortAsync()

Abort this macro asynchronously

Declaration
public async Task AbortAsync()
Returns
Type Description
System.Threading.Tasks.Task

Asynchronous task

Dispose()

Dispose this instance

Declaration
public void Dispose()

FinishAsync()

Wait for this macro to finish asynchronously

Declaration
public Task FinishAsync()
Returns
Type Description
System.Threading.Tasks.Task

Asynchronous task

Remarks

This task is always resolved and never cancelled

Lock()

Lock this instance

Declaration
public IDisposable Lock()
Returns
Type Description
System.IDisposable

Disposable lock

LockAsync()

Lock this instance asynchronously

Declaration
public AwaitableDisposable<IDisposable> LockAsync()
Returns
Type Description
Nito.AsyncEx.AwaitableDisposable<System.IDisposable>

Disposable lock

WaitForCodeFinish()

Method to wait until a new code can be finished in the right order

Declaration
public AwaitableDisposable<IDisposable> WaitForCodeFinish()
Returns
Type Description
Nito.AsyncEx.AwaitableDisposable<System.IDisposable>

Disposable lock

Remarks

This is required in case a flush is requested before another nested macro is started

WaitForCodeStart()

Method to wait until a new code can be started in the right order

Declaration
public AwaitableDisposable<IDisposable> WaitForCodeStart()
Returns
Type Description
Nito.AsyncEx.AwaitableDisposable<System.IDisposable>

Disposable lock

Remarks

This is required in case a flush is requested before another nested macro is started

Implements

System.IDisposable
In This Article
Back to top Generated by DocFX