﻿using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
public class Form1
{

	private void Button1_Click(object sender, EventArgs e)
	{
		SolidEdgeFramework.Application objSEApplication = null;
		SolidEdgePart.PartDocument objPartDoc = null;
		SolidEdgePart.CoordinateSystem CS = null;

		try
		{
			objSEApplication = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
			objPartDoc = objSEApplication.Documents.Add("SolidEdge.PartDocument");
			objPartDoc.CoordinateSystems.Item(1).Visible = false;
			double[] CSTransform = new double[16];
			CSTransform[0] = 2;
			CSTransform[1] = 0; //X-Rotation Transform
			CSTransform[2] = 0;

			CSTransform[3] = 0; //Px

			CSTransform[4] = 0;
			CSTransform[5] = 2; //Y-Rotation Transform
			CSTransform[6] = 0;

			CSTransform[7] = 0; //Py

			CSTransform[8] = 0;
			CSTransform[9] = 0; //Z-Rotation Transform
			CSTransform[10] = 2;

			CSTransform[11] = 0; //Pz

			CSTransform[12] = 0.05 | 0.1; //xTranslation
			CSTransform[13] = 0.05 | 0.1; //yTranslation
			CSTransform[14] = 0.05 | 0.1; //zTranslation

			CSTransform[15] = 1;

			CS = objPartDoc.CoordinateSystems.AddByMatrix(CSTransform);


		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.ToString());
		}
	}

	public Form1()
	{
		SubscribeToEvents();
	}

//NOTE: Converted event handler wireups:
	private bool EventsSubscribed = false;
	private void SubscribeToEvents()
	{
		if (EventsSubscribed)
			return;
		else
			EventsSubscribed = true;

		Button1.Click += Button1_Click;
		Button1.Click += Button1_Click;
	}

}
