コード例 #1
0
        public static Boolean Hide(Boolean Run)
        {
            if (!Run)
            {
                return(false);
            }
            DB.Document doc = DocumentManager.Instance.CurrentDBDocument;

            Categories categories = doc.Settings.Categories;

            DB.Category pointCloudCategory = categories.get_Item(BuiltInCategory.OST_PointClouds);
            View        activeView         = doc.ActiveView;

            PointCloudOverrides pc_ovverides = activeView.GetPointCloudOverrides();

            if (activeView.ViewTemplateId == ElementId.InvalidElementId)
            {
                try
                {
                    TransactionManager.Instance.EnsureInTransaction(doc);
                    activeView.SetCategoryHidden(pointCloudCategory.Id, true);
                    TransactionManager.Instance.TransactionTaskDone();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
            return(false);
        }
コード例 #2
0
        public static Boolean SetColorMode(int ColorMode)
        {
            DB.Document doc = DocumentManager.Instance.CurrentDBDocument;
            //add selection

            FilteredElementCollector         collector   = new FilteredElementCollector(doc);
            IEnumerable <PointCloudInstance> pointClouds = collector.OfCategory(BuiltInCategory.OST_PointClouds)
                                                           .WhereElementIsNotElementType().ToList()
                                                           .Cast <PointCloudInstance>();
            PointCloudOverrides pco = doc.ActiveView.GetPointCloudOverrides();


            foreach (PointCloudInstance pointCloud in pointClouds)
            {
                PointCloudOverrideSettings pt_cloud_settings = pco.GetPointCloudScanOverrideSettings(pointCloud.Id);

                switch (ColorMode)
                {
                case 0:
                    pt_cloud_settings.ColorMode = PointCloudColorMode.Elevation;
                    break;

                case 1:
                    pt_cloud_settings.ColorMode = PointCloudColorMode.FixedColor;
                    break;

                case 2:
                    pt_cloud_settings.ColorMode = PointCloudColorMode.Intensity;
                    break;

                case 3:
                    pt_cloud_settings.ColorMode = PointCloudColorMode.NoOverride;
                    break;

                case 4:
                    pt_cloud_settings.ColorMode = PointCloudColorMode.Normals;
                    break;

                default:
                    break;
                }

                try
                {
                    View activeView = doc.ActiveView;
                    PointCloudOverrides     overrides = activeView.GetPointCloudOverrides();
                    PointCloudColorSettings pointCloudColorSettings = new PointCloudColorSettings();
                    TransactionManager.Instance.EnsureInTransaction(doc);
                    overrides.SetPointCloudScanOverrideSettings(pointCloud.Id, pt_cloud_settings);
                    TransactionManager.Instance.TransactionTaskDone();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
            return(false);
        }