
(* TODO: Add your comment here *)
FUNCTION ReadMacroParam
	ReadMacroParam := 0;
	IF(AttributeName = 'Type')THEN
		TargetPosition.Type := AttributeValue;
	ELSIF(AttributeName = 'XTarget')THEN
		TargetPosition.X													:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'XbotID')THEN
		TargetPosition.XbotID												:= STRING_TO_USINT(AttributeValue);	
	ELSIF(AttributeName ='YTarget')THEN
		TargetPosition.Y				 									:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'ZTarget')THEN
		TargetPosition.Z													:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'CmdLabel')THEN
		TargetPosition.CmdLabel												:= STRING_TO_UINT(AttributeValue);
	ELSIF(AttributeName = 'RXTarget')THEN
		TargetPosition.RX													:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'RYTarget')THEN
		TargetPosition.RY													:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'RZTarget')THEN
		TargetPosition.RZ													:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'MaxAcc')THEN
		TargetPosition.MaxAccel					 							:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'MaxSpeed')THEN
		TargetPosition.MaxSpeed												:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'FinalSpeed')THEN
		TargetPosition.FinalSpeed											:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'PositionMode')THEN
		TargetPosition.PositionMode											:= STRING_TO_USINT(AttributeValue);
	ELSIF(AttributeName = 'MacroOption')THEN
		TargetPosition.MacroOption											:= STRING_TO_USINT(AttributeValue);
	ELSIF(AttributeName = 'MacroID')THEN
		TargetPosition.MacroID												:= STRING_TO_USINT(AttributeValue);
	ELSIF(AttributeName = 'PathType')THEN
		TargetPosition.PathType												:= STRING_TO_USINT(AttributeValue);
	ELSIF(AttributeName = 'Radius')THEN
		TargetPosition.Angle												:= STRING_TO_REAL(AttributeValue);	
	ELSIF(AttributeName ='ArcType')THEN
		TargetPosition.ArcType												:= STRING_TO_USINT(AttributeValue);
	ELSIF(AttributeName ='Direction')THEN
		TargetPosition.Direction											:= STRING_TO_USINT(AttributeValue);
	ELSIF(AttributeName ='ArcMode')THEN
		TargetPosition.ArcMode												:= STRING_TO_USINT(AttributeValue);
	ELSIF(AttributeName = 'WaitMode')THEN
		WaitUntil.WaitMode													:= STRING_TO_USINT(AttributeValue);
	ELSIF(AttributeName = 'TimeDelay')THEN
		WaitUntil.TimeDelay													:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'DisplacementTrigger')THEN						
		WaitUntil.DisplacementTrigger										:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'DigitalID')THEN
		WaitUntil.DigitalID													:= STRING_TO_USINT(AttributeValue);
	ELSIF(AttributeName = 'PosFactorA')THEN
		WaitUntil.PosFactorA												:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'PosFactorB')THEN
		WaitUntil.PosFactorB												:= STRING_TO_REAL(AttributeValue);
	ELSIF(AttributeName = 'TriggerCmdLabel')THEN
		WaitUntil.TriggerCmdLabel											:= STRING_TO_UINT(AttributeValue);
	ELSIF(AttributeName = 'TriggerMode')THEN
		WaitUntil.TriggerMode												:= STRING_TO_USINT(AttributeValue); 
	ELSIF(AttributeName = 'TriggerType')THEN
		WaitUntil.TriggerType												:= STRING_TO_USINT(AttributeValue);
	ELSIF(AttributeName = 'TriggerXbotID')THEN
		WaitUntil.TriggerXbotID												:= STRING_TO_USINT(AttributeValue);		
	ELSE
		ReadMacroParam := 99;
	END_IF;
END_FUNCTION
