mirror of
https://git.mirrors.martin98.com/https://github.com/petaflot/pygcode
synced 2025-06-04 11:25:20 +08:00
forgot a few things... it should work
This commit is contained in:
parent
e650d2efb4
commit
adeca53ace
@ -192,261 +192,266 @@ from .words import (
|
||||
)
|
||||
|
||||
# GCode
|
||||
from .gcodes import (
|
||||
words2gcodes, text2gcodes, split_gcodes,
|
||||
# $ python -c "from pygcode.gcodes import _gcode_class_infostr as x; print(x(prefix=' # '))"
|
||||
# - GCode:
|
||||
# - GCodeCannedCycle:
|
||||
# G89 - GCodeBoringCycleDwellFeedOut: G89: Boring Cycle, Dwell, Feed Out
|
||||
# G85 - GCodeBoringCycleFeedOut: G85: Boring Cycle, Feed Out
|
||||
# G81 - GCodeDrillingCycle: G81: Drilling Cycle
|
||||
# G73 - GCodeDrillingCycleChipBreaking: G73: Drilling Cycle, ChipBreaking
|
||||
# G82 - GCodeDrillingCycleDwell: G82: Drilling Cycle, Dwell
|
||||
# G83 - GCodeDrillingCyclePeck: G83: Drilling Cycle, Peck
|
||||
# G76 - GCodeThreadingCycle: G76: Threading Cycle
|
||||
# - GCodeCannedReturnMode:
|
||||
# G98 - GCodeCannedCycleReturnPrevLevel: G98: Canned Cycle Return to the level set prior to cycle start
|
||||
# G99 - GCodeCannedCycleReturnToR: G99: Canned Cycle Return to the level set by R
|
||||
# - GCodeCoolant:
|
||||
# M08 - GCodeCoolantFloodOn: M8: turn flood coolant on
|
||||
# M07 - GCodeCoolantMistOn: M7: turn mist coolant on
|
||||
# M09 - GCodeCoolantOff: M9: turn all coolant off
|
||||
# - GCodeCutterRadiusComp:
|
||||
# G41 - GCodeCutterCompLeft: G41: Cutter Radius Compensation (left)
|
||||
# G42 - GCodeCutterCompRight: G42: Cutter Radius Compensation (right)
|
||||
# G40 - GCodeCutterRadiusCompOff: G40: Cutter Radius Compensation Off
|
||||
# G41.1 - GCodeDynamicCutterCompLeft: G41.1: Dynamic Cutter Radius Compensation (left)
|
||||
# G42.1 - GCodeDynamicCutterCompRight: G42.1: Dynamic Cutter Radius Compensation (right)
|
||||
# - GCodeDefinition:
|
||||
# - GCodeLineNumber: N: Line Number
|
||||
# - GCodeProgramName: O: Program Name
|
||||
# - GCodeDistanceMode:
|
||||
# G90.1 - GCodeAbsoluteArcDistanceMode: G90.1: Absolute Distance Mode for Arc IJK Parameters
|
||||
# G90 - GCodeAbsoluteDistanceMode: G90: Absolute Distance Mode
|
||||
# G91.1 - GCodeIncrementalArcDistanceMode: G91.1: Incremental Distance Mode for Arc IJK Parameters
|
||||
# G91 - GCodeIncrementalDistanceMode: G91: Incremental Distance Mode
|
||||
# G07 - GCodeLatheDiameterMode: G7: Lathe Diameter Mode
|
||||
# G08 - GCodeLatheRadiusMode: G8: Lathe Radius Mode
|
||||
# - GCodeFeedRateMode:
|
||||
# G93 - GCodeInverseTimeMode: G93: Inverse Time Mode
|
||||
# G94 - GCodeUnitsPerMinuteMode: G94: Units Per MinuteMode
|
||||
# G95 - GCodeUnitsPerRevolution: G95: Units Per Revolution
|
||||
# - GCodeIO:
|
||||
# - GCodeAnalogOutput: Analog Output
|
||||
# M68 - GCodeAnalogOutputImmediate: M68: Analog Output, Immediate
|
||||
# M67 - GCodeAnalogOutputSyncd: M67: Analog Output, Synchronized
|
||||
# - GCodeDigitalOutput: Digital Output Control
|
||||
# M65 - GCodeDigitalOutputOff: M65: turn off digital output immediately
|
||||
# M63 - GCodeDigitalOutputOffSyncd: M63: turn off digital output synchronized with motion
|
||||
# M64 - GCodeDigitalOutputOn: M64: turn on digital output immediately
|
||||
# M62 - GCodeDigitalOutputOnSyncd: M62: turn on digital output synchronized with motion
|
||||
# M66 - GCodeWaitOnInput: M66: Wait on Input
|
||||
# - GCodeMotion:
|
||||
# - GCodeArcMove: Arc Move
|
||||
# G03 - GCodeArcMoveCCW: G3: Arc Move (counter-clockwise)
|
||||
# G02 - GCodeArcMoveCW: G2: Arc Move (clockwise)
|
||||
# G80 - GCodeCancelCannedCycle: G80: Cancel Canned Cycle
|
||||
# G05 - GCodeCublcSpline: G5: Cubic Spline
|
||||
# G04 - GCodeDwell: G4: Dwell
|
||||
# G01 - GCodeLinearMove: G1: Linear Move
|
||||
# G05.2 - GCodeNURBS: G5.2: Non-uniform rational basis spline (NURBS)
|
||||
# G05.3 - GCodeNURBSEnd: G5.3: end NURBS mode
|
||||
# G05.1 - GCodeQuadraticSpline: G5.1: Quadratic Spline
|
||||
# G00 - GCodeRapidMove: G0: Rapid Move
|
||||
# G33.1 - GCodeRigidTapping: G33.1: Rigid Tapping
|
||||
# G33 - GCodeSpindleSyncMotion: G33: Spindle Synchronized Motion
|
||||
# - GCodeStraightProbe: G38.2-G38.5: Straight Probe
|
||||
# - GCodeNonModal:
|
||||
# G92 - GCodeCoordSystemOffset: G92: Coordinate System Offset
|
||||
# - GCodeGotoPredefinedPosition: G28,G30: Goto Predefined Position (rapid movement)
|
||||
# G53 - GCodeMoveInMachineCoords: G53: Move in Machine Coordinates
|
||||
# - GCodeResetCoordSystemOffset: G92.1,G92.2: Reset Coordinate System Offset
|
||||
# G92.3 - GCodeRestoreCoordSystemOffset: G92.3: Restore Coordinate System Offset
|
||||
# G10 - GCodeSet: G10: Set stuff
|
||||
# - GCodeSetPredefinedPosition: G28.1,G30.1: Set Predefined Position
|
||||
# M06 - GCodeToolChange: M6: Tool Change
|
||||
# M61 - GCodeToolSetCurrent: M61: Set Current Tool
|
||||
# - GCodeUserDefined: M101-M199: User Defined Commands
|
||||
# - GCodeOtherModal:
|
||||
# M52 - GCodeAdaptiveFeed: M52: Adaptive Feed Control
|
||||
# M50 - GCodeFeedOverride: M50: Feed Override Control
|
||||
# - GCodeFeedRate: F: Set Feed Rate
|
||||
# M53 - GCodeFeedStop: M53: Feed Stop Control
|
||||
# - GCodeSelectCoordinateSystem: Select Coordinate System
|
||||
# G54 - GCodeSelectCoordinateSystem1: Select Coordinate System 1
|
||||
# G55 - GCodeSelectCoordinateSystem2: Select Coordinate System 2
|
||||
# G56 - GCodeSelectCoordinateSystem3: Select Coordinate System 3
|
||||
# G57 - GCodeSelectCoordinateSystem4: Select Coordinate System 4
|
||||
# G58 - GCodeSelectCoordinateSystem5: Select Coordinate System 5
|
||||
# G59 - GCodeSelectCoordinateSystem6: Select Coordinate System 6
|
||||
# G59.1 - GCodeSelectCoordinateSystem7: Select Coordinate System 7
|
||||
# G59.2 - GCodeSelectCoordinateSystem8: Select Coordinate System 8
|
||||
# G59.3 - GCodeSelectCoordinateSystem9: Select Coordinate System 9
|
||||
# - GCodeSelectTool: T: Select Tool
|
||||
# M49 - GCodeSpeedAndFeedOverrideOff: M49: Speed and Feed Override Control Off
|
||||
# M48 - GCodeSpeedAndFeedOverrideOn: M48: Speed and Feed Override Control On
|
||||
# - GCodeSpindleSpeed: S: Set Spindle Speed
|
||||
# M51 - GCodeSpindleSpeedOverride: M51: Spindle Speed Override Control
|
||||
# - GCodePathControlMode:
|
||||
# G61 - GCodeExactPathMode: G61: Exact path mode
|
||||
# G61.1 - GCodeExactStopMode: G61.1: Exact stop mode
|
||||
# G64 - GCodePathBlendingMode: G64: Path Blending
|
||||
# - GCodePlaneSelect:
|
||||
# G17.1 - GCodeSelectUVPlane: G17.1: select UV plane
|
||||
# G19.1 - GCodeSelectVWPlane: G19.1: select VW plane
|
||||
# G18.1 - GCodeSelectWUPlane: G18.1: select WU plane
|
||||
# G17 - GCodeSelectXYPlane: G17: select XY plane (default)
|
||||
# G19 - GCodeSelectYZPlane: G19: select YZ plane
|
||||
# G18 - GCodeSelectZXPlane: G18: select ZX plane
|
||||
# - GCodeProgramControl:
|
||||
# M02 - GCodeEndProgram: M2: Program End
|
||||
# M30 - GCodeEndProgramPalletShuttle: M30: exchange pallet shuttles and end the program
|
||||
# M60 - GCodePalletChangePause: M60: Pallet Change Pause
|
||||
# M00 - GCodePauseProgram: M0: Program Pause
|
||||
# M01 - GCodePauseProgramOptional: M1: Program Pause (optional)
|
||||
# - GCodeSpindle:
|
||||
# M19 - GCodeOrientSpindle: M19: Orient Spindle
|
||||
# - GCodeSpindleSpeedMode:
|
||||
# G96 - GCodeSpindleConstantSurfaceSpeedMode: G96: Spindle Constant Surface Speed
|
||||
# G97 - GCodeSpindleRPMMode: G97: Spindle RPM Speed
|
||||
# - GCodeStartSpindle: M3,M4: Start Spindle Clockwise
|
||||
# M04 - GCodeStartSpindleCCW: M4: Start Spindle Counter-Clockwise
|
||||
# M03 - GCodeStartSpindleCW: M3: Start Spindle Clockwise
|
||||
# M05 - GCodeStopSpindle: M5: Stop Spindle
|
||||
# - GCodeToolLength:
|
||||
# G43.2 - GCodeAddToolLengthOffset: G43.2: Appkly Additional Tool Length Offset
|
||||
# G49 - GCodeCancelToolLengthOffset: G49: Cancel Tool Length Compensation
|
||||
# G43.1 - GCodeDynamicToolLengthOffset: G43.1: Dynamic Tool Length Offset
|
||||
# G43 - GCodeToolLengthOffset: G43: Tool Length Offset
|
||||
# - GCodeUnit:
|
||||
# G20 - GCodeUseInches: G20: use inches for length units
|
||||
# G21 - GCodeUseMillimeters: G21: use millimeters for length units
|
||||
|
||||
# $ python -c "from pygcode.gcodes import GCode, _subclasses as sc; print(',\\n '.join(sorted(g.__name__ for g in sc(GCode))))"
|
||||
GCode,
|
||||
GCodeAbsoluteArcDistanceMode,
|
||||
GCodeAbsoluteDistanceMode,
|
||||
GCodeAdaptiveFeed,
|
||||
GCodeAddToolLengthOffset,
|
||||
GCodeAnalogOutput,
|
||||
GCodeAnalogOutputImmediate,
|
||||
GCodeAnalogOutputSyncd,
|
||||
GCodeArcMove,
|
||||
GCodeArcMoveCCW,
|
||||
GCodeArcMoveCW,
|
||||
GCodeBoringCycleDwellFeedOut,
|
||||
GCodeBoringCycleFeedOut,
|
||||
#GCodeCancelCannedCycle,
|
||||
GCodeCancelToolLengthOffset,
|
||||
GCodeCannedCycle,
|
||||
GCodeCannedCycleReturnPrevLevel,
|
||||
GCodeCannedCycleReturnToR,
|
||||
GCodeCannedReturnMode,
|
||||
GCodeCoolant,
|
||||
GCodeCoolantFloodOn,
|
||||
GCodeCoolantMistOn,
|
||||
GCodeCoolantOff,
|
||||
GCodeCoordSystemOffset,
|
||||
GCodeCublcSpline,
|
||||
GCodeCutterCompLeft,
|
||||
GCodeCutterCompRight,
|
||||
GCodeCutterRadiusComp,
|
||||
GCodeCutterRadiusCompOff,
|
||||
GCodeDefinition,
|
||||
GCodeDigitalOutput,
|
||||
GCodeDigitalOutputOff,
|
||||
GCodeDigitalOutputOffSyncd,
|
||||
GCodeDigitalOutputOn,
|
||||
GCodeDigitalOutputOnSyncd,
|
||||
GCodeDistanceMode,
|
||||
GCodeDrillingCycle,
|
||||
GCodeDrillingCycleChipBreaking,
|
||||
GCodeDrillingCycleDwell,
|
||||
GCodeDrillingCyclePeck,
|
||||
GCodeDwell,
|
||||
GCodeDynamicCutterCompLeft,
|
||||
GCodeDynamicCutterCompRight,
|
||||
GCodeDynamicToolLengthOffset,
|
||||
GCodeEndProgram,
|
||||
GCodeEndProgramPalletShuttle,
|
||||
GCodeExactPathMode,
|
||||
GCodeExactStopMode,
|
||||
GCodeFeedOverride,
|
||||
GCodeFeedRate,
|
||||
GCodeFeedRateMode,
|
||||
GCodeFeedStop,
|
||||
GCodeGotoPredefinedPosition,
|
||||
GCodeIO,
|
||||
GCodeIncrementalArcDistanceMode,
|
||||
GCodeIncrementalDistanceMode,
|
||||
GCodeInverseTimeMode,
|
||||
GCodeLatheDiameterMode,
|
||||
GCodeLatheRadiusMode,
|
||||
GCodeLineNumber,
|
||||
GCodeLinearMove,
|
||||
GCodeMotion,
|
||||
GCodeMoveInMachineCoords,
|
||||
GCodeNURBS,
|
||||
GCodeNURBSEnd,
|
||||
GCodeNonModal,
|
||||
GCodeOrientSpindle,
|
||||
GCodeOtherModal,
|
||||
GCodePalletChangePause,
|
||||
GCodePathBlendingMode,
|
||||
GCodePathControlMode,
|
||||
GCodePauseProgram,
|
||||
GCodePauseProgramOptional,
|
||||
GCodePlaneSelect,
|
||||
GCodeProgramControl,
|
||||
GCodeProgramName,
|
||||
GCodeQuadraticSpline,
|
||||
GCodeRapidMove,
|
||||
GCodeResetCoordSystemOffset,
|
||||
GCodeRestoreCoordSystemOffset,
|
||||
GCodeRigidTapping,
|
||||
GCodeSelectCoordinateSystem,
|
||||
GCodeSelectCoordinateSystem1,
|
||||
GCodeSelectCoordinateSystem2,
|
||||
GCodeSelectCoordinateSystem3,
|
||||
GCodeSelectCoordinateSystem4,
|
||||
GCodeSelectCoordinateSystem5,
|
||||
GCodeSelectCoordinateSystem6,
|
||||
GCodeSelectCoordinateSystem7,
|
||||
GCodeSelectCoordinateSystem8,
|
||||
GCodeSelectCoordinateSystem9,
|
||||
GCodeSelectTool,
|
||||
GCodeSelectUVPlane,
|
||||
GCodeSelectVWPlane,
|
||||
GCodeSelectWUPlane,
|
||||
GCodeSelectXYPlane,
|
||||
GCodeSelectYZPlane,
|
||||
GCodeSelectZXPlane,
|
||||
GCodeSet,
|
||||
GCodeSetPredefinedPosition,
|
||||
GCodeSpeedAndFeedOverrideOff,
|
||||
GCodeSpeedAndFeedOverrideOn,
|
||||
GCodeSpindle,
|
||||
GCodeSpindleConstantSurfaceSpeedMode,
|
||||
GCodeSpindleRPMMode,
|
||||
GCodeSpindleSpeed,
|
||||
GCodeSpindleSpeedMode,
|
||||
GCodeSpindleSpeedOverride,
|
||||
GCodeSpindleSyncMotion,
|
||||
GCodeStartSpindle,
|
||||
GCodeStartSpindleCCW,
|
||||
GCodeStartSpindleCW,
|
||||
GCodeStopSpindle,
|
||||
GCodeStraightProbe,
|
||||
GCodeThreadingCycle,
|
||||
GCodeToolChange,
|
||||
GCodeToolLength,
|
||||
GCodeToolLengthOffset,
|
||||
GCodeToolSetCurrent,
|
||||
GCodeUnit,
|
||||
GCodeUnitsPerMinuteMode,
|
||||
GCodeUnitsPerRevolution,
|
||||
GCodeUseInches,
|
||||
GCodeUseMillimeters,
|
||||
GCodeUserDefined,
|
||||
GCodeWaitOnInput
|
||||
)
|
||||
from pygcode.dialects import get_default as get_default_dialect
|
||||
match get_default_dialect():
|
||||
case 'marlin2':
|
||||
pass
|
||||
case _:
|
||||
from .gcodes import (
|
||||
words2gcodes, text2gcodes, split_gcodes,
|
||||
# $ python -c "from pygcode.gcodes import _gcode_class_infostr as x; print(x(prefix=' # '))"
|
||||
# - GCode:
|
||||
# - GCodeCannedCycle:
|
||||
# G89 - GCodeBoringCycleDwellFeedOut: G89: Boring Cycle, Dwell, Feed Out
|
||||
# G85 - GCodeBoringCycleFeedOut: G85: Boring Cycle, Feed Out
|
||||
# G81 - GCodeDrillingCycle: G81: Drilling Cycle
|
||||
# G73 - GCodeDrillingCycleChipBreaking: G73: Drilling Cycle, ChipBreaking
|
||||
# G82 - GCodeDrillingCycleDwell: G82: Drilling Cycle, Dwell
|
||||
# G83 - GCodeDrillingCyclePeck: G83: Drilling Cycle, Peck
|
||||
# G76 - GCodeThreadingCycle: G76: Threading Cycle
|
||||
# - GCodeCannedReturnMode:
|
||||
# G98 - GCodeCannedCycleReturnPrevLevel: G98: Canned Cycle Return to the level set prior to cycle start
|
||||
# G99 - GCodeCannedCycleReturnToR: G99: Canned Cycle Return to the level set by R
|
||||
# - GCodeCoolant:
|
||||
# M08 - GCodeCoolantFloodOn: M8: turn flood coolant on
|
||||
# M07 - GCodeCoolantMistOn: M7: turn mist coolant on
|
||||
# M09 - GCodeCoolantOff: M9: turn all coolant off
|
||||
# - GCodeCutterRadiusComp:
|
||||
# G41 - GCodeCutterCompLeft: G41: Cutter Radius Compensation (left)
|
||||
# G42 - GCodeCutterCompRight: G42: Cutter Radius Compensation (right)
|
||||
# G40 - GCodeCutterRadiusCompOff: G40: Cutter Radius Compensation Off
|
||||
# G41.1 - GCodeDynamicCutterCompLeft: G41.1: Dynamic Cutter Radius Compensation (left)
|
||||
# G42.1 - GCodeDynamicCutterCompRight: G42.1: Dynamic Cutter Radius Compensation (right)
|
||||
# - GCodeDefinition:
|
||||
# - GCodeLineNumber: N: Line Number
|
||||
# - GCodeProgramName: O: Program Name
|
||||
# - GCodeDistanceMode:
|
||||
# G90.1 - GCodeAbsoluteArcDistanceMode: G90.1: Absolute Distance Mode for Arc IJK Parameters
|
||||
# G90 - GCodeAbsoluteDistanceMode: G90: Absolute Distance Mode
|
||||
# G91.1 - GCodeIncrementalArcDistanceMode: G91.1: Incremental Distance Mode for Arc IJK Parameters
|
||||
# G91 - GCodeIncrementalDistanceMode: G91: Incremental Distance Mode
|
||||
# G07 - GCodeLatheDiameterMode: G7: Lathe Diameter Mode
|
||||
# G08 - GCodeLatheRadiusMode: G8: Lathe Radius Mode
|
||||
# - GCodeFeedRateMode:
|
||||
# G93 - GCodeInverseTimeMode: G93: Inverse Time Mode
|
||||
# G94 - GCodeUnitsPerMinuteMode: G94: Units Per MinuteMode
|
||||
# G95 - GCodeUnitsPerRevolution: G95: Units Per Revolution
|
||||
# - GCodeIO:
|
||||
# - GCodeAnalogOutput: Analog Output
|
||||
# M68 - GCodeAnalogOutputImmediate: M68: Analog Output, Immediate
|
||||
# M67 - GCodeAnalogOutputSyncd: M67: Analog Output, Synchronized
|
||||
# - GCodeDigitalOutput: Digital Output Control
|
||||
# M65 - GCodeDigitalOutputOff: M65: turn off digital output immediately
|
||||
# M63 - GCodeDigitalOutputOffSyncd: M63: turn off digital output synchronized with motion
|
||||
# M64 - GCodeDigitalOutputOn: M64: turn on digital output immediately
|
||||
# M62 - GCodeDigitalOutputOnSyncd: M62: turn on digital output synchronized with motion
|
||||
# M66 - GCodeWaitOnInput: M66: Wait on Input
|
||||
# - GCodeMotion:
|
||||
# - GCodeArcMove: Arc Move
|
||||
# G03 - GCodeArcMoveCCW: G3: Arc Move (counter-clockwise)
|
||||
# G02 - GCodeArcMoveCW: G2: Arc Move (clockwise)
|
||||
# G80 - GCodeCancelCannedCycle: G80: Cancel Canned Cycle
|
||||
# G05 - GCodeCublcSpline: G5: Cubic Spline
|
||||
# G04 - GCodeDwell: G4: Dwell
|
||||
# G01 - GCodeLinearMove: G1: Linear Move
|
||||
# G05.2 - GCodeNURBS: G5.2: Non-uniform rational basis spline (NURBS)
|
||||
# G05.3 - GCodeNURBSEnd: G5.3: end NURBS mode
|
||||
# G05.1 - GCodeQuadraticSpline: G5.1: Quadratic Spline
|
||||
# G00 - GCodeRapidMove: G0: Rapid Move
|
||||
# G33.1 - GCodeRigidTapping: G33.1: Rigid Tapping
|
||||
# G33 - GCodeSpindleSyncMotion: G33: Spindle Synchronized Motion
|
||||
# - GCodeStraightProbe: G38.2-G38.5: Straight Probe
|
||||
# - GCodeNonModal:
|
||||
# G92 - GCodeCoordSystemOffset: G92: Coordinate System Offset
|
||||
# - GCodeGotoPredefinedPosition: G28,G30: Goto Predefined Position (rapid movement)
|
||||
# G53 - GCodeMoveInMachineCoords: G53: Move in Machine Coordinates
|
||||
# - GCodeResetCoordSystemOffset: G92.1,G92.2: Reset Coordinate System Offset
|
||||
# G92.3 - GCodeRestoreCoordSystemOffset: G92.3: Restore Coordinate System Offset
|
||||
# G10 - GCodeSet: G10: Set stuff
|
||||
# - GCodeSetPredefinedPosition: G28.1,G30.1: Set Predefined Position
|
||||
# M06 - GCodeToolChange: M6: Tool Change
|
||||
# M61 - GCodeToolSetCurrent: M61: Set Current Tool
|
||||
# - GCodeUserDefined: M101-M199: User Defined Commands
|
||||
# - GCodeOtherModal:
|
||||
# M52 - GCodeAdaptiveFeed: M52: Adaptive Feed Control
|
||||
# M50 - GCodeFeedOverride: M50: Feed Override Control
|
||||
# - GCodeFeedRate: F: Set Feed Rate
|
||||
# M53 - GCodeFeedStop: M53: Feed Stop Control
|
||||
# - GCodeSelectCoordinateSystem: Select Coordinate System
|
||||
# G54 - GCodeSelectCoordinateSystem1: Select Coordinate System 1
|
||||
# G55 - GCodeSelectCoordinateSystem2: Select Coordinate System 2
|
||||
# G56 - GCodeSelectCoordinateSystem3: Select Coordinate System 3
|
||||
# G57 - GCodeSelectCoordinateSystem4: Select Coordinate System 4
|
||||
# G58 - GCodeSelectCoordinateSystem5: Select Coordinate System 5
|
||||
# G59 - GCodeSelectCoordinateSystem6: Select Coordinate System 6
|
||||
# G59.1 - GCodeSelectCoordinateSystem7: Select Coordinate System 7
|
||||
# G59.2 - GCodeSelectCoordinateSystem8: Select Coordinate System 8
|
||||
# G59.3 - GCodeSelectCoordinateSystem9: Select Coordinate System 9
|
||||
# - GCodeSelectTool: T: Select Tool
|
||||
# M49 - GCodeSpeedAndFeedOverrideOff: M49: Speed and Feed Override Control Off
|
||||
# M48 - GCodeSpeedAndFeedOverrideOn: M48: Speed and Feed Override Control On
|
||||
# - GCodeSpindleSpeed: S: Set Spindle Speed
|
||||
# M51 - GCodeSpindleSpeedOverride: M51: Spindle Speed Override Control
|
||||
# - GCodePathControlMode:
|
||||
# G61 - GCodeExactPathMode: G61: Exact path mode
|
||||
# G61.1 - GCodeExactStopMode: G61.1: Exact stop mode
|
||||
# G64 - GCodePathBlendingMode: G64: Path Blending
|
||||
# - GCodePlaneSelect:
|
||||
# G17.1 - GCodeSelectUVPlane: G17.1: select UV plane
|
||||
# G19.1 - GCodeSelectVWPlane: G19.1: select VW plane
|
||||
# G18.1 - GCodeSelectWUPlane: G18.1: select WU plane
|
||||
# G17 - GCodeSelectXYPlane: G17: select XY plane (default)
|
||||
# G19 - GCodeSelectYZPlane: G19: select YZ plane
|
||||
# G18 - GCodeSelectZXPlane: G18: select ZX plane
|
||||
# - GCodeProgramControl:
|
||||
# M02 - GCodeEndProgram: M2: Program End
|
||||
# M30 - GCodeEndProgramPalletShuttle: M30: exchange pallet shuttles and end the program
|
||||
# M60 - GCodePalletChangePause: M60: Pallet Change Pause
|
||||
# M00 - GCodePauseProgram: M0: Program Pause
|
||||
# M01 - GCodePauseProgramOptional: M1: Program Pause (optional)
|
||||
# - GCodeSpindle:
|
||||
# M19 - GCodeOrientSpindle: M19: Orient Spindle
|
||||
# - GCodeSpindleSpeedMode:
|
||||
# G96 - GCodeSpindleConstantSurfaceSpeedMode: G96: Spindle Constant Surface Speed
|
||||
# G97 - GCodeSpindleRPMMode: G97: Spindle RPM Speed
|
||||
# - GCodeStartSpindle: M3,M4: Start Spindle Clockwise
|
||||
# M04 - GCodeStartSpindleCCW: M4: Start Spindle Counter-Clockwise
|
||||
# M03 - GCodeStartSpindleCW: M3: Start Spindle Clockwise
|
||||
# M05 - GCodeStopSpindle: M5: Stop Spindle
|
||||
# - GCodeToolLength:
|
||||
# G43.2 - GCodeAddToolLengthOffset: G43.2: Appkly Additional Tool Length Offset
|
||||
# G49 - GCodeCancelToolLengthOffset: G49: Cancel Tool Length Compensation
|
||||
# G43.1 - GCodeDynamicToolLengthOffset: G43.1: Dynamic Tool Length Offset
|
||||
# G43 - GCodeToolLengthOffset: G43: Tool Length Offset
|
||||
# - GCodeUnit:
|
||||
# G20 - GCodeUseInches: G20: use inches for length units
|
||||
# G21 - GCodeUseMillimeters: G21: use millimeters for length units
|
||||
|
||||
# $ python -c "from pygcode.gcodes import GCode, _subclasses as sc; print(',\\n '.join(sorted(g.__name__ for g in sc(GCode))))"
|
||||
GCode,
|
||||
GCodeAbsoluteArcDistanceMode,
|
||||
GCodeAbsoluteDistanceMode,
|
||||
GCodeAdaptiveFeed,
|
||||
GCodeAddToolLengthOffset,
|
||||
GCodeAnalogOutput,
|
||||
GCodeAnalogOutputImmediate,
|
||||
GCodeAnalogOutputSyncd,
|
||||
GCodeArcMove,
|
||||
GCodeArcMoveCCW,
|
||||
GCodeArcMoveCW,
|
||||
GCodeBoringCycleDwellFeedOut,
|
||||
GCodeBoringCycleFeedOut,
|
||||
#GCodeCancelCannedCycle,
|
||||
GCodeCancelToolLengthOffset,
|
||||
GCodeCannedCycle,
|
||||
GCodeCannedCycleReturnPrevLevel,
|
||||
GCodeCannedCycleReturnToR,
|
||||
GCodeCannedReturnMode,
|
||||
GCodeCoolant,
|
||||
GCodeCoolantFloodOn,
|
||||
GCodeCoolantMistOn,
|
||||
GCodeCoolantOff,
|
||||
GCodeCoordSystemOffset,
|
||||
GCodeCublcSpline,
|
||||
GCodeCutterCompLeft,
|
||||
GCodeCutterCompRight,
|
||||
GCodeCutterRadiusComp,
|
||||
GCodeCutterRadiusCompOff,
|
||||
GCodeDefinition,
|
||||
GCodeDigitalOutput,
|
||||
GCodeDigitalOutputOff,
|
||||
GCodeDigitalOutputOffSyncd,
|
||||
GCodeDigitalOutputOn,
|
||||
GCodeDigitalOutputOnSyncd,
|
||||
GCodeDistanceMode,
|
||||
GCodeDrillingCycle,
|
||||
GCodeDrillingCycleChipBreaking,
|
||||
GCodeDrillingCycleDwell,
|
||||
GCodeDrillingCyclePeck,
|
||||
GCodeDwell,
|
||||
GCodeDynamicCutterCompLeft,
|
||||
GCodeDynamicCutterCompRight,
|
||||
GCodeDynamicToolLengthOffset,
|
||||
GCodeEndProgram,
|
||||
GCodeEndProgramPalletShuttle,
|
||||
GCodeExactPathMode,
|
||||
GCodeExactStopMode,
|
||||
GCodeFeedOverride,
|
||||
GCodeFeedRate,
|
||||
GCodeFeedRateMode,
|
||||
GCodeFeedStop,
|
||||
GCodeGotoPredefinedPosition,
|
||||
GCodeIO,
|
||||
GCodeIncrementalArcDistanceMode,
|
||||
GCodeIncrementalDistanceMode,
|
||||
GCodeInverseTimeMode,
|
||||
GCodeLatheDiameterMode,
|
||||
GCodeLatheRadiusMode,
|
||||
GCodeLineNumber,
|
||||
GCodeLinearMove,
|
||||
GCodeMotion,
|
||||
GCodeMoveInMachineCoords,
|
||||
GCodeNURBS,
|
||||
GCodeNURBSEnd,
|
||||
GCodeNonModal,
|
||||
GCodeOrientSpindle,
|
||||
GCodeOtherModal,
|
||||
GCodePalletChangePause,
|
||||
GCodePathBlendingMode,
|
||||
GCodePathControlMode,
|
||||
GCodePauseProgram,
|
||||
GCodePauseProgramOptional,
|
||||
GCodePlaneSelect,
|
||||
GCodeProgramControl,
|
||||
GCodeProgramName,
|
||||
GCodeQuadraticSpline,
|
||||
GCodeRapidMove,
|
||||
GCodeResetCoordSystemOffset,
|
||||
GCodeRestoreCoordSystemOffset,
|
||||
GCodeRigidTapping,
|
||||
GCodeSelectCoordinateSystem,
|
||||
GCodeSelectCoordinateSystem1,
|
||||
GCodeSelectCoordinateSystem2,
|
||||
GCodeSelectCoordinateSystem3,
|
||||
GCodeSelectCoordinateSystem4,
|
||||
GCodeSelectCoordinateSystem5,
|
||||
GCodeSelectCoordinateSystem6,
|
||||
GCodeSelectCoordinateSystem7,
|
||||
GCodeSelectCoordinateSystem8,
|
||||
GCodeSelectCoordinateSystem9,
|
||||
GCodeSelectTool,
|
||||
GCodeSelectUVPlane,
|
||||
GCodeSelectVWPlane,
|
||||
GCodeSelectWUPlane,
|
||||
GCodeSelectXYPlane,
|
||||
GCodeSelectYZPlane,
|
||||
GCodeSelectZXPlane,
|
||||
GCodeSet,
|
||||
GCodeSetPredefinedPosition,
|
||||
GCodeSpeedAndFeedOverrideOff,
|
||||
GCodeSpeedAndFeedOverrideOn,
|
||||
GCodeSpindle,
|
||||
GCodeSpindleConstantSurfaceSpeedMode,
|
||||
GCodeSpindleRPMMode,
|
||||
GCodeSpindleSpeed,
|
||||
GCodeSpindleSpeedMode,
|
||||
GCodeSpindleSpeedOverride,
|
||||
GCodeSpindleSyncMotion,
|
||||
GCodeStartSpindle,
|
||||
GCodeStartSpindleCCW,
|
||||
GCodeStartSpindleCW,
|
||||
GCodeStopSpindle,
|
||||
GCodeStraightProbe,
|
||||
GCodeThreadingCycle,
|
||||
GCodeToolChange,
|
||||
GCodeToolLength,
|
||||
GCodeToolLengthOffset,
|
||||
GCodeToolSetCurrent,
|
||||
GCodeUnit,
|
||||
GCodeUnitsPerMinuteMode,
|
||||
GCodeUnitsPerRevolution,
|
||||
GCodeUseInches,
|
||||
GCodeUseMillimeters,
|
||||
GCodeUserDefined,
|
||||
GCodeWaitOnInput
|
||||
)
|
||||
|
@ -19,7 +19,6 @@ from .mapping import word_dialect
|
||||
|
||||
# Dialects
|
||||
from . import linuxcnc
|
||||
from . import reprap
|
||||
from . import prusa
|
||||
from . import marlin2
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# vim: ts=4, number
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
from copy import copy
|
||||
@ -150,7 +151,7 @@ match get_default_dialect():
|
||||
case 'prusa':
|
||||
from .gcodes_prusa import *
|
||||
case _:
|
||||
from .gcodes_lecacy import *
|
||||
from .gcodes_legacy import *
|
||||
|
||||
# ======================= Utilities =======================
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
from .gcodes import MODAL_GROUP_MAP
|
||||
from .words import Word, text2words
|
||||
|
||||
class GCode(object):
|
||||
# Defining Word
|
||||
word_key = None # Word instance to use in lookup
|
||||
|
@ -1,4 +1,6 @@
|
||||
from .gcodes_base import *
|
||||
from .gcodes import DIALECT_UNKNOWN
|
||||
from .utils import Vector3, Quaternion, quat2coord_system
|
||||
|
||||
# ======================= Motion =======================
|
||||
# (X Y Z A B C U V W apply to all motions)
|
||||
|
137
src/pygcode/gcodes_marlin.patch
Normal file
137
src/pygcode/gcodes_marlin.patch
Normal file
@ -0,0 +1,137 @@
|
||||
100,104c100,104
|
||||
< class GCodeBedLevelingPointg1(GCodeMotion):
|
||||
< """G29: Probe the bed and enable leveling compensation."""
|
||||
< param_letters = "ACOQEDJV"
|
||||
< dialects = ['marlin2']
|
||||
< word_key = Word('G', 29)
|
||||
---
|
||||
> #class GCodeBedLevelingPointg1(GCodeMotion):
|
||||
> # """G29: Probe the bed and enable leveling compensation."""
|
||||
> # param_letters = "ACOQEDJV"
|
||||
> # dialects = ['marlin2']
|
||||
> # word_key = Word('G', 29)
|
||||
112,134c112,134
|
||||
< class GCodeBedLevelingLinearg2(GCodeMotion):
|
||||
< """G29: Probe the bed and enable leveling compensation."""
|
||||
< param_letters = "ACOQXYPSEDTHFBLRJV"
|
||||
< dialects = ['marlin2']
|
||||
< word_key = Word('G', 29)
|
||||
<
|
||||
< class GCodeBedLevelingManualm1(GCodeMotion):
|
||||
< """G29: Measure Z heights in a grid, enable leveling compensation"""
|
||||
< param_letters = "SIJXYZ"
|
||||
< dialects = ['marlin2']
|
||||
< word_key = Word('G', 29)
|
||||
<
|
||||
< class GCodeBedLeveling(GCodeMotion):
|
||||
< """G29: Probe the bed and enable leveling compensation"""
|
||||
< param_letters = ""
|
||||
< dialects = ['marlin2']
|
||||
< word_key = Word('G', 29)
|
||||
<
|
||||
< class GCodeBedLevelingUnifiedm3(GCodeMotion):
|
||||
< """G29: Probe the bed and enable leveling compensation."""
|
||||
< param_letters = "ABCDEFHIJKLPQRSTUVWXY"
|
||||
< dialects = ['marlin2']
|
||||
< word_key = Word('G', 29)
|
||||
---
|
||||
> #class GCodeBedLevelingLinearg2(GCodeMotion):
|
||||
> # """G29: Probe the bed and enable leveling compensation."""
|
||||
> # param_letters = "ACOQXYPSEDTHFBLRJV"
|
||||
> # dialects = ['marlin2']
|
||||
> # word_key = Word('G', 29)
|
||||
>
|
||||
> #class GCodeBedLevelingManualm1(GCodeMotion):
|
||||
> # """G29: Measure Z heights in a grid, enable leveling compensation"""
|
||||
> # param_letters = "SIJXYZ"
|
||||
> # dialects = ['marlin2']
|
||||
> # word_key = Word('G', 29)
|
||||
>
|
||||
> #class GCodeBedLeveling(GCodeMotion):
|
||||
> # """G29: Probe the bed and enable leveling compensation"""
|
||||
> # param_letters = ""
|
||||
> # dialects = ['marlin2']
|
||||
> # word_key = Word('G', 29)
|
||||
>
|
||||
> #class GCodeBedLevelingUnifiedm3(GCodeMotion):
|
||||
> # """G29: Probe the bed and enable leveling compensation."""
|
||||
> # param_letters = "ABCDEFHIJKLPQRSTUVWXY"
|
||||
> # dialects = ['marlin2']
|
||||
> # word_key = Word('G', 29)
|
||||
160,164c160,164
|
||||
< class GCodeMechanicalGantryCalibrationb(GCodeMotion):
|
||||
< """G34: Modern replacement for Průša's TMC_Z_CALIBRATION"""
|
||||
< param_letters = "SZ"
|
||||
< dialects = ['marlin2']
|
||||
< word_key = Word('G', 34)
|
||||
---
|
||||
> #class GCodeMechanicalGantryCalibrationb(GCodeMotion):
|
||||
> # """G34: Modern replacement for Průša's TMC_Z_CALIBRATION"""
|
||||
> # param_letters = "SZ"
|
||||
> # dialects = ['marlin2']
|
||||
> # word_key = Word('G', 34)
|
||||
425,432c425,426
|
||||
< """M43: Get information about pins."""
|
||||
< param_letters = "PWETSI"
|
||||
< dialects = ['marlin2']
|
||||
< word_key = Word('M', 43)
|
||||
<
|
||||
< class GCodeTogglePinsb(GCodeDigitalOutput):
|
||||
< """M43T: Get information about pins."""
|
||||
< param_letters = "SLIRW"
|
||||
---
|
||||
> """M43: Get information about pins / set pins"""
|
||||
> param_letters = "PWETSIRL"
|
||||
652c646
|
||||
< class GCodeBaricudaOpen(GCodeDigitalOutput):
|
||||
---
|
||||
> class GCodeBaricuda1Open(GCodeDigitalOutput):
|
||||
658c652
|
||||
< class GCodeBaricudaClose(GCodeDigitalOutput):
|
||||
---
|
||||
> class GCodeBaricuda1Close(GCodeDigitalOutput):
|
||||
664,665c658
|
||||
< # TODO: duplicate class name BaricudaOpen
|
||||
< class GCodeBaricudaOpen(GCodeDigitalOutput):
|
||||
---
|
||||
> class GCodeBaricuda2Open(GCodeDigitalOutput):
|
||||
671,672c664
|
||||
< # TODO: duplicate class name BaricudaClose
|
||||
< class GCodeBaricudaClose(GCodeDigitalOutput):
|
||||
---
|
||||
> class GCodeBaricuda2Close(GCodeDigitalOutput):
|
||||
768,769c760
|
||||
< # TODO: duplicate class name SetLaserCoolerTemperature
|
||||
< class GCodeSetLaserCoolerTemperature(GCodeCoolant):
|
||||
---
|
||||
> class GCodeSetLaserCoolerTemperatureAndWait(GCodeCoolant):
|
||||
775c766
|
||||
< class GCodeSetFilamentDiameter(GCodeOtherModal):
|
||||
---
|
||||
> class GCodeSetFilamentDiameterVolumetric(GCodeOtherModal):
|
||||
1051d1041
|
||||
< # TODO: duplicate class name SetFilamentDiameter
|
||||
1250,1254c1240,1244
|
||||
< class GCodeDeltaConfiguration(GCodeOtherModal):
|
||||
< """M665: Set delta geometry values"""
|
||||
< param_letters = "HLRSXYZABC"
|
||||
< dialects = ['marlin2']
|
||||
< word_key = Word('M', 665)
|
||||
---
|
||||
> #class GCodeDeltaConfiguration(GCodeOtherModal):
|
||||
> # """M665: Set delta geometry values"""
|
||||
> # param_letters = "HLRSXYZABC"
|
||||
> # dialects = ['marlin2']
|
||||
> # word_key = Word('M', 665)
|
||||
1268,1272c1258,1262
|
||||
< class GCodeSetDeltaEndstopAdjustmentsa(GCodeOtherModal):
|
||||
< """M666: Set Delta endstop adjustments"""
|
||||
< param_letters = "XYZ"
|
||||
< dialects = ['marlin2']
|
||||
< word_key = Word('M', 666)
|
||||
---
|
||||
> #class GCodeSetDeltaEndstopAdjustmentsa(GCodeOtherModal):
|
||||
> # """M666: Set Delta endstop adjustments"""
|
||||
> # param_letters = "XYZ"
|
||||
> # dialects = ['marlin2']
|
||||
> # word_key = Word('M', 666)
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
from .gcodes_base import *
|
||||
|
||||
from gcodes_legacy import *
|
||||
from .gcodes_legacy import *
|
||||
|
||||
# ======================= Prusa =======================
|
||||
# CODE PARAMETERS DESCRIPTION
|
||||
|
@ -4,13 +4,13 @@ from collections import defaultdict
|
||||
|
||||
from .gcodes import (
|
||||
MODAL_GROUP_MAP, GCode,
|
||||
# Modal GCodes
|
||||
GCodeMotion,
|
||||
GCodeIncrementalDistanceMode,
|
||||
GCodeUseInches, GCodeUseMillimeters,
|
||||
# Utilities
|
||||
words2gcodes,
|
||||
)
|
||||
from .gcodes_base import (
|
||||
# Modal GCodes
|
||||
GCodeMotion,
|
||||
)
|
||||
from .block import Block
|
||||
from .line import Line
|
||||
from .words import Word
|
||||
@ -18,6 +18,20 @@ from .utils import Vector3, Quaternion
|
||||
|
||||
from .exceptions import MachineInvalidAxis, MachineInvalidState
|
||||
|
||||
from pygcode.dialects import get_default as get_default_dialect
|
||||
match get_default_dialect():
|
||||
case 'marlin2':
|
||||
from .gcodes_marlin import (
|
||||
GCodeRelativePositioning as GCodeIncrementalDistanceMode,
|
||||
GCodeInchUnits as GCodeUseInches,
|
||||
GCodeMillimeterUnits as GCodeUseMillimeters,
|
||||
)
|
||||
case _:
|
||||
from .gcodes_legacy import (
|
||||
GCodeIncrementalDistanceMode,
|
||||
GCodeUseInches, GCodeUseMillimeters,
|
||||
)
|
||||
|
||||
UNIT_IMPERIAL = GCodeUseInches.unit_id # G20
|
||||
UNIT_METRIC = GCodeUseMillimeters.unit_id # G21
|
||||
UNIT_MAP = {
|
||||
|
347
src/pygcode/tools/marlin_parse_MarlinDocumentation.py
Executable file
347
src/pygcode/tools/marlin_parse_MarlinDocumentation.py
Executable file
@ -0,0 +1,347 @@
|
||||
#!/usr/bin/env python
|
||||
# vim: number ts=4
|
||||
"""
|
||||
generate src/pygcode/gcode_marlin.py based on official documentation
|
||||
"""
|
||||
from string import ascii_letters
|
||||
|
||||
class_types = {
|
||||
# unused: GCodeDistanceMode
|
||||
# unused: GCodePathControlMode
|
||||
# unused: GCodeProgramControl
|
||||
'g000': 'GCodeMotion', # LinearMove
|
||||
'g002': 'GCodeArcMove', # ArcOrCircleMove
|
||||
'g004': 'GCode', # Dwell
|
||||
'g005': 'GCodeMotion', # BzierCubicSpline
|
||||
'g006': 'GCodeMotion', # DirectStepperMove
|
||||
'g010': 'GCode', # Retract
|
||||
'g011': 'GCode', # Recover
|
||||
'g012': 'GCodeMotion', # CleanTheNozzle
|
||||
'g017': 'GCodePlaneSelect', # CncWorkspacePlanes
|
||||
'g020': 'GCodeUnit', # InchUnits
|
||||
'g021': 'GCodeUnit', # MillimeterUnits
|
||||
'g026': 'GCodeMotion', # MeshValidationPattern
|
||||
'g027': 'GCodeMotion', # ParkToolhead
|
||||
'g028': 'GCodeMotion', # AutoHome
|
||||
'g029': 'GCodeMotion', # BedLeveling
|
||||
'g029g1': 'GCodeMotion', # BedLevelingPoint
|
||||
'g029m2': 'GCodeMotion', # BedLevelingBilinear
|
||||
'g029g2': 'GCodeMotion', # BedLevelingLinear
|
||||
'g029m1': 'GCodeMotion', # BedLevelingManual
|
||||
'g029m3': 'GCodeMotion', # BedLevelingUnified
|
||||
'g030': 'GCodeMotion', # SingleZProbe
|
||||
'g031': 'GCodeMotion', # DockSled
|
||||
'g032': 'GCodeMotion', # UndockSled
|
||||
'g033': 'GCodeMotion', # DeltaAutoCalibration
|
||||
'g034b': 'GCodeMotion', # MechanicalGantryCalibration
|
||||
'g034a': 'GCodeMotion', # ZSteppersAutoAlignment
|
||||
'g035': 'GCodeMotion', # TrammingAssistant
|
||||
'g038': 'GCodeMotion', # ProbeTarget
|
||||
'g042': 'GCodeSelectCoordinateSystem', # MoveToMeshCoordinate
|
||||
'g053': 'GCodeSelectCoordinateSystem', # MoveInMachineCoordinates
|
||||
'g054': 'GCodeSelectCoordinateSystem', # WorkspaceCoordinateSystem
|
||||
'g060': 'GCode', # SaveCurrentPosition
|
||||
'g061': 'GCodeMotion', # ReturnToSavedPosition
|
||||
'g076': 'GCodeOtherModal', # ProbeTemperatureCalibration
|
||||
'g080': 'GCode', # CancelCurrentMotionMode
|
||||
'g090': 'GCodeOtherModal', # AbsolutePositioning
|
||||
'g091': 'GCodeOtherModal', # RelativePositioning
|
||||
'g092': 'GCodeOtherModal', # SetPosition
|
||||
'g425': 'GCodeOtherModal', # BacklashCalibration
|
||||
'm0000': 'GCodeOtherModal', # UnconditionalStop
|
||||
'm0003': 'GCodeSpindle', # SpindleCwLaserOn
|
||||
'm0004': 'GCodeSpindle', # SpindleCcwLaserOn
|
||||
'm0005': 'GCodeSpindle', # SpindleLaserOff
|
||||
'm0007': 'GCodeCoolant', # CoolantControls
|
||||
'm0010': 'GCodeDigitalOutput', # VacuumBlowerControl
|
||||
'm0016': 'GCodeOtherModal', # ExpectedPrinterCheck
|
||||
'm0017': 'GCodeOtherModal', # EnableSteppers
|
||||
'm0018': 'GCodeOtherModal', # DisableSteppers
|
||||
'm0020': 'GCodeIO', # ListSdCard
|
||||
'm0021': 'GCodeIO', # InitSdCard
|
||||
'm0022': 'GCodeIO', # ReleaseSdCard
|
||||
'm0023': 'GCodeIO', # SelectSdFile
|
||||
'm0024': 'GCodeOtherModal', # StartOrResumeSdPrint
|
||||
'm0025': 'GCodeOtherModal', # PauseSdPrint
|
||||
'm0026': 'GCodeIO', # SetSdPosition
|
||||
'm0027': 'GCodeNonModal', # ReportSdPrintStatus
|
||||
'm0028': 'GCodeIO', # StartSdWrite
|
||||
'm0029': 'GCodeIO', # StopSdWrite
|
||||
'm0030': 'GCodeIO', # DeleteSdFile
|
||||
'm0031': 'GCode', # PrintTime
|
||||
'm0032': 'GCodeIO', # SelectAndStart
|
||||
'm0033': 'GCodeIO', # GetLongPath
|
||||
'm0034': 'GCodeIO', # SdcardSorting
|
||||
'm0042': 'GCodeDigitalOutput', # SetPinState
|
||||
'm0043': 'GCodeIO', # DebugPins
|
||||
'm0043b': 'GCodeDigitalOutput', # TogglePins
|
||||
'm0048': 'GCodeMotion', # ProbeRepeatabilityTest
|
||||
'm0073': 'GCode', # SetPrintProgress
|
||||
'm0075': 'GCodeOtherModal', # StartPrintJobTimer
|
||||
'm0076': 'GCodeOtherModal', # PausePrintJobTimer
|
||||
'm0077': 'GCodeOtherModal', # StopPrintJobTimer
|
||||
'm0078': 'GCode', # PrintJobStats
|
||||
'm0080': 'GCodeOtherModal', # PowerOn
|
||||
'm0081': 'GCodeOtherModal', # PowerOff
|
||||
'm0082': 'GCodeOtherModal', # EAbsolute
|
||||
'm0083': 'GCodeOtherModal', # ERelative
|
||||
'm0085': 'GCodeOtherModal', # InactivityShutdown
|
||||
'm0086': 'GCodeOtherModal', # HotendIdleTimeout
|
||||
'm0087': 'GCodeOtherModal', # DisableHotendIdleTimeout
|
||||
'm0092': 'GCodeUnit', # SetAxisStepsPerUnit
|
||||
'm0100': 'GCodeNonModal', # FreeMemory
|
||||
'm0102': 'GCodeOtherModal', # ConfigureBedDistanceSensor
|
||||
'm0104': 'GCodeOtherModal', # SetHotendTemperature
|
||||
'm0105': 'GCodeNonModal', # ReportTemperatures
|
||||
'm0106': 'GCodeDigitalOutput', # SetFanSpeed
|
||||
'm0107': 'GCodeDigitalOutput', # FanOff
|
||||
'm0108': 'GCodeOtherModal', # BreakAndContinue
|
||||
'm0109': 'GCode', # WaitForHotendTemperature
|
||||
'm0110': 'GCodeOtherModal', # SetLineNumber
|
||||
'm0111': 'GCodeOtherModal', # DebugLevel
|
||||
'm0112': 'GCodeOtherModal', # FullShutdown
|
||||
'm0113': 'GCode', # HostKeepalive
|
||||
'm0114': 'GCodeNonModal', # GetCurrentPosition
|
||||
'm0115': 'GCodeNonModal', # FirmwareInfo
|
||||
'm0117': 'GCodeIO', # SetLcdMessage
|
||||
'm0118': 'GCodeIO', # SerialPrint
|
||||
'm0119': 'GCodeIO', # EndstopStates
|
||||
'm0120': 'GCodeIO', # EnableEndstops
|
||||
'm0121': 'GCodeIO', # DisableEndstops
|
||||
'm0122': 'GCodeIO', # TmcDebugging
|
||||
'm0123': 'GCodeIO', # FanTachometers
|
||||
'm0125': 'GCodeMotion', # ParkHead
|
||||
'm0126': 'GCodeDigitalOutput', # BaricudaOpen
|
||||
'm0127': 'GCodeDigitalOutput', # BaricudaClose
|
||||
'm0128': 'GCodeDigitalOutput', # BaricudaOpen
|
||||
'm0129': 'GCodeDigitalOutput', # BaricudaClose
|
||||
'm0140': 'GCodeOtherModal', # SetBedTemperature
|
||||
'm0141': 'GCodeOtherModal', # SetChamberTemperature
|
||||
'm0143': 'GCodeCoolant', # SetLaserCoolerTemperature
|
||||
'm0145': 'GCodeOtherModal', # SetMaterialPreset
|
||||
'm0149': 'GCodeUnit', # SetTemperatureUnits
|
||||
'm0150': 'GCodeDigitalOutput', # SetRgbWColor
|
||||
'm0154': 'GCodeNonModal', # PositionAutoReport
|
||||
'm0155': 'GCodeNonModal', # TemperatureAutoReport
|
||||
'm0163': 'GCodeOtherModal', # SetMixFactor
|
||||
'm0164': 'GCodeOtherModal', # SaveMix
|
||||
'm0165': 'GCodeOtherModal', # SetMix
|
||||
'm0166': 'GCodeOtherModal', # GradientMix
|
||||
'm0190': 'GCode', # WaitForBedTemperature
|
||||
'm0191': 'GCode', # WaitForChamberTemperature
|
||||
'm0192': 'GCode', # WaitForProbeTemperature
|
||||
'm0193': 'GCodeCoolant', # SetLaserCoolerTemperature
|
||||
'm0200': 'GCodeOtherModal', # SetFilamentDiameter
|
||||
'm0201': 'GCodeNonModal', # PrintTravelMoveLimits
|
||||
'm0203': 'GCodeFeedRateMode', # SetMaxFeedrate
|
||||
'm0204': 'GCodeOtherModal', # SetStartingAcceleration
|
||||
'm0205': 'GCodeOtherModal', # SetAdvancedSettings
|
||||
'm0206': 'GCodeOtherModal', # SetHomeOffsets
|
||||
'm0207': 'GCodeOtherModal', # SetFirmwareRetraction
|
||||
'm0208': 'GCodeOtherModal', # FirmwareRecover
|
||||
'm0209': 'GCodeOtherModal', # SetAutoRetract
|
||||
'm0211': 'GCodeOtherModal', # SoftwareEndstops
|
||||
'm0217': 'GCodeOtherModal', # FilamentSwapParameters
|
||||
'm0218': 'GCodeOtherModal', # SetHotendOffset
|
||||
'm0220': 'GCodeFeedRateMode', # SetFeedratePercentage
|
||||
'm0221': 'GCodeOtherModal', # SetFlowPercentage
|
||||
'm0226': 'GCodeIO', # WaitForPinState
|
||||
'm0240': 'GCodeIO', # TriggerCamera
|
||||
'm0250': 'GCodeIO', # LcdContrast
|
||||
'm0255': 'GCodeIO', # LcdSleepBacklightTimeout
|
||||
'm0256': 'GCodeIO', # LcdBrightness
|
||||
'm0260': 'GCodeDigitalOutput', # ICSend
|
||||
'm0261': 'GCodeIO', # ICRequest
|
||||
'm0280': 'GCodeIO', # ServoPosition
|
||||
'm0281': 'GCodeOtherModal', # EditServoAngles
|
||||
'm0282': 'GCodeOtherModal', # DetachServo
|
||||
'm0290': 'GCodeMotion', # Babystep
|
||||
'm0300': 'GCodeDigitalOutput', # PlayTone
|
||||
'm0301': 'GCodeOtherModal', # SetHotendPid
|
||||
'm0302': 'GCodeOtherModal', # ColdExtrude
|
||||
'm0303': 'GCodeOtherModal', # PidAutotune
|
||||
'm0304': 'GCodeOtherModal', # SetBedPid
|
||||
'm0305': 'GCodeOtherModal', # UserThermistorParameters
|
||||
'm0306': 'GCodeOtherModal', # ModelPredictiveTempControl
|
||||
'm0350': 'GCodeOtherModal', # SetMicroStepping
|
||||
'm0351': 'GCodeOtherModal', # SetMicrostepPins
|
||||
'm0355': 'GCodeDigitalOutput', # CaseLightControl
|
||||
'm0360': 'GCodeMotion', # ScaraThetaA
|
||||
'm0361': 'GCodeMotion', # ScaraThetaB
|
||||
'm0362': 'GCodeMotion', # ScaraPsiA
|
||||
'm0363': 'GCodeMotion', # ScaraPsiB
|
||||
'm0364': 'GCodeMotion', # ScaraPsiC
|
||||
'm0380': 'GCodeDigitalOutput', # ActivateSolenoid
|
||||
'm0381': 'GCodeDigitalOutput', # DeactivateSolenoids
|
||||
'm0400': 'GCodeOtherModal', # FinishMoves
|
||||
'm0401': 'GCodeDigitalOutput', # DeployProbe
|
||||
'm0402': 'GCodeDigitalOutput', # StowProbe
|
||||
'm0403': 'GCodeOtherModal', # MmuFilamentType
|
||||
'm0404': 'GCodeOtherModal', # SetFilamentDiameter
|
||||
'm0405': 'GCodeOtherModal', # FilamentWidthSensorOn
|
||||
'm0406': 'GCodeOtherModal', # FilamentWidthSensorOff
|
||||
'm0407': 'GCodeNonModal', # FilamentWidth
|
||||
'm0410': 'GCodeOtherModal', # Quickstop
|
||||
'm0412': 'GCodeOtherModal', # FilamentRunout
|
||||
'm0413': 'GCodeOtherModal', # PowerLossRecovery
|
||||
'm0420': 'GCodeNonModal', # BedLevelingState
|
||||
'm0421': 'GCodeOtherModal', # SetMeshValue
|
||||
'm0422': 'GCodeOtherModal', # SetZMotorXy
|
||||
'm0423': 'GCodeOtherModal', # XTwistCompensation
|
||||
'm0425': 'GCodeOtherModal', # BacklashCompensation
|
||||
'm0428': 'GCodeOtherModal', # HomeOffsetsHere
|
||||
'm0430': 'GCodeOtherModal', # PowerMonitor
|
||||
'm0486': 'GCodeOtherModal', # CancelObjects
|
||||
'm0493': 'GCodeOtherModal', # FixedTimeMotion
|
||||
'm0500': 'GCodeNonModal', # SaveSettings
|
||||
'm0501': 'GCodeOtherModal', # RestoreSettings
|
||||
'm0502': 'GCodeOtherModal', # FactoryReset
|
||||
'm0503': 'GCodeNonModal', # ReportSettings
|
||||
'm0504': 'GCodeNonModal', # ValidateEepromContents
|
||||
'm0510': 'GCodeOtherModal', # LockMachine
|
||||
'm0511': 'GCodeOtherModal', # UnlockMachine
|
||||
'm0512': 'GCodeNonModal', # SetPasscode
|
||||
'm0524': 'GCodeOtherModal', # AbortSdPrint
|
||||
'm0540': 'GCodeNonModal', # EndstopsAbortSd
|
||||
'm0569': 'GCodeOtherModal', # SetTmcSteppingMode
|
||||
'm0575': 'GCodeOtherModal', # SerialBaudRate
|
||||
'm0592': 'GCodeOtherModal', # NonlinearExtrusionControl
|
||||
'm0593': 'GCodeOtherModal', # ZvInputShaping
|
||||
'm0600': 'GCode', # FilamentChange
|
||||
'm0603': 'GCodeOtherModal', # ConfigureFilamentChange
|
||||
'm0605': 'GCodeOtherModal', # MultiNozzleMode
|
||||
'm0665': 'GCodeOtherModal', # DeltaConfiguration
|
||||
'm0665b': 'GCodeOtherModal', # ScaraConfiguration
|
||||
'm0666b': 'GCodeOtherModal', # SetDualEndstopOffsets
|
||||
'm0666a': 'GCodeOtherModal', # SetDeltaEndstopAdjustments
|
||||
'm0672': 'GCodeOtherModal', # DuetSmartEffectorSensitivity
|
||||
'm0701': 'GCodeOtherModal', # LoadFilament
|
||||
'm0702': 'GCodeOtherModal', # UnloadFilament
|
||||
'm0710': 'GCodeOtherModal', # ControllerFanSettings
|
||||
'm7219': 'GCodeDigitalOutput', # MaxControl
|
||||
'm0808': 'GCodeOtherModal', # RepeatMarker
|
||||
'm0810': 'GCodeOtherModal', # GCodeMacros
|
||||
'm0851': 'GCodeOtherModal', # XyzProbeOffset
|
||||
'm0852': 'GCodeOtherModal', # BedSkewCompensation
|
||||
'm0860': 'GCodeOtherModal', # ICPositionEncoders
|
||||
'm0871': 'GCodeOtherModal', # ProbeTemperatureConfig
|
||||
'm0876': 'GCode', # HandlePromptResponse
|
||||
'm0900': 'GCodeOtherModal', # LinearAdvanceFactor
|
||||
'm0906': 'GCodeOtherModal', # StepperMotorCurrent
|
||||
'm0907': 'GCodeOtherModal', # SetMotorCurrent
|
||||
'm0908': 'GCodeOtherModal', # SetTrimpotPins
|
||||
'm0909': 'GCodeNonModal', # DacPrintValues
|
||||
'm0910': 'GCodeNonModal', # CommitDacToEeprom
|
||||
'm0911': 'GCode', # TmcOtPreWarnCondition
|
||||
'm0912': 'GCode', # ClearTmcOtPreWarn
|
||||
'm0913': 'GCodeOtherModal', # SetHybridThresholdSpeed
|
||||
'm0914': 'GCodeOtherModal', # TmcBumpSensitivity
|
||||
'm0915': 'GCode', # TmcZAxisCalibration
|
||||
'm0916': 'GCode', # LThermalWarningTest
|
||||
'm0917': 'GCode', # LOvercurrentWarningTest
|
||||
'm0918': 'GCode', # LSpeedWarningTest
|
||||
'm0919': 'GCodeOtherModal', # TmcChopperTiming
|
||||
'm0928': 'GCodeIO', # StartSdLogging
|
||||
'm0951': 'GCodeOtherModal', # MagneticParkingExtruder
|
||||
'm0993': 'GCodeIO', # BackUpFlashSettingsToSd
|
||||
'm0994': 'GCodeIO', # RestoreFlashFromSd
|
||||
'm0995': 'GCodeIO', # TouchScreenCalibration
|
||||
'm0997': 'GCode', # FirmwareUpdate
|
||||
'm0999': 'GCodeOtherModal', # StopRestart
|
||||
't0000': 'GCodeOtherModal', # SelectOrReportTool
|
||||
't0001': 'GCode', # MmuSpecialCommands
|
||||
}
|
||||
|
||||
extra_attributes = {
|
||||
'g020': ['unit_id = 0'], # InchUnits
|
||||
'g021': ['unit_id = 1'], # MillimeterUnits
|
||||
}
|
||||
|
||||
def sanitize(string):
|
||||
return ''.join([char if char in ascii_letters else '' for char in string])
|
||||
|
||||
def code_val(string):
|
||||
try:
|
||||
return int(string[1:])
|
||||
except ValueError:
|
||||
try:
|
||||
return float(string[1:])
|
||||
except ValueError:
|
||||
return string.strip("'")[1:]
|
||||
|
||||
def extract_data(filename):
|
||||
param_letters = []
|
||||
with open(filename,'r') as file:
|
||||
for line in file.readlines():
|
||||
comment = ''
|
||||
if line.startswith('tag: '):
|
||||
tag = line[5:].rstrip()
|
||||
name_suffix = ''
|
||||
try:
|
||||
letter, code = line[5].upper(), int(line[6:].lstrip('0'))
|
||||
except ValueError as e:
|
||||
try:
|
||||
letter, code = line[5].upper(), line[6:].lstrip('0')
|
||||
if code == '\n': code = 0
|
||||
else: raise ValueError
|
||||
except ValueError:
|
||||
code = int(code[:-2].rstrip(ascii_letters))
|
||||
comment = f"# NOTE: {line}"
|
||||
name_suffix = line.rstrip('\n')[6:].replace(str(code), '').lstrip('0')
|
||||
code = int(code)
|
||||
elif line.startswith('title: '):
|
||||
title = line[7:].rstrip()
|
||||
class_name = sanitize(title.title())
|
||||
elif line.startswith('codes: '):
|
||||
codes = line[8:-2].replace(' ','').split(',')
|
||||
elif line.startswith('brief: '):
|
||||
brief = line.rstrip()[7:]
|
||||
elif line.startswith('- tag: '):
|
||||
param_letters.append(line[-2])
|
||||
|
||||
#print(f"\t'{tag}': 'GCode', # {class_name}")
|
||||
out = ""
|
||||
|
||||
out += f'''class {comment}GCode{class_name}{name_suffix}({class_types[tag]}):
|
||||
"""{', '.join(codes)}: {brief}"""
|
||||
param_letters = "{''.join(param_letters)}"
|
||||
dialects = ['marlin2']
|
||||
'''
|
||||
|
||||
if len(codes) > 1:
|
||||
out += f'''
|
||||
@classmethod
|
||||
def word_matches(cls, w):
|
||||
return (w.letter == '{letter}') and (w.value in {[code_val(v) for v in codes]})
|
||||
default_word = Word('{letter}', {code})
|
||||
'''
|
||||
else:
|
||||
out += f" word_key = Word('{letter}', {code})\n"
|
||||
|
||||
try:
|
||||
for extra_attr in extra_attributes[tag]:
|
||||
out += f" {extra_attr}"
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
return class_name, out
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from sys import argv, stderr
|
||||
all_classes = []
|
||||
|
||||
print("# DO NOT EDIT - file generated with pygcode/src/pygcode/tools/marlin_parse_MarlinDocumentation.py\nfrom .gcodes_base import *\n")
|
||||
print("# TODO: manual changes have been made! see pygcode/src/pygcode/gcode_marlin.patch", file=stderr)
|
||||
|
||||
for filename in argv[1:]:
|
||||
name, body = extract_data(filename)
|
||||
if name in all_classes:
|
||||
print(f"# TODO: duplicate class name GCode{name}", file=stderr)
|
||||
print(f"# TODO: duplicate class name GCode{name}")
|
||||
pass
|
||||
else:
|
||||
all_classes.append(name)
|
||||
print(body)
|
||||
|
Loading…
x
Reference in New Issue
Block a user