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

            Transaction tr =
                doc.TransactionManager.StartTransaction();

            // Pass in a default radius of 5cm and a segment length
            // of 10 times that

            KinectCylinderJig kj =
                new KinectCylinderJig(doc, tr, 0.1, 10);

            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.StopSensor();
                kj.Cleanup();
                tr.Dispose();
                return;
            }

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

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

            kj.AddSolidOrPath();
            tr.Commit();

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

            tr.Dispose();

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

            Transaction tr =
              doc.TransactionManager.StartTransaction();

            // Pass in a default radius of 5cm and a segment length
            // of 10 times that

            KinectCylinderJig kj =
              new KinectCylinderJig(doc, tr, 0.1, 10);

            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.StopSensor();
                kj.Cleanup();
                tr.Dispose();
                return;
            }

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

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

            kj.AddSolidOrPath();
            tr.Commit();

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

            tr.Dispose();

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