AngularDimension randomly choses reflex angle


When creating angular dimensions from an arc with RhinoCommon, the location for the dimension and text seem to be randomly chosen between the angle given by the arc and its reflex angle.

The constructor of Rhino.Geometry.AngularDimension takes an arc to define the angle and an offset value to place the dimension. After adding the dimension to the model with scriptcontext.doc.Objects.AddAngularDimension the grip that is controlling the placement of the dimension is sitting directly at the start point of the arc or at the given offset from this point - which leaves the decision as to which side of the line the dimension will appear to numerical uncertainty…

Could be more stable to use the CENTER of the given arc for placing the respective grip?


(Dale Fugier) #2

Hi Fabian,

Can you post a sample command with code that is not working for you?

– Dale


Voilà: asks for three points and creates both an arc and an angular dimension with an offset of 10.0 from the arc. After a few tries it looks like this: Half of the dimensions measure along the arc, the other half measure the reflex angle:

import rhinoscriptsyntax as rs
import scriptcontext
import Rhino
import System.Drawing

def main():
    while True:
        pt1 = rs.GetPoint("start")
        if pt1 == None: break
        pt2 = rs.GetPoint("interior", pt1)
        if pt2 == None: break
        pt3 = rs.GetPoint("end", pt2)
        if pt3 == None: break
        arc = Rhino.Geometry.Arc(pt1, pt2, pt3)
        dim = Rhino.Geometry.AngularDimension(arc, 10.0) 
        idDim = scriptcontext.doc.Objects.AddAngularDimension(dim)
        idArc = scriptcontext.doc.Objects.AddArc(arc)
        rs.ObjectColor(idArc, System.Drawing.Color.Red)

(Dale Fugier) #4

Hi Edwin,

Yep, I see this.

There really isn’t enough exposed (in RhinoCommon) to make the AngularDimension object very useful. I’ve added an item on the “list” to tune this up a bit.

– Dale


Thanks Dale,

the exposed interfaces were sufficient if the outcome would be predictable…

It might be as simple as setting the third grip of the dimension doc-object to the mid of the arc instead of the start. Looking forward to the next release!