Esempio n. 1
0
        public static Point3d[] AskPoints()
        {
            var selectionoptions = new UFUi.SelectionOption();

            // Type Filter (right next to the 'Menu' dropdown menu in the NX GUI)
            var selectionFilter = new UFUi.Mask();

            selectionFilter.object_type       = UFConstants.UF_point_type;
            selectionFilter.object_subtype    = UFConstants.UF_point_subtype;
            selectionFilter.solid_type        = 0;
            selectionoptions.mask_triples     = new[] { selectionFilter };
            selectionoptions.num_mask_triples = 1;

            // Only objects in workpart, not in an assembly or other components of an assembly
            // aka. Selection Scope (right next the 'Type Filter in the NX GUI)
            selectionoptions.scope = UFConstants.UF_UI_SEL_SCOPE_WORK_PART;

            int response;
            int pointCount;

            Tag[] pointTags;
            UfSession.Ui.SelectByClass("Select Points to export as CSV.", ref selectionoptions, out response, out pointCount, out pointTags);

            Point3d[] pts = new Point3d[pointCount];
            for (int i = 0; i < pointCount; i++)
            {
                // The dialog only returns the Tags (ID as unsigend integer) of the points. The object concrete object will be obtained via the global object manager
                Point point = (Point)UfSession.GetObjectManager().GetTaggedObject(pointTags[i]);
                pts[i] = point.Coordinates;
            }

            return(pts);
        }