[Defect?] ObjectAttributes.PlotWeight has no effect – even with PlotWeightSource = PlotWeightFromObject



I wonder why setting the PlotWeight property has no effect. Positive and negative values always display the standard point, whereas the color can be changed. I set both the PlotWeightSource as well as the ObjectColorSource. See code below:


    protected IEnumerable<Guid> DrawSnappingPoints (Point3d[] points, double weight)
        var attributes = new ObjectAttributes();
        attributes.ObjectColor = System.Drawing.Color.Yellow;
        attributes.ColorSource = ObjectColorSource.ColorFromObject;
        attributes.PlotWeight = weight;
        attributes.PlotWeightSource = ObjectPlotWeightSource.PlotWeightFromObject;
        return Doc.Objects.AddPoints(points, attributes);
    DrawSnappingPoints (myPoints, 400.0);
    DrawSnappingPoints (myPoints, -1.0);

The screenshot shows the default point weight but with the custom yellow color:


My objective is to display snapping points during a GetPoint/GetTransform. To do so, I’d add points to the document before the GetPoint.Point() call and remove them after this call.
If this is a poor strategy in the first place I would be happy to receive further ideas. I try to avoid drawing the points in the DynamicDraw event as I already render quite a lot.

##My system
Rhino for Mac 5.3.1
Mono 4.8.0

(Dale Fugier) #2

Have you run the PrintDisplay command?

– Dale


@dale Yes, I ran _PrintDisplay with State=On, Color=Print and also Color=Display.
Under ViewPorts I did not enter anything. Should I?

(Dale Fugier) #4

It is never a good strategy to add temporary geometry to the document in a command or in a object/point picking operation.

You should always try to dynamically draw your temporary geometry using a conduit or on GetPoint.OnDynamicDraw callback.

Specifically to your problem, point objects do not use print weight (or thickness). This is why the points are not fatter.

But in a dynamic drawing operation, you can draw fatter points.

protected override void OnDynamicDraw(GetPointDrawEventArgs e)
  foreach (var pt in m_points)
    e.Display.DrawPoint(pt, PointStyle.ControlPoint, 3, m_color);


thank you, exactly what I needed.
Initially, I was worried that it would be too slow because redraws on every mouse move but it turned out just fine.


unfortunately, also the radius argument for Display.DrawPoints does draw fatter points. Is don’t think this is intended, right?

myGetPointCommand = (object sender, GetPointDrawEventArgs e) => e.Display.DrawPoints(SnappingPoints, Rhino.Display.PointStyle.X, 80, System.Drawing.Color.Blue);

(Dale Fugier) #7

I am not sure I understand the question. Can you explain further?


Sorry, forgot a word. The argument int radius does not change the weight of the points for me. I guess it is it a defect indeed. The following two calls unexpectedly produce the same result:

e.Display.DrawPoints(pointArray, Rhino.Display.PointStyle.X, 1, System.Drawing.Color.Blue);
e.Display.DrawPoints(pointArray, Rhino.Display.PointStyle.X, 100, System.Drawing.Color.Blue);

The reason why I would want different weights is that I would like to have a white border around the blue points. So I thought I’d

  1. draw white points with a weight w
  2. draw blue points with a weight w – delta

Is this a viable strategy? Is there another way to achieve this while the Display.DrawPoints() is not working as expected?

(Dale Fugier) #9

If you specify a point style of Rhino.Display.PointStyle.X, then the radius parameter is ignored and a fixed radius of 3 is used. Thus, if you want to control the radius, choose an different point style.