public void ImportFromKinect()
        {
            Document doc =
                Autodesk.AutoCAD.ApplicationServices.
                Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;

            Transaction tr =
                doc.TransactionManager.StartTransaction();

            KinectPolyJig kj = new KinectPolyJig(doc, tr);

            kj.InitializeSpeech();

            if (!kj.StartSensor())
            {
                ed.WriteMessage(
                    "\nUnable to start Kinect sensor - " +
                    "are you sure it's plugged in?"
                    );
                tr.Dispose();
                return;
            }

            PromptResult pr = ed.Drag(kj);

            if (pr.Status != PromptStatus.OK && !kj.Finished)
            {
                kj.ClearTransients();
                kj.StopSensor();
                tr.Dispose();
                return;
            }

            // Generate a final point cloud with color before stopping
            // the sensor

            kj.UpdatePointCloud();
            kj.StopSensor();

            kj.AddPolylines();
            tr.Commit();

            // Manually dispose to avoid scoping issues with
            // other variables

            tr.Dispose();

            kj.WriteAndImportPointCloud(doc, kj.Vectors);
        }
    public void ImportFromKinect()
    {
      Document doc =
        Autodesk.AutoCAD.ApplicationServices.
          Application.DocumentManager.MdiActiveDocument;
      Editor ed = doc.Editor;

      Transaction tr =
        doc.TransactionManager.StartTransaction();
      
      KinectPolyJig kj = new KinectPolyJig(doc, tr);

      kj.InitializeSpeech();

      if (!kj.StartSensor())
      {
        ed.WriteMessage(
          "\nUnable to start Kinect sensor - " +
          "are you sure it's plugged in?"
        );
        tr.Dispose();
        return;
      }

      PromptResult pr = ed.Drag(kj);

      if (pr.Status != PromptStatus.OK && !kj.Finished)
      {
        kj.ClearTransients();
        kj.StopSensor();
        tr.Dispose();
        return;
      }

      // Generate a final point cloud with color before stopping
      // the sensor

      kj.UpdatePointCloud();
      kj.StopSensor();

      kj.AddPolylines();
      tr.Commit();

      // Manually dispose to avoid scoping issues with
      // other variables

      tr.Dispose();

      kj.WriteAndImportPointCloud(doc, kj.Vectors);
    }