Struggling with dimension text!

Hi,
I’m currently trying to send dimensions to speckle.
I can’t get any proper text displayed, could anyone help?

Here is my test stream: https://app.speckle.systems/projects/5da632bec0/models/c40dc9a8fa@1df26f2f9a#embed={"isEnabled"%3Atrue}

And my little bit of code:

DistanceDimension dim = new DistanceDimension();
dim.position = PointToSpeckle(dimension.FirstTopPoint);
dim.richText = @“{\rtf1\deff0{\fonttbl{\f0 Arial; } }\f0 \fs40{\f0 " + dimension.TextString+“mm}}”;
dim.measurement = dimension.MeasuredValue;
dim.units = u;
dim.isOrdinate = false;
dim.value = dimension.TextString+” mm";
dim.textPosition = PointToSpeckle(dimension.FirstTopPoint);
dim.direction = VectorToSpeckle((D3Vector)dimension.Direction);
DisplayStyle dimDisplayStyle = new DisplayStyle { linetype=“Continuous”,units= “mm”,lineweight=0,color=System.Drawing.Color.Red.ToArgb()};
dim[“displayStyle”] = dimDisplayStyle;
System.Collections.Generic.List displayValue = new System.Collections.Generic.List();
System.Collections.Generic.List curves = GetDisplayLines(dimension);
dim.displayValue = curves.Select(l => LineToSpeckle(l) as ICurve).ToList();
dim.measured = new System.Collections.Generic.List { PointToSpeckle(dimension.FirstTopPoint), PointToSpeckle(dimension.SecondTopPoint) };
dim[“renderMaterial”] = RenderMaterialToSpeckle(dimension);
list.Add(dim);

I cannot see what’s wrong in here :confused:

Hi @Choochoote

The current dimensions implementation is pretty bare bones and incomplete, so I wouldn’t expect too much from them. Regardless, DistanceDimension is supported in a minimalist way.

In order to have the text show, you will need to have a Objects.Geometry.Plane object under a RhinoProps key on the dimension object. Like in the image below

There are plans to better support dimensions and text for the upcoming iterations.

Cheers

1 Like

Thanks, Alex, for your kind reply.
It’s a bit frustrating to have to add Rhino properties through another software :confused: — but if it works and lets me see the dimension texts, then that’s good enough for now.

Another issue has come up, though: adjusting the font height through rich text still doesn’t seem to work.

I agree, it’s far from ideal. That’s there because dimensions were originally only supported from the Rhino connector. It’s not something we want to propagate forward when we do the dimensions rework.

The richText property is ignored in the viewer and the displayed text is read from the value property. Text size is read from a height property which will act like a fontSize, however in the context of dimensions, it’s never been sent over from connectors so I’m a bit unsure how well it will work.

Cheers

What a pain.
I give up, dimension text are too messy to work with.
I used Texts instead, it’s not too bad so far.


Thanks a lot for your help!