How to Hide Scans by name in a Point Cloud for a View

How to Hide Scans by name in a Point Cloud for a View

k67s
Participant Participant
165 Views
0 Replies
Message 1 of 1

How to Hide Scans by name in a Point Cloud for a View

k67s
Participant
Participant

I have a point cloud that is displayed in the current view. For this view, I want to hide a scan named "scan_001". I've seen options like using PointCloudOverrideSettings and PointCloudOverrides in the Revit API, as shown in the following code snippet:

 

Document doc = commandData.Application.ActiveUIDocument.Document;
View activeView = commandData.Application.ActiveUIDocument.ActiveView;

string targetScanName = "scan_001";
bool shouldEnable = false; // Set to false to hide the scan

using (Transaction trans = new Transaction(doc, "Toggle Specific Point Cloud Scan"))
{
    trans.Start();

    // Find all point cloud instances in the active view
    IEnumerable<PointCloudInstance> pointClouds = new FilteredElementCollector(doc, activeView.Id)
        .OfClass(typeof(PointCloudInstance))
        .Cast<PointCloudInstance>();

    foreach (PointCloudInstance pci in pointClouds)
    {
        // Check if the point cloud contains the target scan
        if (pci.GetScans().Contains(targetScanName))
        {
            PointCloudOverrideSettings overrideSettings = new PointCloudOverrideSettings
            {
                Visible = shouldEnable
            };

            PointCloudOverrides pco = new PointCloudOverrides();
            pco.SetPointCloudScanOverrideSettings(pci.Id, overrideSettings, targetScanName, doc);
        }
    }

    doc.Regenerate();
    trans.Commit();
}

 

 

However, as I understand it, this is a general setting for the point cloud, not a visibility setting for the specific view. I need to access the "checkboxes" in the Visibility/Graphics Override for the current view and override them for this specific view only. Any suggestions or guidance would be greatly appreciated.

0 Likes
166 Views
0 Replies
Replies (0)