String getState() {
		StringBuffer commands = new StringBuffer("# orientation/center/spin state;\nset refreshing false;\n");
		if (!isWindowCentered())
			commands.append("set windowCentered false;\n");
		commands.append("center " + StateManager.escape(fixedRotationCenter) + ";\n");
		commands.append(getMoveToText(0) + ";\n");
		commands.append("slab " + slabPercentSetting + ";depth " + depthPercentSetting
				+ (slabEnabled ? ";slab on" : "") + (!zoomEnabled ? ";zoom off" : "") + ";\n");
		commands.append("set spin X " + (int) spinX);
		commands.append(";set spin Y " + (int) spinY);
		commands.append(";set spin Z " + (int) spinZ);
		commands.append(";set spin fps " + (int) spinFps + ";\n");
		if (spinOn) {
			commands.append("set refreshing true;refresh;\n");
			if (isSpinInternal) {
				Point3f pt = new Point3f(internalRotationCenter);
				pt.add(rotationAxis);
				commands.append("spin " + rotationRate + " " + StateManager.escape(internalRotationCenter) + " "
						+ StateManager.escape(pt));
			}
			else if (isSpinFixed) {
				commands.append("spin axisangle " + StateManager.escape(rotationAxis) + " " + rotationRate);
			}
			else {
				commands.append("spin on");
			}
			commands.append(";\n");
		}

		if (viewer.modelSetHasVibrationVectors()) {
			commands.append("vibration scale " + vibrationScale + ";\n");
			if (vibrationOn)
				commands.append("vibration " + vibrationPeriod + ";\n");
		}

		commands.append("\n");
		return commands.toString();
	}