Adding Expanded Turning to a .62 post

From Compost Wiki
Revision as of 17:58, 16 December 2021 by JeffBuchan (talk | contribs) (Updated to include "Workaround" information at the bottom of the page.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Replace spindle control subs

First, you should complete the steps in Adding Broaching Support to a .62 post.

List of subs to replace

  1. doInverseSpinOn
  2. doSpeed
  3. doCalcRPM1
  4. doCalcRPM2
  5. doSpinOn
  6. ckSpinOn
  7. doOpSpinOff
  8. doSpinOff
  9. ckSpindleDirection
  10. ckTapSpindleDirection
  11. ckWorkPieceSpindle
  12. doSpeedC
  13. millSpindleOn

New code for these subs

doInverseSpinOn:
	IF TurningOp?
		IF SpindleForward?
			'M4' {Reverse}
		ELSEIF SpindleReverse?
			'M3' {Forward}
		END
	ELSE {implies MillingOp}
		IF SpindleForward?
			'M54' {Reverse}
		ELSEIF SpindleReverse?
			'M53' {Forward}
		END
	END
RETURN

doSpeed:
	IF NOT OpIsToolOriented?
		ToolSpeed
	END

	IF NOT OpIsPartOriented?
		PartSpeed
	END
RETURN

doCalcRPM1:
	' S' Output('S', CalcRPM1#)
RETURN

doCalcRPM2:
	' S' Output('S', CalcRPM2#)
RETURN

doSpinOn:
	IF NOT OpIsToolOriented?
		ToolSpindleOn
	END

	IF NOT OpIsPartOriented?
		PartSpindleOn
	END
RETURN

ckSpinOn:
	IF (LASTOperation OpIsToolOriented? AND NOT OpIsToolOriented?) OR
	(LASTOperation OpIsPartOriented? AND NOT OpIsPartOriented?)
		doSpinOn
	END
RETURN

doOpSpinOff: {current Op SpinOff}
	IF NOT OpIsToolOriented?
		ToolSpindleOff
	END

	IF NOT OpIsPartOriented?
		PartSpindleOff
	END
RETURN

doSpinOff: {previous Op SpinOff}
	IF NOT LASTOperation OpIsToolOriented?
		LASTOperation ToolSpindleOff
	END

	IF NOT LASTOperation OpIsPartOriented?
		LASTOperation PartSpindleOff
	END
RETURN

ckSpindleDirection:
	IF PartSpindleDirChanged? OR ToolSpindleDirChanged?
		SeqLabC doSpinOff EOL
	END
RETURN

ckTapSpindleDirection:
	IF ToolBAxisAvail?
		IF Milling? AND ABCToolPath?	{if 5-axis Milling or Drilling}
			IF (PartSpindleDirChanged? OR ToolSpindleDirChanged?) AND Tap?
				SeqLabC doOpSpinOff EOL
				SeqLabC doSpeed doSpinOn EOL
			END
		END
	END
RETURN

ckWorkPieceSpindle:	{Part Spindle Off before MillingOp}
	IF OpIsPartOriented? AND NOT LASTOperation OpIsPartOriented?
		LASTOperation PartSpindleOff
	END
RETURN

doSpeedC:
	IF (TurningOp? AND NOT OpIsPartOriented?) AND (PartSpindleRPMChanged? OR PartSpindleSFPMChanged?)
		doSpeed
	ELSEIF (NOT OpIsToolOriented?) AND ToolSpindleRPMChanged? {implies MillingOp}
		doSpeed
	END
RETURN

millSpindleOn:
	IF NOT OpIsToolOriented?
		SeqLabC CSSOff constantRPM doSpeed doSpinOn EOL
	END
RETURN

In the Form:

  1. Form->Program Options->Options tab
    • Check "Broaching"
    • Check "Expanded Turning"
    • Leave "Flat Eccentric Turning" set to "No Support."
  2. Form->Toolgroups and Part Stations->Spindle Options tab
    • "Turn CSS On with spindle" must be turned on if you intend to turn CSS on on part before the start of the toolPath: sub.
    • "Unconditional Spindle Commands" must be turned on

Considerations and Workarounds:

Spindle Mode

As of 12/2021, the "SpindleModeMilling?" Boolean does not return true with Expanded Turning ops (Defect #50190,#50422). This causes an issue with same tool connect loops when going from a turning op to an expanded turning op. In this situation, we are using a turning tool from the turning op (same tool), but because Expanded Turing uses the Rotary Axis we need to stop the Part Spindle and engage "milling mode". Normally we use the "spindle mode" Booleans to check for this (Previous/SpindleModeMilling?, Previous/SpindleModeTurning?), but because the Milling Mode check fails, we don't properly stop the spindle and engage milling mode. As a work around, the following changes can be made to alleviate this issue till the bug is fixed.

transToExpandedTurning?:
	ReturnBool (ExpandedTurningOp? AND PreviousSpindleModeTurning?)
RETURN

I added this Boolean check in two places...

In ckSpindleMode...

ckSpindleMode:
	IF Flag?('MillingOnOffMode')
		IF SpindleModeMilling?
			IF OpType?('MoveTool')
				{no output}
			ELSE
				doMillingMode
			END
		END
	ELSE {implies TurningOn MillingOn Mode}
		IF transToExpandedTurning?		<---- *** HERE ***
			doMillingMode
		ELSEIF SpindleModeTurning?
			IF PreviousSpindleModeTurning?
				IF WorkPieceChange?
					doTurningMode
				ELSE
					{no output}
				END
			ELSE {implies Prev Spindle Mode Milling or NOT Defined yet}
				doTurningMode
			END
		ELSE
			IF SpindleModeMilling?
				IF PreviousSpindleModeMilling?
					IF WorkPieceChange?
						doMillingMode
					ELSE
						{no output}
					END
				ELSE {implies Prev Spindle Mode Turning or NOT Defined yet}
					doMillingMode
				END
			END
		END
	END
RETURN

And in millSameToolConnectLoop...

millSameToolConnectLoop: {Finish/Start Milling Operation}
	SetPass1
	setAutoCycle
	ResetFeedRate
	EachInterOpFeat
		IF OpStartFeat?	{** this is an ALWAYS Feature **}
			initSameToolOp
			ckRadialOpAsTiltOp
			SetOutputRotatedTT	{Output Tool Tip Point}
			IF StartOpSync?
				{* no output of new Speed here *}
				{* no output of MillingMode here *}
				IF XMove? OR YMove? OR ZMove?
					SeqLabC Rapid AbsValue millFeedRateMode doMoveXC approachYAxis doMoveZC doCoolOn EOL
				ELSE
					SeqLabC Rapid AbsValue millFeedRateMode doMoveXC approachYAxis doMoveZ doCoolOn EOL
				END
				SeqLabC apply5axToolOffset EOL
			ELSE
				IF LASTOperation EndOpSync?
					{* no output of MillingMode here *}
				ELSE
					SeqLabC ckSpindleMode EOL
					
					{2021/11/04 JeffB: Added "IF NOT LinearBroachingOp?" logic, broaching support.}
					{2021/12/13 JeffB: Added "AND NOT EllipticalTurningOp?" requirement.}
					IF NOT LinearBroachingOp? AND NOT EllipticalTurningOp?
						IF NotEqual? SpeedRPM# LASTOperation SpeedRPM#
							SeqLabC CSSOff constantRPM doSpeed {Speed} ckSpinOn EOL	{2021/11/04 JeffB: Changed Speed to doSpeed.}
						ELSE
							SeqLabC ckSpinOn EOL
						END
					END
				END
				SeqLabC Rapid AbsValue millFeedRateMode doMoveXC approachYAxis doMoveZC doStartPosC doCoolOn EOL
				setAngleUnder360
				SeqLabC ckMoveRotaryToZero EOL
				SeqLabC apply5axToolOffset EOL
			END
		ELSE
			IF RapidFeat?
				IF OnPartClearFeat?
					{* no output of approach here *}
				ELSE
					IF XMove? OR YMove? OR ZMove?
						SeqLabC RapidC doMoveXC doMoveZC EOL
					END
				END
			ELSE {implies LineFeat}
				IF XMove? OR YMove? OR ZMove?
					SeqLabC FeedC doMoveXC doMoveZC FeedEntC EOL
				END
			END
		END
		IF FirstFeat?
			{** this is an ALWAYS Feature **}
		END
		IF OpEndFeat?	{** this is an ALWAYS Feature **}
			doOpEndFeatComment
			ckRotateCoordOff
			doEndOpPS
			IF LASTOperation EndOpSync?
				IF StartOpSync?
					SeqLabC ckSyncSpinOff EOL
					SeqLabC ckSyncMillingModeOff EOL
				END
				SeqLabC doEndOpSync EOL
			ELSEIF transToExpandedTurning?				<---- *** HERE ***
				SeqLabC doSpinOff EOL
			END
			IF CoolantChange?
				SeqLabC doCoolOff EOL
			ELSE
				IF CoolOff? AND LASTOperation CoolOn?
					SeqLabC doCoolOff EOL
				END
			END
			IF StartOpSync? AND LASTOperation EndOpSync?
				SeqLabC ckMillingModeOff EOL
			END
		END
		IF OnPartClearFeat?
			{** this is an ALWAYS Feature **}
		END
		IF OpStartFeat?	{** this is an ALWAYS Feature **}
			doOpStartFeatComment
			IF StartOpSync?
				SeqLabC doStartOpSync EOL
			END
			doPostScript
			IF StartOpSync? OR LASTOperation EndOpSync?
				SeqLabC ckWorkPieceSpindle EOL
				SeqLabC ckSpindleMode EOL
				ckMillRotaryStartUp
				millSpindleOn
				SeqLabC doStartPosC doCoolOn EOL
				setAngleUnder360
				SeqLabC ckMoveRotaryToZero EOL
			END
			ckRotateCoordOn
			doRotateCoordCurrentLoc
			ckSameToolPlane
			IF Flag?('MillingClampOff')
				ckMillClampOn
			END
			IF Milling?
				IF ABCToolPath?	{if 5-axis Milling or Drilling}
					{do not exit}
				ELSE
					EndLoop
				END
			END
		END
		IF LastFeat?
			{** this is an ALWAYS Feature for Drilling **}
			{** this is an ALWAYS Feature for 5-axis Milling **}
			{** this is a NEVER Feature for Milling **}
		END
	NextInterOpFeat
RETURN

This should stop and set the correct spindle mode durring the millSameToolConnectLoop.