DisplayConduit - Set PointCloud.PointStyle From Square To Round?

Hello,

How do I set the point style of a Point Cloud being drawn in a Display Conduit?

I was hoping to assign a display mode description to the pointcloud but I realized since the point cloud is not being added to the document via .Add method it doesn’t have a GUID, is that correct?

    // Method to assign a display mode to the point cloud
    private void AssignDisplayModes(PointCloud pointCloud, DisplayModeDescription displayModeName)
    {
        // Get the object ID of the point cloud
        var obj = Rhino.RhinoDoc.ActiveDoc.Objects.Find(pointCloud);
        if (obj != null)
        {
            // Set the display mode for the point cloud object
            obj.Attributes.SetDisplayModeOverride(displayModeName);
            obj.CommitChanges(); // Apply changes to the object's attributes
        }
    }

This fails because pointCloud does not have an Id.


I was using the CloudDisplay component to visualize this point cloud in grasshopper which worked nicely but am now converting that grasshopper script to C#

Now that I am using a Csharp script I am using a Display Conduit to visualize the point cloud and that’s working fine except that the points of said cloud are drawn as solid squares and I want to set them to be drawn as solid circles.

I see display modes have a “Point Cloud Style” parameter but this doesn’t seem to effect a point cloud drawn in the Display Conduit? If it does I’m struggling on how to assign the display mode to said point cloud in the conduit.


DrawPointCloud appears to only take size and color arguments leading me to believe the display style is what will determine the “look” of the point cloud.
https://developer.rhino3d.com/api/rhinocommon/rhino.display.displaypipeline/drawpointcloud


Thank you so much for your help, I’m stumped!

EDIT:

Okay just realized there is a Display Pipeline attribute called Point Cloud Style:

https://developer.rhino3d.com/api/rhinocommon/rhino.display.displaypipelineattributes/pointcloudstyle

I’m unsure how to assign the PointStyle to the point cloud points or my Draw methods in the conduit.

@dale @Gijs is there documentation on assigning PointStyle to a PointCloud?

Thank you!

EDIT 2:

My current point cloud displays as:

Where as the Grasshopper CloudDisplay component is using a different point style that I want to get closer to, I think it’s PointStyle.PointCloudStyle.RoundDot or a variation of that, perhaps it’s actually a sprite?

You can see below I am setting the PointCloudStyle but this doesn’t seem to be working for the conduit as it visually still shows square and print statement says square as well.

    // Override the DrawForeground to draw point clouds
    protected override void DrawForeground(DrawEventArgs e)
    {
        if (majorPointCloud != null && majorPointCloud.Count > 0)
        {
            // Set the desired point cloud style
            e.Display.DisplayPipelineAttributes.PointCloudStyle = PointStyle.SolidCircle; // Set to solid circle style
            Rhino.RhinoApp.WriteLine($"DisplayPipeplineAttr: {e.Display.DisplayPipelineAttributes.PointCloudStyle}"); //This prints as PointStyle.Square still...

            // Draw major points with size 5
            e.Display.DrawPointCloud(majorPointCloud, 5);  
        }

        if (minorPointCloud != null && minorPointCloud.Count > 0)
        {
            // Optionally set the point style for minor points as well
            e.Display.DisplayPipelineAttributes.PointCloudStyle = PointStyle.SolidCircle; // Set to solid circle style

            // Draw minor points with size 3
            e.Display.DrawPointCloud(minorPointCloud, 3);  
        }
    }

@stevebaer are you familiar with the DisplayConduit PointStyle methods and able to lean in here?

Thank you all!

I could be wrong, but I don’t think there is a way to set it for pointclouds.
How many points are in your cloud? Could you convert the points in the cloud on the fly to normal points perhaps?

Just tested and this works, so the display of styles is not the issue:

style= Rhino.Display.PointStyle.Clover
e.Display.DrawPoints(pts, style, 11, Color.LightCyan)
1 Like

Thanks for testing @Gijs , I started with the regular points drawn and indeed that worked fine it just bottlenecks performance wise because the clouds I have are 1 million plus points at times. The point cloud for this can be generated instantly and viewport navigated buttery smooth still. If I use points it’s very low frame rate though.

I do think it’s possible for the point cloud point style to be set as the methods are in the API docs, the Display Mode settings have an option to change that style of point cloud objects, and I saw this older post from Dale to that effect.

I’m just struggling with where/how to apply it in the Display Conduit.

Oddly when I added the Point Cloud to the Rhino Doc and then changed the display mode point cloud style manually in Document Properties it did not change the point cloud style either and was still square.

I don’t want to cry bug :bug: as I haven’t tested that enough but it has me wondering if perhaps the Display Mode / Attributes for point cloud objects are in fact not applying correctly.

I’ll test that manually in Rhino outside of my script and see if I find anything odd.

Thanks!

It might be a bug indeed:
RH-84088 Setting a custom pointcloud style

1 Like

Thanks @Gijs for reporting

Any update on this one @Gijs ?

I’m testing additional display settings that need to work in tandem with the point cloud display and would love to have the pointstyle working.

Cheers

Kindly bumping this one again as the same issue is present in setting the PointStyle with Rhino.Display.PointStyle within a Custom Display Conduit like so:

attr.PointStyle = Rhino.Display.PointStyle.SolidCircle

within the context of:

        @staticmethod
        def MySpecialDisplayAttributesExample():
            attr = Display.PreviewAttributes()
            attr.PointStyle = Rhino.Display.PointStyle.SolidCircle
            attr.CurveColor = Color.BlueViolet  # Default is Color.Yellow
            attr.ObjectColor = Color.BlueViolet 
            attr.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject
            attr.TextColor = Color.Black
            return attr

I’m stuck with square points for both point clouds and all point representation via Display Conduit until this is resolved.

Perhaps I’m just doing it wrong? or this is related to the RH-84088 bug as well?

Thank you for your insights & clarifications!

The YT is targeted at 9.x so Im afraid there’s no good news for now.

Oof, I was really hoping this was a 8.0 regression that would be fixed but perhaps this has been an issue for longer then?

Well, either way, thank you for the update!