Example #1
0
        /// <summary>
        /// Hides or unhides objects according to the check states of checked list boxes in View List tool window.
        /// </summary>
        public static void OnPluginIdling()
        {
            // check if there is a visibility change of point clouds in ViewListForm.
            foreach (KeyValuePair <string, ObjectVisibility> pair in ViewListForm.GetPointCloudsVisibilityChanged())
            {
                string           point_cloud_identifier = pair.Key;
                ObjectVisibility point_cloud_visibility = pair.Value;

                if (OutlierPointCloudEngine.ContainPointCloud(point_cloud_identifier))
                {
                    if (point_cloud_visibility.Visible)
                    {
                        OutlierPointCloudEngine.UnhidePointCloud();
                    }
                    else
                    {
                        OutlierPointCloudEngine.HidePointCloud();
                    }
                }
                else if (InlierPointCloudEngine.ContainPointCloud(point_cloud_identifier))
                {
                    if (point_cloud_visibility.Visible)
                    {
                        InlierPointCloudEngine.UnhidePointCloud(point_cloud_identifier);
                    }
                    else
                    {
                        InlierPointCloudEngine.HidePointCloud(point_cloud_identifier);
                    }
                }
                else
                {
                    continue;
                }

                point_cloud_visibility.Expire();
            }

            // check if there are visibility changes of DirectShape instances in ViewListForm.
            foreach (KeyValuePair <string, ObjectVisibility> shape in ViewListForm.GetShapesVisibilityChanged())
            {
                if (shape.Value.Visible)
                {
                    DirectShapeEngine.UnhideDirectShape(shape.Key);
                }
                else
                {
                    DirectShapeEngine.HideDirectShape(shape.Key);
                }

                shape.Value.Expire();
            }
        }
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiApp = commandData.Application;
            UIDocument    uiDoc = uiApp.ActiveUIDocument;

            ViewListForm form = new ViewListForm();

            form.ShowDialog(s_hwndRevit);

            return(Result.Succeeded);
        }